Toc Tac Toe
BlitzMax Forums/BlitzMax Beginners Area/Toc Tac Toe
| ||
Hello there people, does anyone know of any good tutorials for programming tic tac toe? or can anyone explain to me how i might go about it. I want to make a little tic tac toe game for my first project in BlitzMax whilst i'm learning it. Its really just for the programming knowledge and techniques used, so that i can use that knowledge for bigger things as i learn BlitzMax. Thankyou very much DeViL |
| ||
I can give you some ideas. I'm assuming you've read through at least the intro docs to Blitzmax. create a 3 by 3 array to serve as your 'board' on your board have a zero for an empty square, and some other number representing an O and another an X. Tip- use constants to make your code more readable, eg: const empty=0 const x=1 const o=2 The easiest way to display your board is with the drawtext command. You will need a game loop like just about any other game- it looks something like this... graphics 800,600 'set an 800 by 600 pixel gfx display while not keyhit(KEY_ESCAPE) cls 'clear the screen 'your game logic goes here 'and your drawing commands flushmem() 'always put one flushmem in your main loop flip ' flips the screen to display the stuff u drew to it wend You could use the keys 1-9 on your keypad to represent positions on the board - use keyhit() to see which key was pressed, and place a value into your 'board' array at the requested position. Then you have to check for 3 in a row... |
| ||
Hmmm, excellent! Thankyou so much for your help, i will put it to practice and see how i get on. Thank you once again Nomen for your help. |
| ||
Any time! |