help with dice school project "dice program"
Author |
Message |
RYAN191
|
Posted: Thu Apr 09, 2009 4:02 pm Post subject: help with dice school project "dice program" |
|
|
Create a program that will play the following game. The computer will use a pair of dice. Before the
game begins the computer will ask the user how many times to roll and how many times the roll will
match the first roll. The computer is to roll once to see the first roll. On each successive roll the
computer is to count the total number of times the total is matched. While running, the computer is
to output a chart indicated the results of each role, whether the total was matched and whether the
die numbers matched. A total match results in a single point. Another point is given when the
specific numbers are also matched.
this is the outline for the project im doing can someone help change it
____________________________________
Turing: | colour(blue)
put "Welcome to the game Dice"
colour(black)
procedure die1
drawbox(300, 50, 200, 150, 7)
drawfilloval(250, 100, 10, 10, 7)
end die1
procedure die2
drawbox(300, 50, 200, 150, 7)
drawfilloval(285, 135, 10, 10, 7)
drawfilloval(215, 65, 10, 10, 7)
end die2
procedure die3
drawbox(300, 50, 200, 150, 7)
drawfilloval(285, 135, 10, 10, 7)
drawfilloval(215, 65, 10, 10, 7)
drawfilloval(250, 100, 10, 10, 7)
end die3
procedure die4
drawbox(300, 50, 200, 150, 7)
drawfilloval(285, 135, 10, 10, 7)
drawfilloval(215, 65, 10, 10, 7)
drawfilloval(285, 65, 10, 10, 7)
drawfilloval(215, 135, 10, 10, 7)
end die4
procedure die5
drawbox(300, 50, 200, 150, 7)
drawfilloval(285, 135, 10, 10, 7)
drawfilloval(215, 65, 10, 10, 7)
drawfilloval(285, 65, 10, 10, 7)
drawfilloval(215, 135, 10, 10, 7)
drawfilloval(250, 100, 10, 10, 7)
end die5
procedure die6
drawbox(300, 50, 200, 150, 7)
drawfilloval(285, 135, 10, 10, 7)
drawfilloval(215, 65, 10, 10, 7)
drawfilloval(285, 65, 10, 10, 7)
drawfilloval(215, 135, 10, 10, 7)
drawfilloval(215, 100, 10, 10, 7)
drawfilloval(285, 100, 10, 10, 7)
end die6
procedure d1
drawbox(480, 50, 380, 150, 7)
drawfilloval(430, 100, 10, 10, 7)
end d1
procedure d2
drawbox(480, 50, 380, 150, 7)
drawfilloval(465, 135, 10, 10, 7)
drawfilloval(395, 65, 10, 10, 7)
end d2
procedure d3
drawbox(480, 50, 380, 150, 7)
drawfilloval(465, 135, 10, 10, 7)
drawfilloval(395, 65, 10, 10, 7)
drawfilloval(430, 100, 10, 10, 7)
end d3
procedure d4
drawbox(480, 50, 380, 150, 7)
drawfilloval(465, 135, 10, 10, 7)
drawfilloval(395, 65, 10, 10, 7)
drawfilloval(465, 65, 10, 10, 7)
drawfilloval(395, 135, 10, 10, 7)
end d4
procedure d5
drawbox(480, 50, 380, 150, 7)
drawfilloval(465, 135, 10, 10, 7)
drawfilloval(395, 65, 10, 10, 7)
drawfilloval(465, 65, 10, 10, 7)
drawfilloval(395, 135, 10, 10, 7)
drawfilloval(430, 100, 10, 10, 7)
end d5
procedure d6
drawbox(480, 50, 380, 150, 7)
drawfilloval(465, 135, 10, 10, 7)
drawfilloval(395, 65, 10, 10, 7)
drawfilloval(465, 65, 10, 10, 7)
drawfilloval(395, 135, 10, 10, 7)
drawfilloval(395, 100, 10, 10, 7)
drawfilloval(465, 100, 10, 10, 7)
end d6
var answer: string
put "Would you like to roll the dice?(y/n)"
get answer
if answer= "y" then
var die : array 1 .. 6 of procedure dice
die (1) := die1
die (2) := die2
die (3) := die3
die (4) := die4
die (5) := die5
die (6) := die6
die (Rand.Int (1, 6))
var d : array 1.. 6 of procedure dice
d (1):= d1
d (2):= d2
d (3):= d3
d (4):= d4
d (5):= d5
d (6):= d6
d (Rand.Int (1, 6))
var diee,dce,di2,total,num1,num2: int
put"Enter the number of the first die you have rolled:"
get diee
case diee of
label 1 : put "You have rolled a 1"
label 2: put " You have rolled a 2"
label 3 : put "You have rolled a 3"
label 4 : put "You have rolled a 4"
label 5: put "You have rolled a 5"
label 6 : put "You have rolled a 6"
end case
put "Enter the number of the second die you rolled:"
get dce
case dce of
label 1 : put "You have rolled a 1"
label 2: put " You have rolled a 2"
label 3 : put "You have rolled a 3"
label 4 : put "You have rolled a 4"
label 5: put "You have rolled a 5"
label 6 : put "You have rolled a 6"
end case
if diee= 1 then
num1:= 1
elsif
diee= 2 then
num1:= 2
elsif
diee= 3 then
num1:= 3
elsif
diee= 2 then
num1:= 2
elsif
diee= 3 then
num1:= 3
elsif
diee= 4 then
num1:= 4
elsif
diee= 5 then
num1:= 5
elsif
diee= 6 then
num1:= 6
end if
if dce= 1 then
num2:= 1
elsif
dce= 2 then
num2:= 2
elsif
dce= 3 then
num2:= 3
elsif
dce= 2 then
num2:= 2
elsif
dce= 3 then
num2:= 3
elsif
dce= 4 then
num2:= 4
elsif
dce= 5 then
num2:= 5
elsif
dce= 6 then
num2:= 6
end if
total:=num1+num2
put "The total of the two dice equals:"
put total
if total= 7 then
put "You Win!"
elsif
total = 11 then
put "You Win!"
elsif
total = 2 then
put "You Lose!"
elsif total = 3 then
put "You Lose!"
if total = 12 then
put "You Lose!"
else
put "you must match your point value"
end if
end if
end if |
_____________________________________________________________
Mod Edit: Remember to use syntax tags! Thanks code: | [syntax="turing"]Code Here[/syntax] |
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
saltpro15

|
Posted: Thu Apr 09, 2009 4:35 pm Post subject: RE:help with dice school project "dice program" |
|
|
first, please use syntax tags
code: |
[syntax="Turing"]
code here
[/syntax]
|
second, what do you want help with exactly? |
|
|
|
|
 |
RYAN191
|
Posted: Thu Apr 09, 2009 5:14 pm Post subject: Re: help with dice school project "dice program" |
|
|
I need it so when a user enters a nuber under 6 the dice keep rolling untill both of the dice are the number the user entered but record what was rolled previous times on a chart |
|
|
|
|
 |
RYAN191
|
Posted: Thu Apr 09, 2009 5:23 pm Post subject: RE:help with dice school project "dice program" |
|
|
need to change it |
|
|
|
|
 |
TheGuardian001
|
Posted: Thu Apr 09, 2009 8:35 pm Post subject: Re: help with dice school project "dice program" |
|
|
RYAN191 @ Thu Apr 09, 2009 4:02 pm wrote: can someone help change it
To put it nicely, No.
If you have a specific problem, we can point you in the right direction, however you will have to do all the work yourself. If you make an effort at solving the problem and still can't make it work, we can help you find the solution, but we won't do it for you. |
|
|
|
|
 |
|
|