
-----------------------------------
drumersrule123
Fri Dec 12, 2003 9:02 pm

tic tac toe help
-----------------------------------
here is my current code i dont no why it is not closing or why the drawfill box is not working. i am sure there is alot of stuff i don't need in the code but i just started to work on it two days ago.



var xo : string (1)
var yn : string (1)
var num : array 1 .. 9 of string
var u1, u2, u3, u4, u5 : int := - 999
var p1, p2, p3, p4, p5 : int := - 999
var place : int
var w : int := Window.Open ("fullscreen")
Window.Set (w, "nocursor")
setscreen ("graphics:vga")
loop
    Pic.ScreenLoad ("tictac.BMP", 220, 115, picCopy)
    var answer : int
    randint (answer, 1, 2)
    if answer = 1 then
        locate (1, 1)
        put "Player 1 is going first"
    else
        locate (1, 1)
        put "Player 2 is going first"
    end if
    delay (2000)
    if answer = 1 then
        locate (1, 1)
        put "Player 1 do you want to be X's or O's"
        locate (2, 1)
        getch (xo)
    else
        locate (1, 1)
        put "Player 2 do you want to be X's or O's"
        locate (2, 1)
        getch (xo)
    end if

    for x : 1 .. 9

        if xo = "o" or xo = "O" then
            locate (1, 1)
            put "Where would you like to place your O"
            locate (2, 1)
            get place
            drawfillbox (2, 1, 1, 1, blue)
            if place = 1 then
                Pic.ScreenLoad ("o.BMP", 298, 125, picCopy)
            end if
            if place = 2 then
                Pic.ScreenLoad ("o.BMP", 230, 260, picCopy)
            end if
            if place = 3 then
                Pic.ScreenLoad ("o.BMP", 365, 195, picCopy)
            end if
            if place = 4 then
                Pic.ScreenLoad ("o.BMP", 365, 260, picCopy)
            end if
            if place = 5 then
                Pic.ScreenLoad ("o.BMP", 298, 195, picCopy)
            end if
            if place = 6 then
                Pic.ScreenLoad ("o.BMP", 230, 125, picCopy)
            end if
            if place = 7 then
                Pic.ScreenLoad ("o.BMP", 230, 195, picCopy)
            end if
            if place = 8 then
                Pic.ScreenLoad ("o.BMP", 365, 125, picCopy)
            end if
            if place = 9 then
                Pic.ScreenLoad ("o.BMP", 298, 260, picCopy)
            end if
        else
            locate (1, 1)
            put "Where would you like to place your X"
            locate (2, 1)
            get place
            drawfillbox (2, 1, 1, 1, white)
            if place = 1 then
                Pic.ScreenLoad ("x.BMP", 298, 125, picCopy)
            end if
            if place = 2 then
                Pic.ScreenLoad ("x.BMP", 230, 260, picCopy)
            end if
            if place = 3 then
                Pic.ScreenLoad ("x.BMP", 365, 195, picCopy)
            end if
            if place = 4 then
                Pic.ScreenLoad ("x.BMP", 365, 260, picCopy)
            end if
            if place = 5 then
                Pic.ScreenLoad ("x.BMP", 298, 195, picCopy)
            end if
            if place = 6 then
                Pic.ScreenLoad ("x.BMP", 230, 125, picCopy)
            end if
            if place = 7 then
                Pic.ScreenLoad ("x.BMP", 230, 195, picCopy)
            end if
            if place = 8 then
                Pic.ScreenLoad ("x.BMP", 365, 125, picCopy)
            end if
            if place = 9 then
                Pic.ScreenLoad ("x.BMP", 298, 260, picCopy)
            end if
        end if
    end for
    put "Would you like to quit"
    getch (yn)
    if yn = "yes" then
        Window.Close (w)
    end if
end loop

-----------------------------------
Thuged_Out_G
Fri Dec 12, 2003 9:16 pm


-----------------------------------

loop
Window.Close(w)
end loop


window.close only seems to close one window, leaving another one open.
puttin it in a loop works well, although someone may know of a better slotuion

-----------------------------------
Andy
Fri Dec 12, 2003 9:17 pm


-----------------------------------
doesnt work that way. Window.Close closes the window ID, and will only work once, unless of course u open it again with Window.Open

-----------------------------------
drumersrule123
Fri Dec 12, 2003 9:22 pm


-----------------------------------
but i dont understand why it opens another window

-----------------------------------
Andy
Fri Dec 12, 2003 9:27 pm


-----------------------------------
works fine for me... i dont see no new window... are u using turing 3? that mite be the problem

-----------------------------------
drumersrule123
Fri Dec 12, 2003 9:33 pm


-----------------------------------
i am useing turing 4 i just dont no where to put in the extra code

-----------------------------------
Andy
Fri Dec 12, 2003 9:35 pm


-----------------------------------
if ur using turing 4, then take out all that window.open and window.set crap, and the vga and fullscreen crap too

-----------------------------------
drumersrule123
Fri Dec 12, 2003 9:40 pm


-----------------------------------
i dont no what is wrong but it still wont close

-----------------------------------
Thuged_Out_G
Fri Dec 12, 2003 9:41 pm


-----------------------------------
he is using window.open so he can close the window when the program is finished...and i have turing 4.0.4c...and when i just put Window.Close(w) it closes one window, but another one is still there(i dont know why)

but putting it in a loop solves this problem

-----------------------------------
drumersrule123
Fri Dec 12, 2003 9:46 pm


-----------------------------------
still doesn't work


and where can i find turing 4. 0. 4

-----------------------------------
drumersrule123
Fri Dec 12, 2003 9:50 pm


-----------------------------------
i dont want u to tell me where i can find "4 .0 .4" wink wink
i just want to no a cool site or place to go to

-----------------------------------
Andy
Fri Dec 12, 2003 10:00 pm


-----------------------------------
:?: 
http://www.holtsoft.com/turing/support/#turing4patches

-----------------------------------
drumersrule123
Fri Dec 12, 2003 10:08 pm


-----------------------------------
thanks :D
