• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:32
CEST 20:32
KST 03:32
  • 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
TL.net Map Contest #21: Voting6[ASL20] Ro4 Preview: Descent11Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5
Community News
Weekly Cups (Oct 6-12): Four star herO65.0.15 Patch Balance Hotfix (2025-10-8)78Weekly Cups (Sept 29-Oct 5): MaxPax triples up3PartinG joins SteamerZone, returns to SC2 competition325.0.15 Balance Patch Notes (Live version)119
StarCraft 2
General
How to Block Australia, Brazil, Singapore Servers 5.0.15 Patch Balance Hotfix (2025-10-8) Revisiting the game after10 years and wow it's bad TL.net Map Contest #21: Voting The New Patch Killed Mech!
Tourneys
Crank Gathers Season 2: SC II Pro Teams LiuLi Cup - September 2025 Tournaments SC4ALL $6,000 Open LAN in Philadelphia Sparkling Tuna Cup - Weekly Open Tournament Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
External Content
Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment Mutation # 493 Quick Killers Mutation # 492 Get Out More
Brood War
General
[Interview] Grrrr... 2024 BW caster Sayle BW General Discussion Map with fog of war removed for one player? Pros React To: BarrackS + FlaSh Coaching vs SnOw
Tourneys
[ASL20] Semifinal B [ASL20] Semifinal A SC4ALL $1,500 Open Bracket LAN [Megathread] Daily Proleagues
Strategy
Relatively freeroll strategies Current Meta BW - ajfirecracker Strategy & Training Siegecraft - a new perspective
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV Nintendo Switch Thread ZeroSpace Megathread Path of Exile
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
SPIRED by.ASL Mafia {211640} TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Men's Fashion Thread Sex and weight loss
Fan Clubs
The herO Fan Club! The Happy Fan Club!
Media & Entertainment
[Manga] One Piece Series you have seen recently... Anime Discussion Thread Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Inbreeding: Why Do We Do It…
Peanutsc
From Tilt to Ragequit:The Ps…
TrAiDoS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1823 users

The Big Programming Thread - Page 136

Forum Index > General Forum
Post a Reply
Prev 1 134 135 136 137 138 1032 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
Bisutopia19288 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 States3702 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
Hyrule19139 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 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 16h 29m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
UpATreeSC 235
BRAT_OK 107
JuggernautJason68
Railgan 32
MindelVK 14
ForJumy 14
StarCraft: Brood War
Britney 23843
Calm 3715
Rain 1714
Larva 437
firebathero 233
Hyun 95
Barracks 61
scan(afreeca) 21
Movie 14
NaDa 7
Dota 2
qojqva3961
canceldota25
Counter-Strike
fl0m1155
Foxcn163
Heroes of the Storm
XaKoH 119
Other Games
Grubby1334
Beastyqt568
ceh9542
B2W.Neo250
crisheroes178
KnowMe162
C9.Mang0141
ArmadaUGS104
Hui .100
ToD79
Pyrionflax47
Dewaltoss21
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• intothetv
• LaughNgamezSOOP
• AfreecaTV YouTube
• sooper7s
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• blackmanpl 40
• 80smullet 11
• Michael_bg 1
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 3504
League of Legends
• TFBlade987
Other Games
• imaqtpie1498
• Shiphtur318
Upcoming Events
Wardi Open
16h 29m
CranKy Ducklings
1d 15h
Safe House 2
1d 22h
Sparkling Tuna Cup
2 days
Safe House 2
2 days
Tenacious Turtle Tussle
6 days
The PondCast
6 days
Liquipedia Results

Completed

Acropolis #4 - TS2
WardiTV TLMC #15
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
EC S1
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
CranK Gathers Season 2: SC II Pro Teams
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
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.