How to make a Tic-Tat-Toe games

Dec 4, 2013 at 3:55pm
I'm currently a college student majoring in Computer Science. My professor request every student in class to make a C++ program, so I decide to make a Tic-Tat-Toe game. What do I need to learn to make a Tic-Tat-Toe? Without copying some else code.

Here what I want in my Tic-Tat-Toe:
-Player 1 vs Player 2, Player vs CPU
-Recognize the name
-Restart when there a tie or someone wins
Dec 4, 2013 at 4:12pm
For the multiplayer version you'll need to learn basic input and output (to print/store the current board and print/store player names) as well as how to use arrays (to store the board and player names), plus how to use control loops (for restarting).

For the CPU version it depends on whether you want the computer to make random moves or optimal moves (optimal always resulting in a tie or win for the computer). On top of what you need to know for a multiplayer version you'll need to learn about branching statements. For random moves you can look up the quick and dirty way to generate "random" numbers (technically pseudo-random numbers but random enough).

That should be it, try to make the multiplayer version first when you think you've learned enough. Though if you just want to complete the assignment you can always make the classic "Hello World" program, which just prints "Hello World" to the screen.
Dec 4, 2013 at 4:52pm
My teacher wants it in functions form. Can you give me names of functions I need to make his game? like example: Board();.
Dec 4, 2013 at 4:57pm
1
2
3
4
5
6
7
8
9
while(//no one has won)
{
displayboard(); 
playermove(); 
wincheck(); 
//You could throw in a displayboard(); here too. 
AImove();
wincheck(); //Should probably call displayboard() if a winner is found 
}


Edit: Missed a closing tag.
Last edited on Dec 4, 2013 at 4:57pm
Dec 4, 2013 at 5:28pm
Thank You.
Topic archived. No new replies allowed.