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

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




PostPosted: Thu Jun 15, 2006 1:50 pm   Post subject: help with a yahtzee game

my problem is that I can not get the dice to roll with the corresponding pictures. This is what I have now but it does not work.After my if statements at value it says "if must be boolean type".

code:

procedure Dice
    randomize
    for dice_1 (1 , 6)
        if value := 1 then
            Pic.Draw (picDice1, 5, 18, picCopy)
        elsif value := 2 then
            Pic.Draw (picDice2, 5, 18, picCopy)
        elsif value := 3 then
            Pic.Draw (picDice3, 5, 18, picCopy)
        elsif value := 4 then
            Pic.Draw (picDice4, 5, 18, picCopy)
        elsif value := 5 then
            Pic.Draw (picDice5, 5, 18, picCopy)
        elsif value := 6 then
            Pic.Draw (picDice6, 5, 18, picCopy)
        end if
    end for
end Dice


Thanks for all your help![/code]
Sponsor
Sponsor
Sponsor
sponsor
jamonathin




PostPosted: Thu Jun 15, 2006 2:11 pm   Post subject: (No subject)

Well first of all for loops aren't written like
You wrote:

for dice_1 (1 , 6)

but like . .
code:

for i: 1 .. 6


And secondly, we are comparing the values, not setting the values, so we dont use:
You wrote:

if value := 1 then

but rather . .
code:

if value = 1 then

The " := " is for setting a value, not comparing.
neufelni




PostPosted: Thu Jun 15, 2006 2:12 pm   Post subject: (No subject)

Your problem is that you are using :=. This is used in Turing to assign values to variables. For if statements you want to just use =.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: