Author |
Message |
TheFerret
![](http://compsci.ca/v3/uploads/user_avatars/1203353290461453ed4f045.jpg)
|
Posted: Wed Mar 17, 2004 11:36 pm Post subject: Slight Tic-Tac-Toe problem |
|
|
I made a Tic-Tac-Toe game and it works good but when you hit yes to play again and put in 2 x's and 2 o's it stops and says it is finished and I have tried changing stuff around and nothing works...
P.S. My code is probally so un effiecent
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
revisedtictactoe.t |
Filesize: |
5.84 KB |
Downloaded: |
867 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
AsianSensation
|
Posted: Wed Mar 17, 2004 11:54 pm Post subject: (No subject) |
|
|
did you also reset fill? That might be the problem, from a cursory glance anyways.
|
|
|
|
|
![](images/spacer.gif) |
TheFerret
![](http://compsci.ca/v3/uploads/user_avatars/1203353290461453ed4f045.jpg)
|
Posted: Thu Mar 18, 2004 12:09 am Post subject: (No subject) |
|
|
That fixed but another question, how can you put a procedure in a process and have the procedure below work... exp...(I took out a big part of the code) code: | procedure win ()
loop
draw ()
xes ()
exit when
oes ()
% fork winner ()
exit when
end loop
if then
put "X Wins!!!"
xs += 1
start := 1
fork aga()
end if
if then
put "O Wins!!!"
ys += 1
start := 1
fork aga()
end if
end win
win
process aga()
put "Play again, y/n"
get again
if again = "y" or again = "Y" then
a := 0
b := 0
c := 0
d := 0
e := 0
f := 0
g := 0
h := 0
j := 0
start := 0
fill:=0
cls
win ()
else
end if
end aga
|
|
|
|
|
|
![](images/spacer.gif) |
AsianSensation
|
Posted: Thu Mar 18, 2004 9:08 am Post subject: (No subject) |
|
|
well, first of all, I wouldn't try to use processes, it's very inaccurate for the things you want to do. But if you really want to do this, function prototype it.
use forward.
code: | forward proc A
forward proc B
body proc A
B
end A
body proc B
A
end B |
notice how you can't use forward with processes. So you have to prototype the procedure only.
|
|
|
|
|
![](images/spacer.gif) |
TheFerret
![](http://compsci.ca/v3/uploads/user_avatars/1203353290461453ed4f045.jpg)
|
Posted: Thu Mar 18, 2004 1:57 pm Post subject: (No subject) |
|
|
It works, here is my Tic-Tac-Toe game...
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
revisedtictactoe.t |
Filesize: |
5.92 KB |
Downloaded: |
650 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
AsianSensation
|
Posted: Thu Mar 18, 2004 2:04 pm Post subject: (No subject) |
|
|
slight problem, I don't think you checked for input on the same spot. That means I can input square 1 as the coordinate for 9 times. Should fix that, I dont see any other problems so far, gj.
|
|
|
|
|
![](images/spacer.gif) |
recneps
![](http://www.fcpocanada.com/canada1.gif)
|
Posted: Thu Mar 18, 2004 3:57 pm Post subject: (No subject) |
|
|
for some more ideas, check out my fp, the source code is there, show you how i made it so that you couldnt click on a used sq
|
|
|
|
|
![](images/spacer.gif) |
|