Wednesday 15 July 2015

algorithm - Writing Pseudocode dice game -



algorithm - Writing Pseudocode dice game -

hi iam first year pupil doing iam haveing problem logic aspect of things. write pseudocode game simulates rolling 2 dice generating random numbers between 2 , 12 inclusive.

the player chooses number between 2 , 12 (the lowest , highest totals possible 2 dice).

the player “rolls” 2 dice 5 times.

if number chosen user comes up, user wins , game ends.

if number not come within 5 rolls, user loses.

assume there module twodiceroll() simulates throwing of 2 dice returning random number between 2 , 12 inclusive.

do input number //number entered player while number>12 or number <2 bool status <-- false int tmp 1 5 tmp <-- twodiceroll() if tmp=number status <--true break end if end if status=true print "user wins" else print "user loose"

algorithm logic pseudocode

No comments:

Post a Comment