Crimbo (C64] by Sander Alsema
About
--- Crimbo ---
Written by Sander Alsema for the 10-liner competition 2023.
Language: Commodore 64 Basic v2
Category: PUR-80
--- Description & Instructions ---
'Twas the night before Christmas... You probably know the rest by heart.
There is however a minor difference. Because the current global population
has exceeded eight billion individuals, there is no longer enough time for
personal house calls. Instead Santa lands on your roof top, crams your
presents down your chimney and is off to the next house. A delivery system
not unlike Amazon's.
In this game you experience what it is like to work in this fashion. You
are Old Saint Nick and some off-screen elf is throwing presents down
towards you while saying for whom they are intended, using initials for
privacy reasons of course. Jab each present with the right amount of force
to make it go down the correct chimney.
Out of excitement over every successful delivery you become somewhat
elevated, making it harder to deliver the next present. If you make a
mistake, the game is over. But when you have successfully delivered 16
presents, you win!
Controls:
Press 1-4 to jab, where the number indicates the amount of force with
which this is done.
--- Code Explanation ---
Line 0: Read the following text strings from elsewhere in the code:
- Santa's hand and candy cane
- Victory text
- Present being pushed
- Game Over text
- Santa himself
In a loop, construct Santa's arm and vertical orientation string.
Set background to black.
Set Santa's initial height.
Line 1: Clear the screen and display the rows of chimneys.
Set the present's initial horizontal co-ordinate.
Set a variable with the screen position to the right of the
extended candy cane.
Line 2: Randomly create an ASCII value from 'A' to 'D'.
Display for whom the current present is intended and Santa.
Set Santa's initial arm length.
Set the present's initial vertical co-ordinate.
Line 3: Display Santa's arm and candy cane and the falling present.
Line 4: If Santa's arm is extended and there is a present at the end, then
display, in a loop, the present being pushed to the position with
the specified horizontal co-ordinate.
Line 5: Read the keyboard.
Retract Santa's arm.
Determine the numeric value of the key pressed.
If this value is between 1 and 4, then extend Santa's arm and
specify the horizontal co-ordinate.
Line 6: Set the vertical co-ordinate of the falling present 1 position
lower.
As long as the present hasn't reached the bottom, jump to line 3.
This line also contains data for text strings.
Line 7: If the present's horizontal co-ordinate matches the one of the
correct chimney, then set Santa's vertical co-ordinate 1 position
higher.
As long as Santa hasn't reached the top, jump to line 1.
This line also contains data for text strings.
Line 8: Clear the screen and display how many presents were successfully
delivered and the game over text.
If Santa had reached the top, then also display the victory text.
Line 9: Wait for a key to be pressed.
Restart the game.
This line also contains data for a text string.
---