• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 13:21
CEST 19:21
KST 02:21
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL20] Ro24 Preview Pt2: Take-Off0[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18
Community News
Maestros of The Game—$20k event w/ live finals in Paris24Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195Weekly Cups (Jul 28-Aug 3): herO doubles up6
StarCraft 2
General
What mix of new and old maps do you want in the next 1v1 ladder pool? (SC2) : 2v2 & SC: Evo Complete: Weekend Double Feature Geoff 'iNcontroL' Robinson has passed away The GOAT ranking of GOAT rankings RSL Revival patreon money discussion thread
Tourneys
Maestros of The Game—$20k event w/ live finals in Paris RSL: Revival, a new crowdfunded tournament series Sparkling Tuna Cup - Weekly Open Tournament Monday Nights Weeklies Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
External Content
Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below Mutation # 484 Magnetic Pull
Brood War
General
[ASL20] Ro24 Preview Pt2: Take-Off BW General Discussion No Rain in ASL20? Flash On His 2010 "God" Form, Mind Games, vs JD BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL20] Ro24 Group C [ASL20] Ro24 Group B BWCL Season 63 Announcement [CSLPRO] It's CSLAN Season! - Last Chance
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread General RTS Discussion Thread Dawn of War IV Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The year 2050 European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 3948 users

The Big Programming Thread - Page 136

Forum Index > General Forum
Post a Reply
Prev 1 134 135 136 137 138 1031 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
BisuDagger
Profile Blog Joined October 2009
Bisutopia19246 Posts
May 11 2012 00:26 GMT
#2701
Anyone know the best way to study phone interview questions for C# overnight? I have an exciting phone screening interview tomorrow and would like to prepare just in case I"m asked some.
ModeratorFormer Afreeca Starleague Caster: http://afreeca.tv/ASL2ENG2
tec27
Profile Blog Joined June 2004
United States3701 Posts
May 11 2012 04:15 GMT
#2702
On May 11 2012 02:37 holdthephone wrote:
What are the best webhosting services? Looking to start up a site and plan to implement a database...

Is GoDaddy the obvious choice?

I've used Site5 for years. They're pretty reliable and cheap as hell
Can you jam with the console cowboys in cyberspace?
Crazyeyes
Profile Blog Joined March 2008
Canada1342 Posts
May 11 2012 04:53 GMT
#2703
So it's now summer, and as a CS student with zero experience of any sort I figure it'd be nice to get some. Making some money in the meantmie would also be neat.
I've been checking local classifieds and stuff, but am having the common problem of 'MINIMUM 5 YEARS EXPERIENCE.'

Anyways, the few jobs I DO find seem overwhelming and scary. All of them involve things I've never done and therefore do not know how to do. I'm afraid to apply for fear that I do get the job and then find myself lost and overwhelmed.

So I'm here hoping to learn that this is common and that my fears are irrational, I guess.
I just wanna have a compsci job ;_;
WeeEEeeEEEeeEEEeeeEEee!!
Element)LoGiC
Profile Joined July 2003
Canada1143 Posts
Last Edited: 2012-05-11 06:55:27
May 11 2012 06:52 GMT
#2704
On May 11 2012 13:53 Crazyeyes wrote:
So it's now summer, and as a CS student with zero experience of any sort I figure it'd be nice to get some. Making some money in the meantmie would also be neat.
I've been checking local classifieds and stuff, but am having the common problem of 'MINIMUM 5 YEARS EXPERIENCE.'

Anyways, the few jobs I DO find seem overwhelming and scary. All of them involve things I've never done and therefore do not know how to do. I'm afraid to apply for fear that I do get the job and then find myself lost and overwhelmed.

So I'm here hoping to learn that this is common and that my fears are irrational, I guess.
I just wanna have a compsci job ;_;


Well, considering you've never actually programmed anything commercial, how many things that people would request do you think you'd be able to do right off the bat?

You only learn when you try things you can't already do. It's normal, and those fears are completely rational. Maybe they do hire you and you can't do it, which is unlikely if you've stuck with programming this long. Hopefully you enjoy it and try it in your spare time and like to learn about it which will make you not only able to do it, but enjoy it.

I would think it worse if you didn't think it overwhelming and scary, which means you may be ignorant to the complexity in some ways.

You'll be fine
leperphilliac
Profile Blog Joined September 2010
United States399 Posts
May 11 2012 06:54 GMT
#2705
What's a good beginner project to work on? I'm thinking about making my own version of tetris and pong which looks really simple (pacman would involve AI and would be next step if tetris/pong work out easily). Would C be a good language for it? I'm most comfortable with C but know C++ Java and Python. Reason for project is because I got rejected from every internship opportunity. It's insane how cutthroat the market is...
Element)LoGiC
Profile Joined July 2003
Canada1143 Posts
May 11 2012 06:56 GMT
#2706
On May 11 2012 15:54 leperphilliac wrote:
What's a good beginner project to work on? I'm thinking about making my own version of tetris and pong which looks really simple (pacman would involve AI and would be next step if tetris/pong work out easily). Would C be a good language for it? I'm most comfortable with C but know C++ Java and Python. Reason for project is because I got rejected from every internship opportunity. It's insane how cutthroat the market is...


What type of job are you looking for? What technologies and languages do you like?
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
May 11 2012 07:23 GMT
#2707
+ Show Spoiler +
public static MvcHtmlString ActionLink(this HtmlHelper html, string action, object routeValues)
{
var url = new UrlHelper(html.ViewContext.RequestContext);

// build the <a> tag
var anchorBuilder = new TagBuilder("a");
anchorBuilder.MergeAttribute("href", url.Action(action, routeValues));
anchorBuilder.MergeAttribute("disabled", "true");
string anchorHtml = anchorBuilder.ToString(TagRenderMode.Normal);

return MvcHtmlString.Create(anchorHtml);
}


hi, i got a problem with C#

what i'm trying to do is disabling the link like it is gray'd out and unclickable

i tried searching for it in the web and they said just to set the attribute disabled to true =/ but it doesnt work
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
e-Goh
Profile Joined January 2012
New Zealand18 Posts
Last Edited: 2012-05-11 09:12:58
May 11 2012 09:11 GMT
#2708
On May 11 2012 16:23 icystorage wrote:
+ Show Spoiler +
public static MvcHtmlString ActionLink(this HtmlHelper html, string action, object routeValues)
{
var url = new UrlHelper(html.ViewContext.RequestContext);

// build the <a> tag
var anchorBuilder = new TagBuilder("a");
anchorBuilder.MergeAttribute("href", url.Action(action, routeValues));
anchorBuilder.MergeAttribute("disabled", "true");
string anchorHtml = anchorBuilder.ToString(TagRenderMode.Normal);

return MvcHtmlString.Create(anchorHtml);
}


hi, i got a problem with C#

what i'm trying to do is disabling the link like it is gray'd out and unclickable

i tried searching for it in the web and they said just to set the attribute disabled to true =/ but it doesnt work


That's some serious convolution in that code you've got there. If it were me, I'd just change the href to # and the style to whatever your css disable link style is. End product: <a href="#" class="a.disabled">blahblah</a>. Dunno how to do that with your multitude of "builders" though. Good thing I'm not a web developer!
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
May 11 2012 10:06 GMT
#2709
On May 11 2012 18:11 e-Goh wrote:
Show nested quote +
On May 11 2012 16:23 icystorage wrote:
+ Show Spoiler +
public static MvcHtmlString ActionLink(this HtmlHelper html, string action, object routeValues)
{
var url = new UrlHelper(html.ViewContext.RequestContext);

// build the <a> tag
var anchorBuilder = new TagBuilder("a");
anchorBuilder.MergeAttribute("href", url.Action(action, routeValues));
anchorBuilder.MergeAttribute("disabled", "true");
string anchorHtml = anchorBuilder.ToString(TagRenderMode.Normal);

return MvcHtmlString.Create(anchorHtml);
}


hi, i got a problem with C#

what i'm trying to do is disabling the link like it is gray'd out and unclickable

i tried searching for it in the web and they said just to set the attribute disabled to true =/ but it doesnt work


That's some serious convolution in that code you've got there. If it were me, I'd just change the href to # and the style to whatever your css disable link style is. End product: <a href="#" class="a.disabled">blahblah</a>. Dunno how to do that with your multitude of "builders" though. Good thing I'm not a web developer!

nah its okay, i found it easier making it non anchor and made some conditions in abling and disabling it
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
ohampatu
Profile Joined July 2010
United States1448 Posts
May 12 2012 16:35 GMT
#2710
I'm back. Im having some issues again. Im trying to create a 'webpage' that will automate monitoring calls for quality. Its only in its rough draft form but I've hit a stump. I have a 'onclick' button that I want to 'generate' my monitor notes. I was thinking like making if else statements for each Y/N answer. That way I can just copy/paste from the output field.

So the problem. I have the 'button' made, but im not a javascript guy, and i dont know of an easy way to write this in HTML using basic input methods. This is a project at work, my IT dept recommended Jquery but no access to that and i move pc's regularly. Any pointers on where i would go from from the beginning, or if the following is just terrible code?

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript" type="text/javascript">
<!--
function generate ()




Here is the code:

+ Show Spoiler +

<html><head><title>Monitoring Notes</title>

<table>
<tr><td>
<h1>Monitoring Form</h1>
<h3>Greeting: Makes a connection; Builds the relationship</h3>
<table class="info">
<tr><td>Answers Promptly; Identifies Self and ISP at the beginning of the call</td>
<td><INPUT TYPE="radio" NAME="q1-1" VALUE="y">Yes <INPUT TYPE="radio" NAME="q1-1" VALUE="n">No</td></tr>
<tr><td>Expresses empathy through words and tone; Offers welcoming words</td>
<td><INPUT TYPE="radio" NAME="q1-2" VALUE="y">Yes <INPUT TYPE="radio" NAME="q1-2" VALUE="n">No</td></tr>
<tr><td>Asks for the UN and caller name; Uses AdminTool to lookup user info, asks for ticket #</td>
<td><INPUT TYPE="radio" NAME="q1-3" VALUE="y">Yes <INPUT TYPE="radio" NAME="q1-3" VALUE="n">No</td></tr>
<tr><td>Addresses the caller by name; Starts developing a rapport with the caller</td>
<td><INPUT TYPE="radio" NAME="q1-4" VALUE="y">Yes <INPUT TYPE="radio" NAME="q1-4" VALUE="n">No</td></tr>
<tr><td>Tells the caller they WILL help, or what they CAN do for them</td>
<td><INPUT TYPE="radio" NAME="q1-5" VALUE="y">Yes <INPUT TYPE="radio" NAME="q1-5" VALUE="n">No</td></tr>
</table>
<h3>Professionalism: Acts Professionally; Expresses Confidence</h3>
<table class="info">
<tr><td>Takes ownership of the call and control of the situation; is specific</td>
<td><INPUT TYPE="radio" NAME="q2-1" VALUE="y">Yes <INPUT TYPE="radio" NAME="q2-1" VALUE="n">No</td></tr>
<tr><td>Uses MAGIC phrases to build confidence and trust</td>
<td><INPUT TYPE="radio" NAME="q2-2" VALUE="y">Yes <INPUT TYPE="radio" NAME="q2-2" VALUE="n">No</td></tr>
<tr><td>Expresses sincerity and helpfulness through tone; Maintains a good pace</td>
<td><INPUT TYPE="radio" NAME="q2-3" VALUE="y">Yes <INPUT TYPE="radio" NAME="q2-3" VALUE="n">No</td></tr>
<tr><td>Speaks clearly with proper volume; Avoids tragic phrases</td>
<td><INPUT TYPE="radio" NAME="q2-4" VALUE="y">Yes <INPUT TYPE="radio" NAME="q2-4" VALUE="n">No</td></tr>
<tr><td>Uses Please and Thank You to show courtesy</td>
<td><INPUT TYPE="radio" NAME="q2-5" VALUE="y">Yes <INPUT TYPE="radio" NAME="q2-5" VALUE="n">No</td></tr>
</table>
<h3>Attentiveness: Gets to the Heart of the Matter; Listens and Asks Questions</h3>
<table class="info">
<tr><td>Listens, doesn't interrupt; Rephrases appropriately</td>
<td><INPUT TYPE="radio" NAME="q3-1" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-1" VALUE="n">No</td></tr>
<tr><td>Uses proper grammar; Avoids the use of slang words or acronyms</td>
<td><INPUT TYPE="radio" NAME="q3-2" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-2" VALUE="n">No</td></tr>
<tr><td>Asks qualifying questions; Asks for permission to gain more information</td>
<td><INPUT TYPE="radio" NAME="q3-3" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-3" VALUE="n">No</td></tr>
<tr><td>Before a hold/lag time for transfer; explains why and receives permission</td>
<td><INPUT TYPE="radio" NAME="q3-4" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-4" VALUE="n">No</td></tr>
<tr><td>After a hold or wait time; uses caller's name, waits for a resopnse, and thanks him/her</td>
<td><INPUT TYPE="radio" NAME="q3-5" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-5" VALUE="n">No</td></tr>
</table>
<h3>Courtesy & Clarity: Inform, and Clarify what you will do</h3>
<table class="info">
<tr><td>Educates the caller with relevant information</td>
<td><INPUT TYPE="radio" NAME="q3-1" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-1" VALUE="n">No</td></tr>
<tr><td>Is proactive; offers options or solutions before they are requested</td>
<td><INPUT TYPE="radio" NAME="q3-2" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-2" VALUE="n">No</td></tr>
<tr><td>Sets a deadline or timeframe before the caller asks</td>
<td><INPUT TYPE="radio" NAME="q3-3" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-3" VALUE="n">No</td></tr>
<tr><td>Summarizes the next steps</td>
<td><INPUT TYPE="radio" NAME="q3-4" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-4" VALUE="n">No</td></tr>
<tr><td>Obtains the caller's agreement on the next steps</td>
<td><INPUT TYPE="radio" NAME="q3-5" VALUE="y">Yes <INPUT TYPE="radio" NAME="q3-5" VALUE="n">No</td></tr>
</table>
<h3>Closing: Closes with the Relationship in Mind</h3>
<table class="info">
<tr><td>Offers additional assistance when appropriate; makes last offer to help, offers ticket number</td>
<td><INPUT TYPE="radio" NAME="q4-1" VALUE="y">Yes <INPUT TYPE="radio" NAME="q4-1" VALUE="n">No</td></tr>
<tr><td>Uses the caller's name and a magic phrase in closing</td>
<td><INPUT TYPE="radio" NAME="q4-2" VALUE="y">Yes <INPUT TYPE="radio" NAME="q4-2" VALUE="n">No</td></tr>
<tr><td>Closes with a sincere tone</td>
<td><INPUT TYPE="radio" NAME="q4-3" VALUE="y">Yes <INPUT TYPE="radio" NAME="q4-3" VALUE="n">No</td></tr>
<tr><td>Gives caller their name, brands the call, advises of 24/7 availability</td>
<td><INPUT TYPE="radio" NAME="q4-4" VALUE="y">Yes <INPUT TYPE="radio" NAME="q4-4" VALUE="n">No</td></tr>
<tr><td>Stays with the caller until the end</td>
<td><INPUT TYPE="radio" NAME="q4-5" VALUE="y">Yes <INPUT TYPE="radio" NAME="q4-5" VALUE="n">No</td></tr>
</table>
<h3>Technical Skills & Ability</h3>
<table class="info">
<tr><td>Was able to adequately identify the issue at hand</td>
<td><INPUT TYPE="radio" NAME="q5-1" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-1" VALUE="n">No</td></tr>
<tr><td>Connection Type/OS of caller was correctly identfied</td>
<td><INPUT TYPE="radio" NAME="q5-2" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-2" VALUE="n">No</td></tr>
<tr><td>Supported issues within scope of support</td>
<td><INPUT TYPE="radio" NAME="q5-3" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-3" VALUE="n">No</td></tr>
<tr><td>A correct and logical sequence of events was followed for the issue at hand</td>
<td><INPUT TYPE="radio" NAME="q5-4" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-4" VALUE="n">No</td></tr>
<tr><td>Able to troubleshoot without assistance and/or Escalated properly</td>
<td><INPUT TYPE="radio" NAME="q5-5" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-5" VALUE="n">No</td></tr>
<tr><td>Displayed initiative and used skill in moving toward resolution</td>
<td><INPUT TYPE="radio" NAME="q5-6" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-6" VALUE="n">No</td></tr>
<tr><td>Hold times and Dead air were kept to a minimum</td>
<td><INPUT TYPE="radio" NAME="q5-7" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-7" VALUE="n">No</td></tr>
<tr><td>All verifications of information were made correctly</td>
<td><INPUT TYPE="radio" NAME="q5-8" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-8" VALUE="n">No</td></tr>
<tr><td>Timing of the call was acceptable</td>
<td><INPUT TYPE="radio" NAME="q5-9" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-9" VALUE="n">No</td></tr>
<tr><td>Call Tracker notes are adequate, correct, concise, and clear</td>
<td><INPUT TYPE="radio" NAME="q5-10" VALUE="y">Yes <INPUT TYPE="radio" NAME="q5-10" VALUE="n">No</td></tr>

</table>

</td><td valign="top"><button type="button" onclick="generate()">Generate<br />Feedback<br /></button></td><td valign="top"><textarea name="output" rows="20" cols="20" style="width:400px;height:500px;"></textarea></td></tr>
</table>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
I am become death, for I am the destroyer of worlds.....You will be missed KT Violet!!!
tofucake
Profile Blog Joined October 2009
Hyrule19077 Posts
May 12 2012 16:41 GMT
#2711
use jQuery. It's a single javascript file that sits with the rest of your site's code and will make your life a lot easier.
Liquipediaasante sana squash banana
heroyi
Profile Blog Joined March 2009
United States1064 Posts
Last Edited: 2012-05-14 20:31:11
May 14 2012 14:06 GMT
#2712
whelp I can't figure this out...

I was wondering if someone could help explain to me how to utilize bool in a function form. The reason I ask this is because I am working on this tic tac toe game and am trying to make it so that the game keeps going (asking players to make turns) until it reaches to a halt (three in a row) thus ending the game. I can't figure out how to use the boolean operation to a function form...

Here is the code to help me on:

+ Show Spoiler +


int a = 0;
int b = 0;
int i = 0;

int j = 0;
char tictac[3][3] =
{
{'1','2','3'},
{'4','5','6'},
{'7','8','9'}
};

void board() //intialize board
{
for(i=0;i<3;i++)
{ for(j=0;j<3;j++)
{cout << tictac[i][j] << " " ;}
cout << endl;}
cout << endl;
}


void choice() //to help mark spot for player one
{
if(a == 1)
{ tictac[0][0] = 'X';
board();}

else if(a == 2)
{tictac[0][1] = 'X';
board();}

else if(a == 3)
{tictac[0][2] = 'X';
board();}

else if(a == 4)
{tictac[1][0] = 'X';
board();}

else if(a == 5)
{tictac[1][1] = 'X';
board();}

else if(a == 6)
{tictac[1][2] = 'X';
board();}

else if(a == 7)
{tictac[2][0] = 'X';
board();}

else if(a == 8)
{tictac[2][1] = 'X';
board();}

else if(a == 9)
{tictac[2][2] = 'X';
board();}
}

void choice1() //to help mark spot for player 2
{
if(b == 1)
{tictac[0][0] = 'O';
board();}

else if(b == 2)
{tictac[0][1] = 'O';
board();}

else if(b == 3)
{tictac[0][2] = 'O';
board();}

else if(b == 4)
{tictac[1][0] = 'O';
board();}

else if(b == 5)
{tictac[1][1] = 'O';
board();}

else if(b == 6)
{tictac[1][2] = 'O';
board();}

else if(b == 7)
{tictac[2][0] = 'O';
board();}

else if(b == 8)
{tictac[2][1] = 'O';
board();}

else if(b == 9)
{tictac[2][2] = 'O';
board();}

}



void player1() ]//loop to ask for turn for player 1
{
cout << "Player 1: ";
cin >> a;
while (!cin || a == b) // loop to help catch bad input
{
cout << "choose a different spot: ";
cin.clear();
cin.sync();
cin >> a;
}
choice();
}

void player2() //loop to ask for turn for player 2
{
cout << "Player 2: ";
cin >> b;
while (!cin || a == b) //loop to help catch bad input
{
cout << "choose a different spot: ";
cin.clear();
cin.sync();
cin >> b;
}
choice1();
}



int main()
{

Sleep(2000);
cout << "Lets play tic tac toe between two players" << endl;


for(i=0;i<3;i++) //create board
{for(j=0;j<3;j++)
{cout << tictac[i][j] << " " ;}
cout << endl;}
cout << endl;

Sleep(2000);
cout << "Here is the board. Enter the number to mark your spot." << endl;
cout << "Player 1 is X and player 2 is O." << endl;


cout << "Player 1 goes first. Please enter your number: ";
cin >> a;
choice();
cout << "Player 2: ";
cin >> b;
while (!cin || a == b)
{
cout << "choose a different spot: ";
cin.clear();
cin.sync();
cin >> b;
}
choice1();

[b]//below is the loop/boolean code I am trying to implement but to fail. I have tried different variations and this one here just happens to be the one that I copy and pasted here.[/b]

while(tictac[0][0] == tictac[0][1] != tictac[0][2] || tictac[0][0] == tictac[2][0] != tictac[1][0] || tictac[2][0] == tictac[2][1] != tictac[2][2] || tictac[0][0] != tictac[1][1] == tictac[2][2] || tictac[2][2] != tictac[1][2] == tictac[0][2] )
{player1();
player2();
}


//^^Here I was trying to make it so that as long as three in a row wasn't created then the game would continue in the loop (thus the while loop). However if a three in a row was detected then the statement would become false and would jump out of the loop to "end the game."


{cout << "gg" << endl;} //not the best ending but that isnt the problem.



system("PAUSE");
return 0;


}


appreciate the help
btw fyi: You can ignore some of my coding in the main function (block of code above my comments). I understand it may not be "consistent" but I was more worried on making the code work. Once I can get the whole thing going then I will go around and clean it up a bit to make it nicer.

btw how is my coding "style?" Is there any bad "habits" that I should avoid that is present in my work?
*********


off topic: What situation would call for you to use array over vector? Vectors can do everything an array can but better it seems...is it more efficient to use array on a small memory managment or something?

************

sorry for cluttering :/
wat wat in my pants
MisterD
Profile Blog Joined June 2010
Germany1338 Posts
May 14 2012 14:46 GMT
#2713
boolean is not useless. It might look useless from a computer point of view (and that's why a lot of languages actually define bool only as a type but use int internally to process), but from an engineering point of view, boolean suddenly becomes VERY interesting, because it prohibits prevents a lot more syntax errors by making them actual errors (e.g. if(x = 3) instead of if(x == 3) becomes an error instead of accidentally setting x to 3 and always being true).

protip: have a look at the switch statement instead of your if elseif elseif elseif elseif elseif. Your code is hilariously unreadable :D
Gold isn't everything in life... you need wood, too!
Anacletus
Profile Blog Joined April 2012
United States733 Posts
May 15 2012 12:53 GMT
#2714
teamliquid.net/blogs/viewblog.php?topic_id=337732

I wrote this as a beginner's guide to programming. It is basically a hands-on start for Ruby.

If anyone is interested in learning to program I hope my blog can help!

And for any experienced veterans - feel free to improve and critisize it if you see fit as well.
http://talk-to-stimey-please.1324083.n2.nabble.com/
solidbebe
Profile Blog Joined November 2010
Netherlands4921 Posts
May 15 2012 20:22 GMT
#2715
On May 15 2012 21:53 Anacletus wrote:
teamliquid.net/blogs/viewblog.php?topic_id=337732

I wrote this as a beginner's guide to programming. It is basically a hands-on start for Ruby.

If anyone is interested in learning to program I hope my blog can help!

And for any experienced veterans - feel free to improve and critisize it if you see fit as well.


Wow nice guide asacletun!
That's the 2nd time in a week I've seen someone sig a quote from this GD and I have never witnessed a sig quote happen in my TL history ever before. -Najda
killa_robot
Profile Joined May 2010
Canada1884 Posts
Last Edited: 2012-05-15 20:41:30
May 15 2012 20:40 GMT
#2716
On May 14 2012 23:06 heroyi wrote:
whelp I can't figure this out...

I was wondering if someone could help explain to me how to utilize bool in a function form. The reason I ask this is because I am working on this tic tac toe game and am trying to make it so that the game keeps going (asking players to make turns) until it reaches to a halt (three in a row) thus ending the game. I can't figure out how to use the boolean operation to a function form...

Here is the code to help me on:

+ Show Spoiler +


int a = 0;
int b = 0;
int i = 0;

int j = 0;
char tictac[3][3] =
{
{'1','2','3'},
{'4','5','6'},
{'7','8','9'}
};

void board() //intialize board
{
for(i=0;i<3;i++)
{ for(j=0;j<3;j++)
{cout << tictac[i][j] << " " ;}
cout << endl;}
cout << endl;
}


void choice() //to help mark spot for player one
{
if(a == 1)
{ tictac[0][0] = 'X';
board();}

else if(a == 2)
{tictac[0][1] = 'X';
board();}

else if(a == 3)
{tictac[0][2] = 'X';
board();}

else if(a == 4)
{tictac[1][0] = 'X';
board();}

else if(a == 5)
{tictac[1][1] = 'X';
board();}

else if(a == 6)
{tictac[1][2] = 'X';
board();}

else if(a == 7)
{tictac[2][0] = 'X';
board();}

else if(a == 8)
{tictac[2][1] = 'X';
board();}

else if(a == 9)
{tictac[2][2] = 'X';
board();}
}

void choice1() //to help mark spot for player 2
{
if(b == 1)
{tictac[0][0] = 'O';
board();}

else if(b == 2)
{tictac[0][1] = 'O';
board();}

else if(b == 3)
{tictac[0][2] = 'O';
board();}

else if(b == 4)
{tictac[1][0] = 'O';
board();}

else if(b == 5)
{tictac[1][1] = 'O';
board();}

else if(b == 6)
{tictac[1][2] = 'O';
board();}

else if(b == 7)
{tictac[2][0] = 'O';
board();}

else if(b == 8)
{tictac[2][1] = 'O';
board();}

else if(b == 9)
{tictac[2][2] = 'O';
board();}

}



void player1() ]//loop to ask for turn for player 1
{
cout << "Player 1: ";
cin >> a;
while (!cin || a == b) // loop to help catch bad input
{
cout << "choose a different spot: ";
cin.clear();
cin.sync();
cin >> a;
}
choice();
}

void player2() //loop to ask for turn for player 2
{
cout << "Player 2: ";
cin >> b;
while (!cin || a == b) //loop to help catch bad input
{
cout << "choose a different spot: ";
cin.clear();
cin.sync();
cin >> b;
}
choice1();
}



int main()
{

Sleep(2000);
cout << "Lets play tic tac toe between two players" << endl;


for(i=0;i<3;i++) //create board
{for(j=0;j<3;j++)
{cout << tictac[i][j] << " " ;}
cout << endl;}
cout << endl;

Sleep(2000);
cout << "Here is the board. Enter the number to mark your spot." << endl;
cout << "Player 1 is X and player 2 is O." << endl;


cout << "Player 1 goes first. Please enter your number: ";
cin >> a;
choice();
cout << "Player 2: ";
cin >> b;
while (!cin || a == b)
{
cout << "choose a different spot: ";
cin.clear();
cin.sync();
cin >> b;
}
choice1();

[b]//below is the loop/boolean code I am trying to implement but to fail. I have tried different variations and this one here just happens to be the one that I copy and pasted here.[/b]

while(tictac[0][0] == tictac[0][1] != tictac[0][2] || tictac[0][0] == tictac[2][0] != tictac[1][0] || tictac[2][0] == tictac[2][1] != tictac[2][2] || tictac[0][0] != tictac[1][1] == tictac[2][2] || tictac[2][2] != tictac[1][2] == tictac[0][2] )
{player1();
player2();
}


//^^Here I was trying to make it so that as long as three in a row wasn't created then the game would continue in the loop (thus the while loop). However if a three in a row was detected then the statement would become false and would jump out of the loop to "end the game."


{cout << "gg" << endl;} //not the best ending but that isnt the problem.



system("PAUSE");
return 0;


}


appreciate the help
btw fyi: You can ignore some of my coding in the main function (block of code above my comments). I understand it may not be "consistent" but I was more worried on making the code work. Once I can get the whole thing going then I will go around and clean it up a bit to make it nicer.

btw how is my coding "style?" Is there any bad "habits" that I should avoid that is present in my work?
*********


off topic: What situation would call for you to use array over vector? Vectors can do everything an array can but better it seems...is it more efficient to use array on a small memory managment or something?

************

sorry for cluttering :/


 while(tictac[0][0] == tictac[0][1] != tictac[0][2] || tictac[0][0] == tictac[2][0] != tictac[1][0] || tictac[2][0] == tictac[2][1] != tictac[2][2] || tictac[0][0] != tictac[1][1] == tictac[2][2] || tictac[2][2] != tictac[1][2] == tictac[0][2] ) 


That doesn't work. You can't do A == B != C, you would have to do A == B && B != C.
peacenl
Profile Blog Joined November 2009
550 Posts
Last Edited: 2012-05-15 20:56:52
May 15 2012 20:52 GMT
#2717
Did anyone previously beat the speed of MD5 with their own custom hashing function? The reason for custom hashes I'm trying to use is purely speed, a few collisions or impared security are not an issue. I only need speed because I'm creating hashing tables. I've created the most simple function I can imagine in pseudo code:


to_be_hashed_string(string)
index(string)

Array convert => a=1, b=2, c=3 and so on until z=26
for loop => each substring(to_be_hashed_string, i, 1) start with i = 0
index.add => pow ( convert[substring(to_be_hashed_string, i, 1)], i )
end for



In each iteration the integer i will be incremented which stops many collisions thanks to the Exponentiation (pow) function which is calculated over the convert array number.

string(32) "c18427314aa891c19a3c4e388211eb94" MD5 hash function in 1.8 microseconds
float(1.6514813305334E+29) Custom hash function in 7.1 microseconds
- One does not simply walk into a bar and start calling the shots.
- Failure doesn't mean you are a failure it just means you haven't succeeded yet.
McFortran
Profile Joined October 2010
United States79 Posts
May 15 2012 21:25 GMT
#2718
On May 14 2012 23:06 heroyi wrote:
+ Show Spoiler +
whelp I can't figure this out...

