...

View Full Version : Tic-Tac-Toe



premshree
10-05-2002, 04:01 PM
Just wrote the Tic-Tac-Toe game in JavaScript with support for multiple board sizes.

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

:thumbsup:

x_goose_x
10-05-2002, 04:48 PM
I just won, then the comp still had it's turn and alerted me it was a draw.

chrismiceli
10-05-2002, 06:08 PM
the same thing happened to me, i won but the comp got one more turn and won the game

mordred
10-05-2002, 06:21 PM
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!

premshree
10-05-2002, 07:50 PM
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/tic-tac-toe20/index.htm

Please let me know, if anything else is wrong.

:thumbsup:

chrismiceli
10-06-2002, 06:12 AM
no errors now but i can't seem to win on any other size than 3x3, only because I suck nothing with the program

premshree
10-06-2002, 06:25 AM
:)

cg9com
10-09-2002, 07:55 PM
(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 ?

premshree
10-10-2002, 12:21 PM
No reason for '1' and '0' :)
It doesn't matter anyways!

premshree
10-10-2002, 01:13 PM
Could you give me the move list ?

joh6nn
10-10-2002, 10:20 PM
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.

cg9com
10-11-2002, 02:23 AM
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

premshree
10-11-2002, 06:42 PM
joh6nn, I had updated my script. It's at :
http://www24.brinkster.com/premshree/tic-tac-toe20/index.htm

Are you getting the problem at this URL ?

premshree
10-11-2002, 07:21 PM
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/tic-tac-toe/index.htm

:thumbsup:

cg9com
10-11-2002, 08:00 PM
Works Great :D

scroots
10-11-2002, 08:15 PM
i played the game (computer first) then played again using the play again option. then i played and got a grid
100
001
110
nobody had won and it didn`t say this, it was just like that grid i showed above.

scroots

premshree
10-14-2002, 11:40 AM
Try playing it here :

http://www24.brinkster.com/premshree/tic-tac-toe20/index.htm

chrismiceli
10-20-2002, 12:28 AM
i did what scroots said and he is right, also on that last link whenever you hit play again it lets you go first.

oracleguy
11-09-2002, 08:09 AM
Found another little bug. It should be a draw on 4v4 but it didn't alert me. Here is the move list:

1-0-1-0
0-1-1-0
0-1-0-1
1-0-0-1

And I went first.

Just thought i'd bring it to your attention.

premshree
11-25-2002, 04:40 AM
I just wrote a Perl version of the game.....
Find it here : http://qiksearch1.tripod.com/cgi-bin/tic-tac-toe.pl

:thumbsup:

shlagish
08-07-2003, 07:50 PM
Hi, I just played your perl Tic-Tac-Toe (because the other one dosn't seem to work...)
and..
LOL
I just won at Tic-Tac-Toe, I didn't think it was possible to win at that game. But how can I make the computer go first?

DemonThing3
09-14-2003, 12:19 AM
I'm getting a dead link for your JS version...

shlagish
09-14-2003, 01:17 AM
mine or his?

DemonThing3
09-14-2003, 01:36 AM
Originally posted by shlagish
mine or his? you don't have one. :D

shlagish
09-14-2003, 03:14 AM
LOL HAHA

I have one but I only posted it in another thread, lol, I was confusing threads.
sorry
Lol

me'
09-23-2003, 09:26 PM
Please update the JS version, I played the Perl version but it couldn't beat me ;)

lavalamp
09-25-2003, 11:04 PM
I was playing your Perl game and the computer got 2 in a row. So rather than block it, I also got two in a row. The computer had the opportunity to win but it didn't, it blocked me rather than moving in for the kill.

It's a pretty good looking game, but now that you've made it you might want to start working on a little AI to make it a bit more tricky.

shlagish
09-25-2003, 11:29 PM
Have you tried to put the difficulty setting to the hardest?

lavalamp
09-25-2003, 11:36 PM
If you're referring to the JvaaScript version I can't play that because all the links leading to it are dead.
If you're refering to the Perl version that I can't see anywhere to change the difficulty level.

shlagish
09-25-2003, 11:55 PM
oh, I'm sorry, I must be mixing up something because I can't get to the javascript version either

me'
09-27-2003, 09:03 AM
For all wanting to play the JS version...

found it :)

http://premshree.resource-locator.com/javascripts/tic-tac-toe/index.htm

Dunno if that's the same one.

lavalamp
09-27-2003, 01:08 PM
Good game and almost impossible to win on a 5x5 board. However it still tries to block me rather than win, (sometimes).

DemonThing3
09-27-2003, 06:48 PM
Ok I played this (http://premshree.resource-locator.com/javascripts/tic-tac-toe/index.htm) one, and I did exactly what mordred did, and it says:

A Runtime Error has occurred.
Do you wish to Debug?

Line: 567
Error: Out of stack space

I click No and it says:

Stack overflow at line: 0

I click OK and it does nothing. I'm using IE6 SP1. Perhaps the one I played wasn't the latest version?

Also after that, I can still click in the empty space in the bottom middle, and it says:

A Runtime Error has occurred.
Do you wish to Debug?

Line: 446
Error: Out of stack space

Again, I click no, and it again says:
Stack overflow at line: 0

Edit: I found another version at http://www.geocities.com/e_i_search/premshree/web-include/pub/scripts/JS/tic-tac-toe/, and that doesn't happen anymore, but now when I load the page it says:

A Runtime Error has occurred.
Do you wish to Debug?

Line: 39
Error: Object Expected

So I click no, and it says,

A Runtime Error has occurred.
Do you wish to Debug?

Line: 1
Error: Syntax error

Other than that, it works fine.

Edited again: I think it's because of it being on a different site...

And again: Here (http://www.google.com/search?q=premshree+tic%2Dtac%2Dtoe)'s where I found the geocities one, by the way.

me'
09-27-2003, 07:55 PM
Not getting any errors with WinIE6. What browser are you running?

DemonThing3
09-27-2003, 08:05 PM
I guess you missed it in my post. I'm using Microsoft Internet Explorer version 6 SP1 (6.0.2600.0000.xpclnt_qfe.021108-2107) and Windows XP Professional.

me'
09-27-2003, 08:08 PM
Well apart from the fact I've got 6.0.2800, and I've XP Home, I've got exactly the same browser.

In conclusion, how odd.

No idea what's wrong.

DemonThing3
09-27-2003, 08:19 PM
Yes, how odd.

lavalamp
09-27-2003, 09:01 PM
Well, I get almost the same errors as DemonThing3, except with lines 568 and 447.
I've got XP Home and IE 6.0.2800.1106.xpsp2.030422-1633IC. I'll try it with a few other borwsers (Opera, Mozill etc.) see if it works for those.

lavalamp
09-27-2003, 09:08 PM
Yeah, the error isn't just IE only, it pops up on Opera 5.02, 6.00 & 7.11, NN 6.22
I also have NN 4.79, 7.02 & 7.10, Moz 1.4 & Moz FB 0.6 but I didn't try it on those.

DemonThing3
09-27-2003, 09:09 PM
I see. That is very odd.

me', which version were you looking at?

me'
09-28-2003, 09:20 AM
Both of the versions provided in DemonThing3's post worked for me. I don't even get the script error icon at the bottom. Is no-one else getting this error?

JAVAEOC
10-25-2003, 07:10 PM
i would like to check ur game out but the link doesnt work :confused:

JAVAEOC
11-15-2003, 06:45 PM
mhhh... the page isnt found when i open it why?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum