' Life Calendar ' 12/5/18 ' Enter total years of life, and then current year of life. The program will then ' display about how many weeks you've lived vs how many are remaining. ' ' This wasn't meant to be morbid. The idea actually came from a TED talk ' video on YouTube about procrastination. In the video they had a similar ' calendar to motivate people to take advantage of their time on Earth but ' only showed it as a total of weeks. I thought it would be interesting to ' have an interactive version to play around with... so here it is. ' ' Youtube Link to TED Talk: https://www.youtube.com/watch?v=arj7oStGLkU ' 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 'hack way to draw continuation on next screen IF y + 6 > screenHeight THEN SLEEP y = 1 CLS END IF 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