Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2018
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DECLARE SUB drawCal (filledSpot() AS INTEGER, emptySpot() AS INTEGER, weeksLived AS INTEGER, totalWeeks AS INTEGER)
  2. DECLARE SUB initGraphics (graphicsArray() AS INTEGER)
  3.  
  4. CLS
  5. SCREEN 12
  6.  
  7. DIM filledSpot(30) AS INTEGER
  8. DIM emptySpot(30) AS INTEGER
  9.  
  10.  
  11. CALL initGraphics(filledSpot())
  12. CALL initGraphics(emptySpot())
  13.  
  14. CLS
  15.  
  16. INPUT "How many total years of life"; totalYears%
  17. numTotalWeeks% = totalYears% * 52
  18.  
  19. INPUT "How many years lived"; numYearsLived%
  20. numWeeksLived% = numYearsLived% * 52
  21.  
  22. IF numTotalWeeks% >= numWeeksLived% THEN
  23.   CALL drawCal(filledSpot(), emptySpot(), numWeeksLived%, numTotalWeeks%)
  24. ELSE
  25.   PRINT "You cannot live more than the total number weeks."
  26. END IF
  27.  
  28. END
  29.  
  30.  
  31. 'filled spot
  32. DATA  0,  0, 14, 14,  0,  0
  33. DATA  0, 14, 14, 14, 14,  0
  34. DATA 14, 14, 14, 14, 14, 14
  35. 'DATA 14, 14, 14, 14, 14, 14
  36. DATA  0, 14, 14, 14, 14,  0
  37. DATA  0,  0, 14, 14,  0,  0
  38.  
  39.  
  40. 'empty spot
  41. DATA  0,  0, 15, 15,  0,  0
  42. DATA  0, 15,  0,  0, 15,  0
  43. DATA 15,  0,  0,  0,  0, 15
  44. 'DATA 15,  0,  0,  0,  0, 15
  45. DATA  0, 15,  0,  0, 15,  0
  46. DATA  0,  0, 15, 15,  0,  0
  47.  
  48. SUB drawCal (filledSpot() AS INTEGER, emptySpot() AS INTEGER, weeksLived AS INTEGER, totalWeeks AS INTEGER)
  49.  
  50. CLS
  51.  
  52. DIM screenWidth AS INTEGER
  53. DIM screenHeight AS INTEGER
  54. DIM dotsPlaced AS INTEGER
  55. DIM x AS INTEGER
  56. DIM y AS INTEGER
  57.  
  58. screenWidth = 640
  59. screenHeight = 480
  60. dotsPlaced = 0
  61. x = 1
  62. y = 50
  63.  
  64. PRINT "     Weeks lived: "; weeksLived; "(years:"; weeksLived / 52; ")"
  65. PRINT "     Total Weeks: "; totalWeeks; "(years:"; totalWeeks / 52; ")"
  66. PRINT " Weeks Remaining: "; totalWeeks - weeksLived; "(years:"; (totalWeeks - weeksLived) / 52; ")"
  67.  
  68. LINE (1, 1)-(300, 48), 15, B
  69.  
  70.  
  71. WHILE dotsPlaced < totalWeeks
  72.   IF weeksLived > 0 THEN
  73.     PUT (x, y), filledSpot
  74.     weeksLived = weeksLived - 1
  75.   ELSE
  76.     PUT (x, y), emptySpot
  77.   END IF
  78.  
  79.   dotsPlaced = dotsPlaced + 1
  80.  
  81.   IF x < screenWidth - 9 THEN
  82.     x = x + 9
  83.   ELSE
  84.     x = 1
  85.     y = y + 6
  86.   END IF
  87. WEND
  88.  
  89.  
  90. END SUB
  91.  
  92. SUB initGraphics (graphicsArray() AS INTEGER)
  93.  
  94.  
  95. FOR y% = 1 TO 5
  96.   FOR x% = 1 TO 6
  97.     READ spot%
  98.     PSET (x%, y%), spot%
  99.   NEXT x%
  100. NEXT y%
  101. GET (1, 1)-(5, 6), graphicsArray
  102.  
  103.  
  104. END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement