Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 tic tac toe help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
drumersrule123




PostPosted: Fri Dec 12, 2003 9:02 pm   Post subject: 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.



code:
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
Sponsor
Sponsor
Sponsor
sponsor
Thuged_Out_G




PostPosted: Fri Dec 12, 2003 9:16 pm   Post subject: (No subject)

code:

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




PostPosted: Fri Dec 12, 2003 9:17 pm   Post subject: (No subject)

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




PostPosted: Fri Dec 12, 2003 9:22 pm   Post subject: (No subject)

but i dont understand why it opens another window
Andy




PostPosted: Fri Dec 12, 2003 9:27 pm   Post subject: (No subject)

works fine for me... i dont see no new window... are u using turing 3? that mite be the problem
drumersrule123




PostPosted: Fri Dec 12, 2003 9:33 pm   Post subject: (No subject)

i am useing turing 4 i just dont no where to put in the extra code
Andy




PostPosted: Fri Dec 12, 2003 9:35 pm   Post subject: (No subject)

if ur using turing 4, then take out all that window.open and window.set crap, and the vga and fullscreen crap too
drumersrule123




PostPosted: Fri Dec 12, 2003 9:40 pm   Post subject: (No subject)

i dont no what is wrong but it still wont close
Thuged_Out_G




PostPosted: Fri Dec 12, 2003 9:41 pm   Post subject: (No subject)

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




PostPosted: Fri Dec 12, 2003 9:46 pm   Post subject: (No subject)

still doesn't work


and where can i find turing 4. 0. 4
drumersrule123




PostPosted: Fri Dec 12, 2003 9:50 pm   Post subject: (No subject)

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




PostPosted: Fri Dec 12, 2003 10:00 pm   Post subject: (No subject)

Question
http://www.holtsoft.com/turing/support/#turing4patches
drumersrule123




PostPosted: Fri Dec 12, 2003 10:08 pm   Post subject: (No subject)

thanks Very Happy
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to:   


Style:  
Search: