tic tac toe game

This is a discussion on tic tac toe game within the Game Programming forums, part of the General Programming Boards category; Ok, here is my new tic tac toe game. I re-wrote it because the old one had 100 more lines ...

  1. #1
    Unregistered Leeman_s's Avatar
    Join Date
    Oct 2001
    Posts
    753

    tic tac toe game

    Ok, here is my new tic tac toe game. I re-wrote it because the old one had 100 more lines than needed, all global variables, and less features.It has 3 difficulty levels. Here is the new one, please try it out and tell me what you think. It's under 300 lines of code.

    PS. there was another guy that had a tic tac toe that kept score, thats where i got the score idea from.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    57
    Good Job! I like it.
    Language: C++
    Compiler: Visual C++ 6.0
    Currently Working On: Simple OpenGL aspects

  3. #3
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    nice improvment! I saw the last one.

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    19
    It's pretty cool. Was it hard to make the AI for it?

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    Nice attempt. Just a few comments:

    1) When you ask if they want to play again, the person has to enter their name again... could get annoying.
    2) I had a problem where after i chose to play again an infinite loop occured and the screen did nothing but flicker (ie, the grid was constantly being redisplayed). Looks like a buffer overflow issue to me (if the entered name is too long) as other wierd things happend too (like the game ending too early and stuff lke that).
    3) You haven't put your name/credits in!

    other than that mate.. you've done well.... is this one of your first projects??

    cheers
    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  6. #6
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    nice stuff - anything with AI is good. i made my own T3 without the ai (i'm too lazy)

    i'll suggest a few things to you to move to the next level of T3

    1. warn the players while entering names about size,spaces etc
    2. use ascii chars to make the grid
    3. remove the numbers in the grid.. show a pre-game screen displaying the numbers or show it some othercorner of the screen
    4. try use arrow keys to move, instead of numbers
    5. use colours


    just some suggestion

  7. #7
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050
    Leeman_s,

    That was me who had the scoring table in the tic-tac-toe game.

    A few tips for your game:

    1) On 'hard' I was able to beat the AI on my first try...granted this was primarily from doing a lot of playtesting on my own AI, but I'm sure others will be able to find this way to win too. The way to do it is like this:

    1|2|3
    4|5|6
    7|8|9

    Human goes first and chooses 7
    Then the AI will choose 1
    Next choose 3
    AI will choose 5
    You choose 9
    AI will choose 8 or 6
    You choose 8 or 6 (which ever one the AI didn't choose)

    To stop the AI from loosing this way go like this:

    H chooses 7
    AI chooses 5

    This will eliminate the possibiity of the human winning in this game

    However, if this is the ONLY POSSIBLE WAY TO WIN then I would keep the AI how it is. You always have to make sure there is a way for the human to win, or else the game would be pointless.


    I, too, like ihsir, find the numbers in the grid very annoying. The reason why in my game I went with row/col input instead of a single number input is because I think it makes the grid look a lot better. Although, if you do like ihsir suggest and put a small grid the upper right hand corner it would solve the problem.

    For those that want do look at source code (hint hint Paveltc ) you can go here, but I'm not sure how easy the code is to read.

    EDIT: Oh and btw, good job.

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    19
    Thanks for the link.

  9. #9
    Registered User
    Join Date
    Dec 2001
    Posts
    126
    I liked it too. I am in the process of programming a tic-tac-toe game right now. Hopefully it will be done pretty soon.

  10. #10
    Unregistered
    Guest

    Thumbs up TicTacToe Source Code?

    HI,
    Liked this version of Tic Tac Toe. Would it be possible to get the source code?
    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Tic Tac Toe game
    By nafix in forum C Programming
    Replies: 6
    Last Post: 11-10-2007, 12:45 PM
  2. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 06:25 PM
  3. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  4. tic tac toe AI roadblock >:-(|)
    By dark_rocket in forum Game Programming
    Replies: 5
    Last Post: 06-12-2006, 05:13 AM
  5. not 3x3 tic tac toe game AI
    By Unregistered in forum Game Programming
    Replies: 9
    Last Post: 08-29-2001, 04:02 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21