uRoll) Then msg = "I won" Else msg = "It's a tie" End If Return msg End Function"> uRoll) Then msg = "I won" Else msg = "It's a tie" End If Return msg End Function">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dice Game Pseudocode Module main() Declare String reply

Similar presentations


Presentation on theme: "Dice Game Pseudocode Module main() Declare String reply"— Presentation transcript:

1 Dice Game Pseudocode Module main() Declare String reply
5/14/2018 Dice Game Pseudocode Module main() Declare String reply Declare Integer userRoll, compRoll Display “Do you want to play: Y/N” Input reply While(reply= “Y”) userRoll = random(1,6) compRoll = random(1,6) Display "You got a ", userRoll, " I got a ", compRoll Display getMessage(userRoll, compRoll) Display “Do you want to play again: Y/N” EndWhile End Module

2 5/14/2018 Dice Game Pseudocode Function String getMessage(Integer uRoll, Integer cRoll) Declare String msg If (uRoll > cRoll) Then msg = "You won" Else If (cRoll > uRoll) Then msg = "I won" Else msg = "It's a tie" End If Return msg End Function


Download ppt "Dice Game Pseudocode Module main() Declare String reply"

Similar presentations


Ads by Google