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

Username:   Password: 
 RegisterRegister   
 Create a program using integers and shapes
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Miko99




PostPosted: Tue Apr 01, 2003 11:05 am   Post subject: Create a program using integers and shapes

create a program that will simulate the roll of a dice so that when it is run it will show a square with little circles in it that represent the side of the dice that is rolled. i.e. If a 3 is rolled there will be a square on the screen with 3 circles in it. Don't worry about getting the circles in the exact location as a real die. Even if you just put the circles in a straight line in the square would be good enough for now.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Apr 01, 2003 12:30 pm   Post subject: (No subject)

you should take a look at Catalyst's 3D engine. I belive he posted some of his source code - take a look at that.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Delta




PostPosted: Tue Apr 01, 2003 12:51 pm   Post subject: Try something like this

Just create an if statement that takes the value of the roll and draws 1,2,3...so on circles.

example roll
var roll : int := Rand.Int (1,6)
roll = 3
if roll=3 then
draw the following
_______
| O O O |
| |
|______|
if roll = 5 then
draw the following
_______
| O O O |
| O O |
|______|

simple if statements would be the easiest but they may take up quite
a few lines of code if you choose to draw circle by circle. You should learn
for loops


The box is suspose to be a die Razz
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: