Computer Science Canada

Create a program using integers and shapes

Author:  Miko99 [ 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.

Author:  Tony [ Tue Apr 01, 2003 12:30 pm ]
Post 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.

Author:  Delta [ 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
<B>var</B> roll : <B>int</B> := <B>Rand.Int</B> (1,6)
roll = 3
<B>if</B> roll=3 <B>then</B>
draw the following
_______
| O O O |
| |
|______|
<B>if</B> roll = 5 <B>then</B>
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
<B>for</B> loops


The box is suspose to be a die Razz


: