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

Username:   Password: 
 RegisterRegister   
 DICE - it works
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
iceman




PostPosted: Wed Nov 14, 2007 3:27 pm   Post subject: DICE - it works

Thanks for your help!

code:


% The Visual Dice Program with Random seed


% declaration of variables

var dicePics : array 1 .. 6 of int

dicePics(1) := Pic.FileNew ("1dice.bmp")
dicePics(2) := Pic.FileNew ("2dice.bmp")
dicePics(3) := Pic.FileNew ("3dice.bmp")
dicePics(4) := Pic.FileNew ("4dice.bmp")
dicePics(5) := Pic.FileNew ("5dice.bmp")
dicePics(6) := Pic.FileNew ("6dice.bmp")

var die1,die2:int



% generate random seed for each die

die1 := Rand.Int(1, 6)
die2 := Rand.Int(1, 6)



% Pic.SetTransparentColor (pic, brightred)

setscreen ("graphics:768;512")
setscreen ("offscreenonly")




% this loop displays the random dice using the dicePics 1-D array

for x : 100 .. 500
    cls
    Pic.Draw(dicePics(die1), x, 100, picMerge)
    Pic.Draw(dicePics(die2), x, 250, picMerge)
    put die1,die2
    View.Update
    delay (1)
end for

Sponsor
Sponsor
Sponsor
sponsor
Mazer




PostPosted: Wed Nov 14, 2007 3:41 pm   Post subject: RE:DICE - it works

...
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  [ 2 Posts ]
Jump to:   


Style:  
Search: