Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE SUB drawCal (filledSpot() AS INTEGER, emptySpot() AS INTEGER, weeksLived AS INTEGER, totalWeeks AS INTEGER)
- DECLARE SUB initGraphics (graphicsArray() AS INTEGER)
- CLS
- SCREEN 12
- DIM filledSpot(30) AS INTEGER
- DIM emptySpot(30) AS INTEGER
- CALL initGraphics(filledSpot())
- CALL initGraphics(emptySpot())
- CLS
- INPUT "How many total years of life"; totalYears%
- numTotalWeeks% = totalYears% * 52
- INPUT "How many years lived"; numYearsLived%
- numWeeksLived% = numYearsLived% * 52
- IF numTotalWeeks% >= numWeeksLived% THEN
- CALL drawCal(filledSpot(), emptySpot(), numWeeksLived%, numTotalWeeks%)
- ELSE
- PRINT "You cannot live more than the total number weeks."
- END IF
- END
- 'filled spot
- DATA 0, 0, 14, 14, 0, 0
- DATA 0, 14, 14, 14, 14, 0
- DATA 14, 14, 14, 14, 14, 14
- 'DATA 14, 14, 14, 14, 14, 14
- DATA 0, 14, 14, 14, 14, 0
- DATA 0, 0, 14, 14, 0, 0
- 'empty spot
- DATA 0, 0, 15, 15, 0, 0
- DATA 0, 15, 0, 0, 15, 0
- DATA 15, 0, 0, 0, 0, 15
- 'DATA 15, 0, 0, 0, 0, 15
- DATA 0, 15, 0, 0, 15, 0
- DATA 0, 0, 15, 15, 0, 0
- SUB drawCal (filledSpot() AS INTEGER, emptySpot() AS INTEGER, weeksLived AS INTEGER, totalWeeks AS INTEGER)
- CLS
- DIM screenWidth AS INTEGER
- DIM screenHeight AS INTEGER
- DIM dotsPlaced AS INTEGER
- DIM x AS INTEGER
- DIM y AS INTEGER
- screenWidth = 640
- screenHeight = 480
- dotsPlaced = 0
- x = 1
- y = 50
- PRINT " Weeks lived: "; weeksLived; "(years:"; weeksLived / 52; ")"
- PRINT " Total Weeks: "; totalWeeks; "(years:"; totalWeeks / 52; ")"
- PRINT " Weeks Remaining: "; totalWeeks - weeksLived; "(years:"; (totalWeeks - weeksLived) / 52; ")"
- LINE (1, 1)-(300, 48), 15, B
- WHILE dotsPlaced < totalWeeks
- IF weeksLived > 0 THEN
- PUT (x, y), filledSpot
- weeksLived = weeksLived - 1
- ELSE
- PUT (x, y), emptySpot
- END IF
- dotsPlaced = dotsPlaced + 1
- IF x < screenWidth - 9 THEN
- x = x + 9
- ELSE
- x = 1
- y = y + 6
- END IF
- WEND
- END SUB
- SUB initGraphics (graphicsArray() AS INTEGER)
- FOR y% = 1 TO 5
- FOR x% = 1 TO 6
- READ spot%
- PSET (x%, y%), spot%
- NEXT x%
- NEXT y%
- GET (1, 1)-(5, 6), graphicsArray
- END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement