tic tac toe

i am just a beginner with around 4 months of programing.i have completed reading the tutorial till file handling.and now i am on my way to make a simple tic tac toe game using the basics i have learnt.but i have stuck up with controlling the cursor using arrow keys on keyboard..i am just unable to figure out how can i control the cursor using arrow keys.i am using a 2D array to represent a board and i want the user the use the arrow keys to enter the X or 0 wherever he wants..Is there any ascii value for arrow keys too.I tried to google around this but just failed to get any hints..plz help me out with this...any help is highly appreciated..
You could do what you want with ncurses (not windows) or pdcurses (windows), but you may find it much easier to just print the board out after each move, and let the player type in the coordinate of the cell they want to play in.
but you may find it much easier to just print the board out after each move, and let the player type in the coordinate of the cell they want to play in.


yeah i thought of that thing earlier...but that would be a lot complicated for the user to play(to first enter the coordinates and then X or 0)...
well anyways thanks a lot
hey kev82....
thanks for the hint....but this pdcurses is all going haywire......i am not even able to understand a bit...i am totally confused....plz help me..
i am using wxdev c++ on windows.....plz tell me how to use it....:'(
Last edited on
See http://www.cplusplus.com/forum/articles/28558/
This is true for all non-text-based games, even Tic-Tac-Toe.
If pdcurses is a little too hard for you at the moment, then just get the user to type in the cell where you want them to play. Eg for the top left cell they would type A1
If you look at your number pad (assuming you have one) you'll notice that it looks an awful lot like a tic-tac-toe board.
@arthar-yeah i got it.....but this is one the problem given in beginners exercise....i was just trying to make it user friendly...

@kev82 and MottMan-but this wont help me if at all i try to make sudoku game...can i have a simple tutorial on pdcurses plz......because i will have to learn it one day or the other.....so why not now??!!
This is for ncurses, but the functions are the same

http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/

I can't help you, mainly because I can't remember myself, I sit there with the curses manual if I have to write something.
Topic archived. No new replies allowed.