Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 43

Thread: Tic-Tac-Toe

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Tic-Tac-Toe

    Just wrote the Tic-Tac-Toe game in JavaScript with support for multiple board sizes.

    Check it out here :
    http://www24.brinkster.com/premshree...-toe/index.htm

    Last edited by premshree; 10-06-2002 at 02:40 PM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I just won, then the comp still had it's turn and alerted me it was a draw.

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the same thing happened to me, i won but the comp got one more turn and won the game

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The computer does not recognize I won already when completing a 3 fields row on a 3x3 board. How frustrating.

    To reproduce:

    Select 3x3 board, player plays first. x shall be the number of fields from the left edge (1-3), and y the number from the bottom edge (1-3).

    1. I set my mark directly in the middle (x:2, y:2)
    2. Computer sets in the bottom right corner (x:3, y:1)
    3. I set my second mark at the upper left corner (x:1, y:3)
    4. Computer sets in the middle of the upmost row (x:2, y:3)
    5. I set my third mark at the middle of the first column (x:1, y:2). Hah! Now I've put the computer in the corner. Doesn't matter where he sets, he can't prevent me from completing a row/column next time I move.
    6. Computer sets at x:3, y:2. Prevents one row, but he's lost anyway.
    7. I set my glorious last mark at x:1, y:1, expecting a cheering crowd... but what's that? The computer is allowed to set a mark immediately again and completes his column (x:3 y:1,2,3), and an alert tells me I've lost...

    that's unfair!

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In the previous one, I never tested for a condition when the player wins!

    I modified the code....... and now the player can win.

    Check it out at :
    http://www24.brinkster.com/premshree...oe20/index.htm

    Please let me know, if anything else is wrong.


  • #6
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no errors now but i can't seem to win on any other size than 3x3, only because I suck nothing with the program

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #8
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    (3x3 mode)

    when you select "computer first" the first game it goes first, but then when you play again after the game you must go first ... not really much of a problem just thought i would bring it to your attention.

    also, the computer beat me and it said it was a draw (3x3 mode, computer first)

    and just a question, why 1 and 0 ?

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No reason for '1' and '0'
    It doesn't matter anyways!

  • #10
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could you give me the move list ?

  • #11
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    i experienced the same thing; you select computer goes first, and after the first game, the i had to go first every time. also, i'm still running into the problem where sometimes, if i win, the computer gets an extra turn. except for me, the computer called it a draw, instead of a win.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #12
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Could you give me the move list ?
    if the move list matters that much, then i cant reproduce it, i dont remember what i did sorry

    i know 1 and 0 dont matter, just asking hehehe

    keep up the good work i like it

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.

  • #13
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts
    joh6nn, I had updated my script. It's at :
    http://www24.brinkster.com/premshree...oe20/index.htm

    Are you getting the problem at this URL ?

  • #14
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    218
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by joh6nn
    i experienced the same thing; you select computer goes first, and after the first game, the i had to go first every time.
    Just updated the script. Check it out at :
    http://www24.brinkster.com/premshree...-toe/index.htm


  • #15
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Works Great

    Moderator: General web building

    Get out from under them, resist and multiply.
    Get out from under precipice and see the sky.


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •