Advertisement
Aayushdn

dice simulator with qbaisc

Mar 27th, 2021
303
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DECLARE SUB one()
  2. DECLARE SUB two()
  3. DECLARE SUB three()
  4. DECLARE SUB four()
  5. DECLARE SUB five()
  6. DECLARE SUB six()
  7. DECLARE FUNCTION rand(bottom,top)
  8. CLS
  9. INPUT "lets continue the game [Y/N]"; w$
  10. IF UCASE$(w$) = "Y" THEN GOTO top
  11.  
  12. top:
  13. REM "rdn = random dice number"
  14. rdn = Rand(1, 6)
  15. IF rdn = 1 THEN
  16.     CALL one
  17. ELSEIF rdn = 2 THEN
  18.     CALL two
  19. ELSEIF rdn = 3 THEN
  20.     CALL three
  21. ELSEIF rdn = 4 THEN
  22.     CALL four
  23. ELSEIF rdn = 5 THEN
  24.     CALL five
  25. ELSEIF rdn = 6 THEN
  26.     CALL six
  27. END IF
  28. INPUT "Do you want to play more [Y/N]", re$
  29. IF UCASE$(re$) = "Y" THEN
  30.     GOTO top
  31. END IF
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. FUNCTION Rand (Bottom, Top)
  40.     RANDOMIZE TIMER 'this sets the random number generator
  41.     RANDOMIZE RND * 10 'this confuses it to get more randomness
  42.     IF Bottom > Top THEN 'oops - reverse order
  43.         Temp = Bottom
  44.         Bottom = Top
  45.         Top = Temp
  46.     END IF
  47.     Rand = INT((Top - Bottom + 1) * RND + Bottom)
  48. END FUNCTION
  49.  
  50. SUB one
  51.     PRINT "---------------"
  52.     PRINT "|            |"
  53.     PRINT "|      *     |"
  54.     PRINT "|            |"
  55.     PRINT "---------------"
  56. END SUB
  57. SUB two
  58.     PRINT "---------------"
  59.     PRINT "|              |"
  60.     PRINT "|     * *      |"
  61.     PRINT "|              |"
  62.     PRINT "---------------"
  63.  
  64. END SUB
  65. SUB three
  66.     PRINT "---------------"
  67.     PRINT "|   *          |"
  68.     PRINT "|      *       |"
  69.     PRINT "|        *     |"
  70.     PRINT "---------------"
  71.  
  72. END SUB
  73. SUB four
  74.     PRINT "---------------"
  75.     PRINT "|   *     *    |"
  76.     PRINT "|              |"
  77.     PRINT "|   *    *     |"
  78.     PRINT "---------------"
  79.  
  80.  
  81. END SUB
  82. SUB five
  83.     PRINT "---------------"
  84.     PRINT "|   *     *    |"
  85.     PRINT "|      *       |"
  86.     PRINT "|   *    *     |"
  87.     PRINT "---------------"
  88.  
  89. END SUB
  90. SUB six
  91.     PRINT "---------------"
  92.     PRINT "|      **      |"
  93.     PRINT "|      **      |"
  94.     PRINT "|      **      |"
  95.     PRINT "---------------"
  96.  
  97. END SUB
  98.  
  99.  
  100.  
  101.  
  102.  
Advertisement
RAW Paste Data Copied
Advertisement