Thread: Here's my tic-tac-toe game

  1. #1
    I'm Back
    Join Date
    Dec 2001
    Posts
    556

    Here's my tic-tac-toe game

    Here's my tic-tac-toe game. Check it out and tell me how do you like it...

  2. #2
    I'm Back
    Join Date
    Dec 2001
    Posts
    556

    PS.

    It's a 2 player game.
    The controls are 'arrow keys' to move and 'enter' to mark box
    By pressing 'esc' you can exit at any time

  3. #3
    Registered User slick1537's Avatar
    Join Date
    Dec 2001
    Posts
    9
    How long did it take you to make this, and what did you use to make it, C, C++, what? Im just wondering cause I want to be making some first persons shooters (with a group) sometime within the next year, and I really don't think I will have the skills with all these MS-DOS games I keep seeing in these forums.

  4. #4
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    I have created this in c++.

    It is my second try at the game.

    In my earlier attempt the players had to use numbers 1-9 to mark the blocks and 0 to exit the game as the winning condition was not coded.

    In this try i modified the basic code i had used to use bioskey() for arrow movement,esc etc and also provided the winning condition check.

    It is quite easy to make it if you just break each move or condition and do the coding accordingly.


    So do i assume you like it... and check out this another game i have finished.

  5. #5
    DockyD
    Guest
    Hi,
    I liked this program.
    Any chance of seeing the source code to learn from?
    Regards

  6. #6
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    not bad at all.

    slick: if you think this is better than stuff that you can produce, then you definitely need abit more practice before hitting the game programming scene.

    if ya want a mentor, feel free to write questions to me directly ([email protected])

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

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

    nice

    very nice. i have a similar tic tac toe game, actually almost exactly the same except you have to use the keys 1-9 to choose a spot. i used a switch/case statement for it. how did you do it as you did where the blinker thing moves around to each spot? also, unlike most peoples tic tac toe, mine has a computer option with nice AI. i'll post it in a little when i get to use my other computer with my projects on it. so how did you do it?

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    60
    Pretty good. How did you check the cursor buttons?

  9. #9
    I'm Back
    Join Date
    Dec 2001
    Posts
    556

    bioskey()

    to use arrow keys, esc, enter etc use the bioskey()

    its in bios.h


    the bioskey function gives the keyboard code for the keys entered by you, like...

    ****
    int key;

    key=bioskey(0);
    cout<<key;
    ****

    if you pressed 'enter' it would have displayed 7181, and now by using switch you can use for arrow keys etc.

    ***
    switch(key)
    {
    case 7181:
    //your code for enter
    case 3592 // backspace
    // your code for bksp

    ***


    heres a program i made to provide some help to you all.

    in it you can use --
    the 4 arrow keys, esc, pgup, pdown, home, end keys to move the cursor on the screen
    Last edited by ihsir; 12-23-2001 at 01:45 AM.

  10. #10
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187

    Exclamation

    Why may i ask that when i compile the cursor.cpp program in

    borland 4.x (on the WIN/GUI) or at the
    command line with bcc32 cursor.cpp

    I get these errors :

    Error cursor.cpp 24: Call to undefined function 'bioskey' in function main()
    Error cursor.cpp 32: Call to undefined function 'sound' in function main()
    Error cursor.cpp 33: Call to undefined function 'delay' in function main()
    Error cursor.cpp 34: Call to undefined function 'nosound' in function main()

    but using (at the command line)
    bcc cursor.cpp (NB : no 32 on bcc cmd)

    It works fine ?

    I get these errors sometimes and if someone can solve them, well, i'd appreciate that

    Thanks in Advance

  11. #11
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    i made the program using turbo c++ ver 3 of borland and it ran perfectly.

    i am not sure why you are getting those errrors but i think it maybe related to the header files

    dos.h since sound, nosound, delay belong to it
    bios.h as bioskey is in it

    maybe you don't have these two files??

    check and let me know, i'll give.

  12. #12
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    Borland 4.x does have those header files, but possibly since it's a windows compiler and not a DOS compiler it may not work, it did work using DJGPP.


    Did you use borland to compile at the command line ?
    if so what command ?

    thanks,

  13. #13
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    I can get the cursor.cpp example file to compile under borland 4.5 from the IDE by right clicking in the work space. Then clicking on the option TargetExpert. Change the Target Type to Application and then change Platform to DOS. I do not know the command line for this.

  14. #14
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    Was able to compile it on the command line that you tried and it worked for me.

  15. #15
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187

    Thumbs up

    Excellent, Thanks lambs4

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, 01: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