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

Username:   Password: 
 RegisterRegister   
 Help with Simon game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Shane1244




PostPosted: Wed May 27, 2009 8:43 am   Post subject: Help with Simon game

What is it you are trying to achieve?
I need help trying to figure out how to make it so after the array generates the numbers, I need it to basiclly let the mouse select a certain number of squares based on the level. As it is now, When it goes to my (Guess) procedure it does one run through it and then exits.

So basicly, I want (Guess) to wait untill there have been a certain amount of mouse cliks (level) and then determin if each one is in the correct order as the array, after it has checked, I want it to do (Level +=1) and then go to (simongen) and repeat.

Describe what you have tried to solve this problem
I really don't know where to start.


Turing:


var simon : array 1 .. 100 of int
var bluebox, redbox, yellowbox, greenbox : int
var mouse, x, y : int
var level : int
bluebox := 1
redbox := 4
yellowbox := 6
greenbox := 2
level := 0
%Colour Guide
%(1) Red,    Dark: 4     Light: 12
%(2) Blue,   Dark: 1     Light: 9
%(3) Green,  Dark: 2     Light 10
%(4) Yellow, Dark: 6     Light: 14

%Random Generator for Simon
procedure initializeArray
    for i : 1 .. 100
        simon (i) := Rand.Int (1, 4)
    end for
end initializeArray



procedure guess

    for i : 1 .. level
        %User
        Mouse.Where (x, y, mouse)
        %BLUE BOX
        if whatdotcolor (x, y) = 1 and mouse = 1 then
            bluebox := 9

            %RED BOX
        elsif whatdotcolor (x, y) = 4 and mouse = 1 then
            redbox := 12

            %Yellow Box
        elsif whatdotcolor (x, y) = 6 and mouse = 1 then
            yellowbox := 14

            %Green Box
        elsif whatdotcolor (x, y) = 2 and mouse = 1 then
            greenbox := 10

        elsif mouse = 0 then
            bluebox := 1
            redbox := 4
            yellowbox := 6
            greenbox := 2
        end if
        Draw.FillBox (120, 170, 200, 250, bluebox)
        Draw.FillBox (220, 170, 300, 250, redbox)
        Draw.FillBox (320, 170, 400, 250, yellowbox)
        Draw.FillBox (420, 170, 500, 250, greenbox)

    end for
end guess



Draw.FillBox (120, 170, 200, 250, bluebox)
Draw.FillBox (220, 170, 300, 250, redbox)
Draw.FillBox (320, 170, 400, 250, yellowbox)
Draw.FillBox (420, 170, 500, 250, greenbox)

%Generated Number --> Light
procedure simongen
    level += 1
    for i : 1 .. level
        delay (333)
        %Red
        if simon (i) = 1 then
            redbox := 12
            Draw.FillBox (220, 170, 300, 250, redbox)
            delay (500)
            redbox := 4
            Draw.FillBox (220, 170, 300, 250, redbox)
            %Blue
        elsif simon (i) = 2 then
            bluebox := 9
            Draw.FillBox (120, 170, 200, 250, bluebox)
            delay (500)
            bluebox := 1
            Draw.FillBox (120, 170, 200, 250, bluebox)
            %Green
        elsif simon (i) = 3 then
            greenbox := 10
            Draw.FillBox (420, 170, 500, 250, greenbox)
            delay (500)
            greenbox := 2
            Draw.FillBox (420, 170, 500, 250, greenbox)
            %Yellow
        elsif simon (i) = 4 then
            yellowbox := 14
            Draw.FillBox (320, 170, 400, 250, yellowbox)
            delay (500)
            yellowbox := 6
            Draw.FillBox (320, 170, 400, 250, yellowbox)
        end if
    end for
    guess
end simongen

initializeArray
simongen

%End Generated Number --> Lights








Please specify what version of Turing you are using
4.1
Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: