Psyber

Dice.bas v1

Nov 3rd, 2018
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 0.69 KB | None | 0 0
  1. REM Basic dice program v1, coded in qbasic 4.5
  2. RandomGenDice:
  3. CLS
  4. RANDOMIZE TIMER
  5. A = INT((6 - 1 + 1) * RND + 1)
  6. B = INT((6 - 1 + 1) * RND + 1)
  7. C = INT((6 - 1 + 1) * RND + 1)
  8. D = INT((6 - 1 + 1) * RND + 1)
  9.  
  10. DiceResultDisplay:
  11. PRINT "You rolled "; A; "and "; B
  12. PRINT "Computer rolled "; C; "and "; D
  13.  
  14. DiceTotalCompare:
  15. F = A + B
  16. G = C + D
  17.  
  18. IF F > G THEN GOTO YWin
  19. IF F < G THEN GOTO YLose
  20. IF F = G THEN GOTO YDraw
  21.  
  22. Ywin:
  23. PRINT "You Win!"
  24. GOTO RollQuit
  25.  
  26. YLose:
  27. PRINT "You Lose!"
  28. GOTO RollQuit
  29.  
  30. YDraw:
  31. PRINT "It's a draw!"
  32. GOTO RollQuit
  33.  
  34. RollQuit:
  35. INPUT ; "Roll again?(y/n)"; reply$
  36. IF reply$ = "y" THEN
  37. GOTO RandomGenDice
  38. ELSE IF reply$ = "n" THEN END
  39. END IF
  40. GOTO RollQuit
Add Comment
Please, Sign In to add comment