|
-
Dec 27th, 2004, 08:03 AM
#8
Frenzied Member
Re: Help Java Tic tac toe
 Originally Posted by System_Error
I can give you an example of a tic tac game if you like. Let me know and I will post the code.
Don't, that way he won't learn anything.
What he should do, however, is:
Make a 2D array storing each field of the game bord. Everytime a brick is placed, set the value of the field the player set the brick to a value depending on if it's player1, or player2(or if a brick was removed). You could use 0, for nothing, 1 for player1, and 2 for player2 - I'd advise using constants for theese values, making them easier to use/remember. When you got this down, you should make a loop. (Almost)Every computer game has a main loop, ensuring that it runs over and over. Inside your loop, you need to dermine what the player wants to do next - if you're using a console, you need to have an inputreader, to get commands from the user, and interpret this; if the user types "Exit" the game should break out of the loop, if the user types "set a,1" a brick should be placed at that location.
I hope this got you on the way... It's fairly simple when you think about it...
"Lies, sanctions, and cruise missiles have never created a free and just society. Only everyday people can do that."
- Zack de la Rocha
Hear me roar.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|