School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 307,035 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,285 people online right now. Registration is fast and FREE... Join Now!




JustBasic 3 guess dice program

 

JustBasic 3 guess dice program

lkg4btrlife

22 Oct, 2009 - 07:22 AM
Post #1

New D.I.C Head
*

Joined: 17 Oct, 2009
Posts: 3


My Contributions
This what I have done code wise. Not sure why but when the program is ran i can not get it to generate a random number between 2-12 to simulate the roll of the 2 dice added together. it is supposed to allow the player to guess 3 times the result of the 2 die roll and then if the player guessed right it should say you win the number was and out put the number and if the player lossed it is supposed to generate a you lose the die total was and output the roll

CODE

let die1= random(6)
let die2= random(6)
let count = 1
let roll=die1+die2
input roll
do
    print "enter a number between 2 and 12:"; guess
    input guess
    let count=count+1
loop until count >=4


end


here is something i am adding to it to help determine the output but it still does not work

CODE


if
    roll=guess then
    print "you win-roll was:"+roll
else
    print "you lose- roll was:"+roll
end if


User is offlineProfile CardPM
+Quote Post


juansanmartin189

RE: JustBasic 3 Guess Dice Program

29 Oct, 2009 - 04:18 PM
Post #2

New D.I.C Head
*

Joined: 25 Nov, 2006
Posts: 6


My Contributions
QUOTE(lkg4btrlife @ 22 Oct, 2009 - 07:22 AM) *

This what I have done code wise. Not sure why but when the program is ran i can not get it to generate a random number between 2-12 to simulate the roll of the 2 dice added together. it is supposed to allow the player to guess 3 times the result of the 2 die roll and then if the player guessed right it should say you win the number was and out put the number and if the player lossed it is supposed to generate a you lose the die total was and output the roll

CODE

let die1= random(6)
let die2= random(6)
let count = 1
let roll=die1+die2
input roll
do
    print "enter a number between 2 and 12:"; guess
    input guess
    let count=count+1
loop until count >=4


end


here is something i am adding to it to help determine the output but it still does not work

CODE


if
    roll=guess then
    print "you win-roll was:"+roll
else
    print "you lose- roll was:"+roll
end if




what is this java, if it is i think i have a program that generates random number by rolling dice
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 08:39AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month