Designing a 2 player Tictactoe

  • Thread starter FrostScYthe
  • Start date
  • Tags
    Designing
In summary, Job discusses the design of a basic, networked tic-tac-toe game, and how a basic understanding of programming would be enough to create one. He also mentions a possible game called Points, which uses the same technology.
  • #1
FrostScYthe
80
0
Hi everyone,

I have to design a distributed game of Tic Tac Toe. I have to basically write what would be a good way to design this, but I really don't know much about this stuff, I'd be grateful if some of you could give me some design ideas.

Thanks in advance.
 
Last edited:
Technology news on Phys.org
  • #2
A great, and easy to use, program is Gamemaker. If you pay $20 for the registered version you can get even better stuff. Anyways, its easy to use, fun, and can include programming in the reg. version. There is also very simple graphical programming, done by dragging icons for commands into position.
 
  • #3
The interface is basic. The functionality is simple turn based action. The only design consideration is in the networking/communication side. For anything multiuser you always have the options of using client-to-client connections or server based. Unless the players are inside the same local network i would go with server based because Firewalls and NAT usually get in the way (you see this a lot in P2P apps).

For a server based tic-tac-toe i would have it be web-page driven - not required but there are no disadvantages. Use a server-side technology like PHP or ASP for the server, or build a game server with JAVA/C/C++, or use existing servers like the Flash Communication Server (if you're using flash at the client).

For the clients, since the game is so simple, i would use javascript with AJAX or possibly Flash to make a more appealing interface - no Java. Silverlight is now also an option - very much like flash but simpler - it's XML based.

The javascript/flash/silverlight client, running on a user's browsers connects to the server. The server keeps track of users and game tables. When two users are joined in a game the clients use AJAX (or the flash xmlSocket/loadVars depending on implementation) to query the server every x seconds to get any new messages from the other user, or the other user's game move, or to check if it's the user's round yet. When a user makes a move, the client tells the server what the move was, the server keeps the move in memory and passes it to the other client whenever it does the next of it's x-per-second queries. And so on.
 
Last edited:
  • #4
Good lord, -Job-, that's incredible overkill.

An hour with Python and Tkinter or wxPython would be more than enough to write a basic networked tic-tac-toe client. No need for a server or database engine...

- Warren
 
  • #5
Multiuser? With a client-2-client connection you'll have firewall and NAT issues. For example if you're within your University's network and would like to play a game with someone on the exterior. How do you suggest you get around this without getting into more complex programming or using an existing server or P2P framework (like JXTA)? As far as a multi-user game goes web-based is actually the simpler option - a little bit of Ajax and PHP/ASP and you have a fully working solution.

I bet i could put together a multiuser tic-tac-toe in Ajax/ASP faster than you can write it in Python and it would be more compatible and accessible.

It may sound like overkill - but if you're doing this with the purpose of learning then there's no sense in taking shortcuts.
 
Last edited:
  • #6
Well, -Job-, he didn't tell us anything about his intentions -- particularly whether or not he intended the program to be able to be used across firewalls or NAT. :rofl:

- Warren
 
  • #7
Seriously, check out gamemaker, with the registered version you can make multiplayer games, even network or peer to peer type.
 
  • #8
chroot said:
Well, -Job-, he didn't tell us anything about his intentions -- particularly whether or not he intended the program to be able to be used across firewalls or NAT. :rofl:

- Warren

Why would i not mention firewall/nat issues when someone asks specifically on the design aspects of a multiplayer game as simple as tic-tac-toe? Should i have focused instead on how big the cells should be, or how to draw the window?
 
  • #9
-Job- said:
The javascript/flash/silverlight client, running on a user's browsers connects to the server. The server keeps track of users and game tables. When two users are joined in a game the clients use AJAX (or the flash xmlSocket/loadVars depending on implementation) to query the server every x seconds to get any new messages from the other user, or the other user's game move, or to check if it's the user's round yet. When a user makes a move, the client tells the server what the move was, the server keeps the move in memory and passes it to the other client whenever it does the next of it's x-per-second queries. And so on.



Hello, Job! I'm from Kazakhstan!
I'm writing network game, like tic-tac-toe, called Points. The game technology works like you written above. (I use php, JavaScript and Ajax). Can you help me how to keep data in the server side.
I'm looking forward hearing from you!
My e-mail is saule2007@gmail.com.
 
  • #10

1. How do you determine who goes first in a 2 player Tictactoe game?

The most common way to determine who goes first in a 2 player Tictactoe game is by flipping a coin or having each player choose a number between 1 and 10, with the highest number going first.

2. What is the most effective strategy for winning a game of 2 player Tictactoe?

The most effective strategy for winning a game of 2 player Tictactoe is to try to get three in a row while also blocking your opponent from getting three in a row. This requires thinking ahead and anticipating your opponent's moves.

3. How do you prevent the game from ending in a tie?

To prevent the game from ending in a tie, it is important to have a detailed algorithm for the computer to follow. This algorithm should prioritize winning and blocking the opponent over making random moves.

4. Can the game be modified to allow for more than 2 players?

Yes, the game can be modified to allow for more than 2 players by expanding the grid and creating more winning combinations. However, this may make the game more complex and time-consuming.

5. Is there a limit to the number of games that can be played before the computer becomes unbeatable?

There is no exact number of games that can be played before the computer becomes unbeatable. It depends on the algorithm used and the skill level of the players. With a strong algorithm and skilled players, it may take only a few games for the computer to become unbeatable.

Similar threads

  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
1
Views
752
  • Programming and Computer Science
Replies
5
Views
913
  • Programming and Computer Science
Replies
1
Views
706
Replies
10
Views
1K
  • Science and Math Textbooks
Replies
5
Views
932
  • STEM Academic Advising
Replies
1
Views
191
  • Programming and Computer Science
Replies
11
Views
845
  • Programming and Computer Science
Replies
5
Views
1K
Back
Top