A downloadable game

"π Slice" is a simple memory game to recall the first 100 digits of π in 10 lines using CBM64 BASIC v2 for submission in the 2021 ASCII BASIC GAME 10Liner competition.

I chose the Commodore 64 as I am confident with the BASIC language and my favourite 8-bit computer of the 1980s.

The submission is a compact version of my original  π  submission for the 2021 C64 'Cassette 50' Charity Competition and aimed to squeeze the game into a 10-line game for submission in this competition.

Storyline

Uh?... Not much of a story-line per se, however you could consider it as an educational game to teach or learn the first 100 digits of π.  If you can recall the all the numbers from memory then that is right,  however looking up the value from the Internet is frowned upon.
 
How to Run

The VICE or CCS64 emulators can be used to play the game.  Alternatively, using a real C64 is the also suitable.


Operation

This operation of the game is fairly simple. All you need to you is press a key from [0] to [9] for guessing of the number.

If you are correct, the digit will turn green; if not the digit will turn red.
After 100 digits, your score will be displayed out of 100 digits.


The Code

The following is the plain PETSCII text of the game. Please make note of the screen control characters that are contained in the curly brackets which clear the screen; move the cursor into the correct position and change the color the text as required.

To fit in with the 10 lines requirement, a comment line is on line 0, and to comply the 72 character limit, the data strings for the digits of π are peppered through the program to fit this additional requirement. 

For further detail, I put the extra challenge for myself to ensure that all lines meet the 72-character limit, including when the game LIST is its expanded code.


0 REM 2021 ASCII BASIC GAME 10 LINE COMP  {pi} SLICE - COUT 2021
1 Q=10:S=53280:POKES,0:POKES+1,0:GOSUB7:B=1276:E=9:L=40:V=54272:GOTO3
2 D$=MID$(A$,C,1):T=B+F+C:POKET+V,0:POKET,ASC(D$):R=0:P$="{down*5}":RETURN
3 FORA=0TOE:F=A*L:READA$:FORC=1TOQ:GOSUB2:NEXTC,A:J=1:DATA"1415926535"
4 N=2:GOSUB8:H$=CHR$(PEEK(B+K)):IFH$=G$THENR=R+1:N=5:DATA"8979323846"
5 POKEB+K+V,N:J=J+1:IFJ<101THEN4:DATA"2643383279","5028841971"
6 PRINTTAB(13)P$P$"SCORE:"R"{black}":END:DATA"6939937510","5820974944"
7 PRINT"{clear}{white}{down}"TAB(Q)"{pi} SLICE - cout 2O21{down}":PRINTTAB(Q)"{down}{U}{I}{down}{left}{cm w}{down}{left*2}{J}{K}.":return
8 M=INT((J-1)/Q):K=L*M+(J-Q*M):G$="":GETG$:IFG$=""THEN8
9 RETURN:DATA"5923078164","0628620899","8628034825","3421170679"

Download

Download
pi-slice.prg 568 bytes
Download
pi-slice.txt 763 bytes