
-----------------------------------
TheFerret
Wed Mar 17, 2004 11:36 pm

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

-----------------------------------
AsianSensation
Wed Mar 17, 2004 11:54 pm


-----------------------------------
did you also reset fill? That might be the problem, from a cursory glance anyways.

-----------------------------------
TheFerret
Thu Mar 18, 2004 12:09 am


-----------------------------------
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)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


-----------------------------------
AsianSensation
Thu Mar 18, 2004 9:08 am


-----------------------------------
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.

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.

-----------------------------------
TheFerret
Thu Mar 18, 2004 1:57 pm


-----------------------------------
It works, here is my Tic-Tac-Toe game...

-----------------------------------
AsianSensation
Thu Mar 18, 2004 2:04 pm


-----------------------------------
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.

-----------------------------------
recneps
Thu Mar 18, 2004 3:57 pm


-----------------------------------
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 :)