I was wondering if someone could help explain to me how to utilize bool in a function form. The reason I ask this is because I am working on this tic tac toe game and am trying to make it so that the game keeps going (asking players to make turns) until it reaches to a halt (three in a row) thus ending the game. I can't figure out how to use the boolean operation to a function form...

Here is the code to help me on:

+ Show Spoiler +


int a = 0;
int b = 0;
int i = 0;

int j = 0;
char tictac[3][3] =
{
{'1','2','3'},
{'4','5','6'},
{'7','8','9'}
};

void board() //intialize board
{
for(i=0;i<3;i++)
{ for(j=0;j<3;j++)
{cout << tictac[i][j] << " " ;}
cout << endl;}
cout << endl;
}


void choice() //to help mark spot for player one
{
if(a == 1)
{ tictac[0][0] = 'X';
board();}

else if(a == 2)
{tictac[0][1] = 'X';
board();}

else if(a == 3)
{tictac[0][2] = 'X';
board();}

else if(a == 4)
{tictac[1][0] = 'X';
board();}

else if(a == 5)
{tictac[1][1] = 'X';
board();}

else if(a == 6)
{tictac[1][2] = 'X';
board();}

else if(a == 7)
{tictac[2][0] = 'X';
board();}

else if(a == 8)
{tictac[2][1] = 'X';
board();}

else if(a == 9)
{tictac[2][2] = 'X';
board();}
}

void choice1() //to help mark spot for player 2
{
if(b == 1)
{tictac[0][0] = 'O';
board();}

else if(b == 2)
{tictac[0][1] = 'O';
board();}

else if(b == 3)
{tictac[0][2] = 'O';
board();}

else if(b == 4)
{tictac[1][0] = 'O';
board();}

else if(b == 5)
{tictac[1][1] = 'O';
board();}

else if(b == 6)
{tictac[1][2] = 'O';
board();}

else if(b == 7)
{tictac[2][0] = 'O';
board();}

else if(b == 8)
{tictac[2][1] = 'O';
board();}

else if(b == 9)
{tictac[2][2] = 'O';
board();}

}



void player1() ]//loop to ask for turn for player 1
{
cout << "Player 1: ";
cin >> a;
while (!cin || a == b) // loop to help catch bad input
{
cout << "choose a different spot: ";
cin.clear();
cin.sync();
cin >> a;
}
choice();
}

void player2() //loop to ask for turn for player 2
{
cout << "Player 2: ";
cin >> b;
while (!cin || a == b) //loop to help catch bad input
{
cout << "choose a different spot: ";
cin.clear();
cin.sync();
cin >> b;
}
choice1();
}



int main()
{

Sleep(2000);
cout << "Lets play tic tac toe between two players" << endl;


for(i=0;i<3;i++) //create board
{for(j=0;j<3;j++)
{cout << tictac[i][j] << " " ;}
cout << endl;}
cout << endl;

Sleep(2000);
cout << "Here is the board. Enter the number to mark your spot." << endl;
cout << "Player 1 is X and player 2 is O." << endl;


cout << "Player 1 goes first. Please enter your number: ";
cin >> a;
choice();
cout << "Player 2: ";
cin >> b;
while (!cin || a == b)
{
cout << "choose a different spot: ";
cin.clear();
cin.sync();
cin >> b;
}
choice1();

[b]//below is the loop/boolean code I am trying to implement but to fail. I have tried different variations and this one here just happens to be the one that I copy and pasted here.[/b]

while(tictac[0][0] == tictac[0][1] != tictac[0][2] || tictac[0][0] == tictac[2][0] != tictac[1][0] || tictac[2][0] == tictac[2][1] != tictac[2][2] || tictac[0][0] != tictac[1][1] == tictac[2][2] || tictac[2][2] != tictac[1][2] == tictac[0][2] )
{player1();
player2();
}


//^^Here I was trying to make it so that as long as three in a row wasn't created then the game would continue in the loop (thus the while loop). However if a three in a row was detected then the statement would become false and would jump out of the loop to "end the game."


{cout << "gg" << endl;} //not the best ending but that isnt the problem.



system("PAUSE");
return 0;


}


appreciate the help
btw fyi: You can ignore some of my coding in the main function (block of code above my comments). I understand it may not be "consistent" but I was more worried on making the code work. Once I can get the whole thing going then I will go around and clean it up a bit to make it nicer.

btw how is my coding "style?" Is there any bad "habits" that I should avoid that is present in my work?
*********


off topic: What situation would call for you to use array over vector? Vectors can do everything an array can but better it seems...is it more efficient to use array on a small memory managment or something?

************

sorry for cluttering :/

I'm terrible at programming, so I won't comment on much, but it seems like your choice() function can be replaced with:
+ Show Spoiler +
void choice()
{
tictac[(a-1)/3][(a-1)%3]='X';
board();
}

also, are you using global variables? Otherwise wouldn't you need choice(int a) instead of choice()?
MisterD
Profile Blog Joined June 2010
Germany1338 Posts
Last Edited: 2012-05-15 22:19:08
May 15 2012 22:17 GMT
#2719
On May 16 2012 05:52 peacenl wrote:
Did anyone previously beat the speed of MD5 with their own custom hashing function? The reason for custom hashes I'm trying to use is purely speed, a few collisions or impared security are not an issue. I only need speed because I'm creating hashing tables. I've created the most simple function I can imagine in pseudo code:


to_be_hashed_string(string)
index(string)

Array convert => a=1, b=2, c=3 and so on until z=26
for loop => each substring(to_be_hashed_string, i, 1) start with i = 0
index.add => pow ( convert[substring(to_be_hashed_string, i, 1)], i )
end for



In each iteration the integer i will be incremented which stops many collisions thanks to the Exponentiation (pow) function which is calculated over the convert array number.

string(32) "c18427314aa891c19a3c4e388211eb94" MD5 hash function in 1.8 microseconds
float(1.6514813305334E+29) Custom hash function in 7.1 microseconds


stick to int, don't use float, that's stupid if you're aiming for speed also, try less cluttering. a simple:

int hash(String string) {
int hash = 0;
for(char c : string) {
hash = hash * 31 + (int)c;
}
return hash;
}


will probably suffice. Also, if you recalculate hashes for the same string repeatedly without mutating the string inbetween, it might help to use a wrapper data structure, which calculates the hash value on creation and caches it. Then you can simply reuse it and don't have to recalculate over and over.
Gold isn't everything in life... you need wood, too!
Sad[Panda]
Profile Blog Joined January 2009
United States458 Posts
May 16 2012 08:36 GMT
#2720
Hey everyone ive recently been becoming more and more interested in learning the C language as a start point as personally I just really love the thought of being able to just create things Id need or just want to (hell even maybe at some point make some PSP or DS homebrews for myself as a little project too). I have a PDF book on C and I want to get myself more familiar with Linux.

ATM I have Ubuntu installed but I feel like its to Noob friendly in the sense that I dont feel pressured to actually have to get used to terminal am I being ignorant? Is there any other Linux distros that would be better to force me to learn things without being completely thrown down a creek with no paddle? A friend told me Gentoo if I want hard times since you are forced to compile everything and another said Debian but didnt really elaborate

also whats your guys Distro of choice?
( O.O) ("\(t.t )/") ~ I'm just looking for someone to hug
Prev 1 134 135 136 137 138 1031 Next
Please log in or register to reply.
Live Events Refresh
Chat StarLeague
16:00
Chicago LAN Final Day
Razz vs Julia
StRyKeR vs ZZZero
Semih vs TBD
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SteadfastSC 292
ProTech133
SpeCial 109
BRAT_OK 60
JuggernautJason30
EmSc Tv 25
MindelVK 25
StarCraft: Brood War
Britney 41410
Mini 712
firebathero 164
JulyZerg 124
Hyuk 84
Pusan 63
ggaemo 44
Sacsri 36
soO 34
HiyA 16
[ Show more ]
Free 12
Noble 7
Stormgate
BeoMulf146
Dota 2
Gorgc15197
XcaliburYe254
Counter-Strike
fl0m1565
flusha225
Stewie2K124
Heroes of the Storm
Khaldor275
Other Games
gofns8271
FrodaN1488
Beastyqt803
B2W.Neo334
Hui .302
ToD215
KnowMe148
Organizations
Other Games
gamesdonequick675
StarCraft 2
EmSc Tv 25
EmSc2Tv 25
StarCraft: Brood War
CasterMuse 3
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• StrangeGG 44
• LUISG 27
• IndyKCrew
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• Migwel
• LaughNgamezSOOP
StarCraft: Brood War
• Michael_bg 8
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Nemesis4985
Counter-Strike
• Shiphtur151
• imaqtpie143
Other Games
• WagamamaTV439
Upcoming Events
Replay Cast
6h 39m
Afreeca Starleague
16h 39m
Queen vs HyuN
EffOrt vs Calm
Wardi Open
17h 39m
RotterdaM Event
21h 39m
Replay Cast
1d 6h
Afreeca Starleague
1d 16h
Rush vs TBD
Jaedong vs Mong
WardiTV Summer Champion…
1d 17h
Cure vs Classic
ByuN vs TBD
herO vs TBD
TBD vs NightMare
TBD vs MaxPax
PiGosaur Monday
2 days
Afreeca Starleague
2 days
herO vs TBD
Royal vs Barracks
Replay Cast
3 days
[ Show More ]
The PondCast
3 days
WardiTV Summer Champion…
3 days
Replay Cast
4 days
LiuLi Cup
4 days
MaxPax vs TriGGeR
ByuN vs herO
Cure vs Rogue
Classic vs HeRoMaRinE
Cosmonarchy
4 days
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
BSL Team Wars
5 days
Team Hawk vs Team Dewalt
BSL Team Wars
5 days
Team Hawk vs Team Bonyth
SC Evo League
5 days
TaeJa vs Cure
Rogue vs threepoint
ByuN vs Creator
MaNa vs Classic
[BSL 2025] Weekly
6 days
SC Evo League
6 days
Liquipedia Results

Completed

Jiahua Invitational
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
Acropolis #4 - TS1
CSLAN 3
SEL Season 2 Championship
WardiTV Summer 2025
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL Season 18: Qualifier 2
CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.