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

Username:   Password: 
 RegisterRegister   
 game help ~ ASAP
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ruscutie




PostPosted: Fri Jan 19, 2007 2:04 am   Post subject: game help ~ ASAP

well.... i figured out some stuff and the game is actually working... the user answers science questions.... but if the user chose the wrong answer, it doesn't say that this is the wrong answer and it should start it all over again but instead it shows the next question.... here is my code...plzz help me 2 fix it...

thnx 4 helpin in advance


code:




var reply : string
var font1, font2, font3, font4, font5 : int
var x, y, btn, updown, c : int



procedure question1

    font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("The chemical symbol C represents the element...", 10, 350, font1, black)
    Font.Draw ("a) Carbon", 50, 200, font2, brightblue)
    Font.Draw ("b) Calcium", 300, 200, font3, brightblue)
    Font.Draw ("c) Chlorine", 50, 100, font4, brightblue)
    Font.Draw ("d) Chromium", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 190, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 190, 130, 12)
    Draw.Box (290, 90, 420, 130, 12)


end question1


procedure question2

    font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("Which one of the following measurements is the largest?", 10, 350, font1, black)
    Font.Draw ("a) One millimeter", 50, 200, font2, brightblue)
    Font.Draw ("b) One meter", 300, 200, font3, brightblue)
    Font.Draw ("c) One centimeter", 50, 100, font4, brightblue)
    Font.Draw ("d) One kilometer", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 230, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 250, 130, 12)
    Draw.Box (290, 90, 460, 130, 12)
end question2

procedure question3

    font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("What is the product of 8 and 4?", 10, 350, font1, black)
    Font.Draw ("a) 32", 50, 200, font2, brightblue)
    Font.Draw ("b) 4", 300, 200, font3, brightblue)
    Font.Draw ("c) 12", 50, 100, font4, brightblue)
    Font.Draw ("d) -4", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 190, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 190, 130, 12)
    Draw.Box (290, 90, 420, 130, 12)

end question3

procedure question4

    font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("Which of the following symbols means multiply?", 10, 350, font1, black)
    Font.Draw ("a) +", 50, 200, font2, brightblue)
    Font.Draw ("b) -", 300, 200, font3, brightblue)
    Font.Draw ("c) *", 50, 100, font4, brightblue)
    Font.Draw ("d) /", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 230, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 250, 130, 12)
    Draw.Box (290, 90, 460, 130, 12)

end question4

procedure question5

    font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("Which of the following expressions is the largest?", 10, 350, font1, black)
    Font.Draw ("a) 12+3", 50, 200, font2, brightblue)
    Font.Draw ("b) 12+8", 300, 200, font3, brightblue)
    Font.Draw ("c) 1*0", 50, 100, font4, brightblue)
    Font.Draw ("d) 4*100*0", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 230, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 250, 130, 12)
    Draw.Box (290, 90, 460, 130, 12)

end question5

procedure question6

    font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("What instrument is used to observe distant objects??", 10, 350, font1, black)
    Font.Draw ("a) Telescope", 50, 200, font2, brightblue)
    Font.Draw ("b) Microscope", 300, 200, font3, brightblue)
    Font.Draw ("c) Microphone", 50, 100, font4, brightblue)
    Font.Draw ("d) Telephone", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 230, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 250, 130, 12)
    Draw.Box (290, 90, 460, 130, 12)

end question6

procedure question7

    font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("In a triangle angle1 = 90, angle2 = 20, find angle3", 10, 350, font1, black)
    Font.Draw ("a) 10", 50, 200, font2, brightblue)
    Font.Draw ("b) 30", 300, 200, font3, brightblue)
    Font.Draw ("c) 80", 50, 100, font4, brightblue)
    Font.Draw ("d) 70", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 230, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 250, 130, 12)
    Draw.Box (290, 90, 460, 130, 12)

end question7

procedure question8

    font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("What do plants use pollen for?", 10, 350, font1, black)
    Font.Draw ("a) To make people sneeze.", 50, 200, font2, brightblue)
    Font.Draw ("b) To reproduce", 300, 200, font3, brightblue)
    Font.Draw ("c) To attract bees", 50, 100, font4, brightblue)
    Font.Draw ("d) To smell good.", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 230, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 250, 130, 12)
    Draw.Box (290, 90, 460, 130, 12)


end question8

procedure question9

font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("What is the product of the binary numbers 0110 and 0011?", 10, 350, font1, black)
    Font.Draw ("a) 01111.", 50, 200, font2, brightblue)
    Font.Draw ("b) 10000", 300, 200, font3, brightblue)
    Font.Draw ("c) 10001", 50, 100, font4, brightblue)
    Font.Draw ("d) 10010", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 230, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 250, 130, 12)
    Draw.Box (290, 90, 460, 130, 12)


end question9

procedure question10

font1 := Font.New ("arial black:18")
    assert font1 > 0
    font2 := Font.New ("Comic sans MS :15")
    assert font2 > 0
    font3 := Font.New ("Comic sans MS :15")
    assert font3 > 0
    font4 := Font.New ("Comic sans MS :15")
    assert font4 > 0
    font5 := Font.New ("Comic sans MS :15")
    assert font5 > 0
    Font.Draw ("What is the maximum number of electrons an atom can have in it's first orbit?", 10, 350, font1, black)
    Font.Draw ("a) 12", 50, 200, font2, brightblue)
    Font.Draw ("b) 2", 300, 200, font3, brightblue)
    Font.Draw ("c) 8", 50, 100, font4, brightblue)
    Font.Draw ("d) 18", 300, 100, font5, brightblue)
    Font.Free (font1)
    Font.Free (font2)
    Font.Free (font3)
    Font.Free (font4)
    Font.Free (font5)
    Draw.Box (30, 190, 230, 230, 12)
    Draw.Box (290, 190, 420, 230, 12)
    Draw.Box (30, 90, 250, 130, 12)
    Draw.Box (290, 90, 460, 130, 12)

    end question10


%%%%%%%%%%%%%%%%%%%%%%%%%WIN START


procedure win1
cls
put "workz or not"

delay(6000)

    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Good job, it is the right answer...:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to carry on with the game:- 'n' or 'y'?"
        get reply
        if reply = "y" then
            cls

            question2

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end win1

procedure win2
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Good job, it is the right answer...:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to carry on with the game:- 'n' or 'y'?"
        get reply
        if reply = "y" then
            cls

            question3



        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end win2

procedure win3
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Good job, it is the right answer...:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to carry on with the game:- 'n' or 'y'?"
        get reply
        if reply = "y" then
            cls

            question4




        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end win3

procedure win4

    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Good job, it is the right answer...:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to carry on with the game:- 'n' or 'y'?"
        get reply
        if reply = "y" then
            cls

            question5


        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop

end win4



procedure win5
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Good job, it is the right answer...:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to carry on with the game:- 'n' or 'y'?"
        get reply
        if reply = "y" then
            cls

            question6


        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop

end win5


procedure win6

    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Good job, it is the right answer...:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to carry on with the game:- 'n' or 'y'?"
        get reply
        if reply = "y" then
            cls

            question7


        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end win6


procedure win7


    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Good job, it is the right answer...:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to carry on with the game:- 'n' or 'y'?"
        get reply
        if reply = "y" then
            cls

            question8


        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end win7


procedure win8
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Good job, it is the right answer...:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to carry on with the game:- 'n' or 'y'?"
        get reply
        if reply = "y" then
            cls

            question9


        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop

end win8


procedure win9
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Good job, it is the right answer...:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to carry on with the game:- 'n' or 'y'?"
        get reply
        if reply = "y" then
            cls

            question10


        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop

end win9


procedure win10

   
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("COMIC SANS MS:24")
        assert font1 > 0

        Font.Draw ("Congrats, you won the game....:-) ", 40, maxy div 2, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls

   


end win10




%%%%%%%%%%%%%%%%%%%%%%%%%%  WRONGZZZZZZZZZZZZ START%%%%%%%%%%%%%%%%%%%%%%%%%%%%555


procedure wrong1
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then

            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end wrong1

procedure wrong2
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then
            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end wrong2

procedure wrong3
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then
            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end wrong3


procedure wrong4
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then
            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop

end wrong4


procedure wrong5

    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then
            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end wrong5


procedure wrong6

    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then
            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end wrong6


procedure wrong7

    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then
            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop

end wrong7


procedure wrong8

    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then
            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop
end wrong8


procedure wrong9
    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then
            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop

end wrong9


procedure wrong10


    loop
        cls
        drawfillbox (0, 0, maxx, maxy, black)
        font1 := Font.New ("comic sans ms:24")
        assert font1 > 0
        Font.Draw ("Oh!, it is the wrong answer...", 50, 30, font1, yellow)
        Font.Free (font1)
        delay (1000)
        cls
        put "Do you want to play again:- 'n' or 'y'"
        get reply
        if reply = "y" then
            cls

            question1

        elsif reply = "n" then
            put "goodbye"
        end if
        exit when reply = "n" or reply = "y"
    end loop

end wrong10

%%%%%%%%%%%%%%%%%WRONGZZZZZZZ END%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%MOUSE START%%%%%%%%%%%%%%%%%%%%%%%%



procedure mouse1


    buttonwait ("down", x, y, btn, updown)
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        win1

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        wrong1

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        wrong1

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        wrong1

    end if
    cls

end mouse1

procedure mouse2


    buttonwait ("down", x, y, btn, updown) 
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        wrong2

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        wrong2

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        wrong2

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        win2

    end if

    cls
end mouse2

procedure mouse3


    buttonwait ("down", x, y, btn, updown)
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        win3

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        wrong3

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        wrong3

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        wrong3

    end if

    cls

end mouse3

procedure mouse4

    buttonwait ("down", x, y, btn, updown)
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        wrong4

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        wrong4

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        win4

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        wrong4

    end if

    cls
end mouse4

procedure mouse5

    buttonwait ("down", x, y, btn, updown)
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        wrong5

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        win5

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        wrong5

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        wrong5

    end if

    cls
end mouse5


procedure mouse6

    buttonwait ("down", x, y, btn, updown)
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        win6

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        wrong6

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        wrong6

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        wrong6

    end if

    cls
end mouse6


procedure mouse7
    buttonwait ("down", x, y, btn, updown)
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        wrong7

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        wrong7

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        wrong7

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        win7

    end if

    cls


end mouse7


procedure mouse8

    buttonwait ("down", x, y, btn, updown)
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        wrong8

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        win8

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        wrong8

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        win8

    end if

    cls

end mouse8


procedure mouse9

 buttonwait ("down", x, y, btn, updown)
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        wrong9

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        wrong9

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        wrong9

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        win9

    end if

    cls
end mouse9


procedure mouse10

 buttonwait ("down", x, y, btn, updown)
    if (x >= 30 and x <= 190) and (y >= 190 and y <= 230) then
        wrong10

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 190 and y <= 230) then

        win10

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 30 and x <= 190) and (y >= 90 and y <= 130) then
        wrong10

        buttonwait ("down", x, y, btn, updown)
    elsif (x >= 290 and x <= 420) and (y >= 90 and y <= 130) then
        win10

    end if

    cls



end mouse10



%%%%%%%%%%%%%%%%%%%%MOUSE END%%%%%%%%%%%%
question1
mouse1
question2
mouse2
question3
mouse3
question4
mouse4
question5
mouse5
question6
mouse6
question7
mouse7
question8
mouse8
question9
mouse9
question10
mouse10





Sponsor
Sponsor
Sponsor
sponsor
Expirant




PostPosted: Fri Jan 19, 2007 11:30 am   Post subject: Re: game help ~ ASAP

Hey,

I tried using your code and looking it over, but I stopped because helping you to fix it would be a waste of your time I think. The thing is, your program is about 1200 lines, when it should be more like 50 (in total).

To give you an idea, here I've written an example of a small game similar to yours:

code:
procedure question (question_line : string, answer : int)
    var answer_input : string
    put question_line
    get answer_input : *

    if strintok (answer_input) and strint (answer_input) = answer then
        put "\nCorrect!"
    else
        put "\nWrong!"
        question (question_line, answer)
    end if
end question

question ("What is 5 + 5\n1) 1\n2) 2\n3) 3\n4) 4\n5) 10", 5)


What it's doing is taking a question_line parameter which it displays, and that's the question the user sees. The next parameter is the answer. So, it puts the question to the screen, gets an answer from the user, then checks if that answer is the same as the answer providied. Otherwise, the procedure uses something called recursion (calling itself from inside itself).

Notice that in your game, every single one of your procedures (in the same category, ex mouse9 and mouse10) have the exact same format, just different input and output.
So, why not just use variables as parameters to change these values every time you call the procedure, instead of rewriting the whole procedure itself just to change one thing?

You way want to check out the Turing Walkthrough, and specifically take a look at functions, procedures, parameters, and possibly recursion (although it's not necessary).

Good luck,
Expirant
ruscutie




PostPosted: Fri Jan 19, 2007 5:34 pm   Post subject: RE:game help ~ ASAP

thanxxxxxx a lottttttttttttttttttttttttttt...... u rockk...
Bored




PostPosted: Sat Jan 20, 2007 3:57 pm   Post subject: RE:game help ~ ASAP

Expirant, I hope you realize you just posted an almost complete assignment for him. Rather then tell him how to do it, you did it for him. From my experience on this site ruscutie probably just copied what you had and pasted it into Turing, added a few lines and handed it in as hjis own.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: