CASCADE (1982)

Discussion, Reviews & High-scores

Moderator: Moderators

Post Reply
orac81
Vic 20 Drifter
Posts: 39
Joined: Fri Jan 06, 2023 12:07 pm
Location: UK
Occupation: coder

CASCADE (1982)

Post by orac81 »

CASCADE is a BASIC game for any 40 column CBM computer. (C64, C16, PETs..) or unexpanded vic 20.

cascade2.zip
(38.21 KiB) Downloaded 149 times

Github:https://github.com/orac81/miniapples/ra ... scade2.zip

cascade-screen2v.png
cascade-screen2v.png (4.94 KiB) Viewed 3520 times
cascade-screen3v.png
cascade-screen3v.png (2.93 KiB) Viewed 3520 times

Files in zip file:
"cascade2bas.prg" - Basic version for any 40 column cbm, load with ",8" not ",8,1" (it is located at $0401 so PETs can load it.)
"cascade2c64.prg" - Compiled c64 version.
"cascade2c16.prg" - Compiled c16/+4 version.
"cascade11v20.prg" - Basic Vic20 version, load with ",8" not ",8,1", for any vic.
"cascade11vic8k.prg" - Compiled version for vic20 8k+.

To move, type the letter (a-z) you wish to remove and the balls will cascade down the gaps left. on reaching the bottom they will add to your score. The computer tries to do the same. The game ends when there are no balls left.
A simple game, but its a neat concept.


The original PET version of CASCADE was first published in CCI Nov 1982 magazine. The Vic20 version was written at that time.

https://commodore.bombjack.org/commodor ... al/cci.htm

Another Vic20 program of mine "RACER" was in the same issue, but they missed out the last line! Corrected working version here:

http://www.vic20listings.freeolamail.co ... /racer.t64



FRUIT HOOT

FRUIT HOOT is a BASIC fruit machine game that can run on any 40 column CBM computer. (C64, C16, PETs..)
fruit-hoot3.zip
(18.73 KiB) Downloaded 130 times
I have moved FRUIT HOOT to "other systems" since its not (yet) a vic20 game!

Both of the programs are released under the gnu gpl3 open license.
wimoos
Vic 20 Afficionado
Posts: 360
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: CASCADE (1982)

Post by wimoos »

I have converted this to a WimBasic version. The original version must be pushing 200 lines; in WimBasic I brought it down to 45 lines, and less than 1.5k of Basic tokenized text. During the process I discovered and fixed one or two buglets.
WimBasic features that were used here: COKE/CEEK, INSTR, SWAP, ERASE, WHILE/WEND/QUIT, PRINT@ , PRINT USING and SuperNumbers.

I may look into adding sounds to the animations.

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
orac81
Vic 20 Drifter
Posts: 39
Joined: Fri Jan 06, 2023 12:07 pm
Location: UK
Occupation: coder

Re: CASCADE (1982)

Post by orac81 »

Thanks for that! That Vic20 version is pretty much unaltered since 1982, so I thought it was a good idea to release it "as is".

I know it could be improved. For example, the balls are "dropped" from lowest to highest, so the paths dont interfere with each other, so I kept an array of ball positions and sorted them after each move, which is slow. But later I realised if you just peek the screen for the ball char in a loop from bottom to top, you will automatically get them in reverse order. There is no need to sort/store positions at all!

Anyway look forward to seeing your version..
wimoos
Vic 20 Afficionado
Posts: 360
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: CASCADE (1982)

Post by wimoos »

Now there is a good idea! Had not thought about it yet, but I'll try to make that work.
The only thing is that the array is also used when determining VIC's best move. But maybe that is solvable.

Regards,

Wim
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
orac81
Vic 20 Drifter
Posts: 39
Joined: Fri Jan 06, 2023 12:07 pm
Location: UK
Occupation: coder

Re: CASCADE (1982)

Post by orac81 »

The strategy for finding a computer move is very simple: A loop counts the 3 letters under each ball, the letter with the most balls above is played. The same method could also work by scanning the screen for ball characters.
By the way keeping var for lowest/highest ball could speed up those scans.
For a later PC version I calculate the exact result of removing each letter in ram, and play the one that results in the highest score. Doing that on a Vic would probably need machine code (or at least compiled basic).
wimoos
Vic 20 Afficionado
Posts: 360
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: CASCADE (1982)

Post by wimoos »

HI orac81,

I brought it down to 23 lines so far, 1224 bytes.
I removed the sort routine but kept the array. I refill the array, by scraping the screen, bottom to top (see lines 9 and 10).
That sorts automatically, as per your suggestion.
I optimized the scraping by keeping track of the highest and the lowest ball in the field.
Finally, I managed to abolish all subroutines :-)


Scraping again during calculating the best move will not help that much, I reckon. But the game is very well playable now !

Regards,

Wim.

Code: Select all

1 COLOR 8:PRINT "“    CASCADE":PRINT "   £££££££££":PRINT "A FREEWARE GAME":S=32:W=462
2 PRINT "(C)A.MILLETT 1982-2010":PRINT "Ÿ1 OR 2 ROWS OF BALLS ?":IF RND(-TI) K=81:£H=84
3 GET A$:IF A$="1" B=1 ELSE IF A$="2" B=2 ELSE .
4 PRINT "FULL ALPHABET ? Y/N":B$="YOU WIN.DRAWN! -I WIN.":F$="##’":£N=B*16:£M=91-22*B
5 GET A$:IF A$="Y" L=26 ELSE IF A$="N" L=14 ELSE .
6 N$=CHR$(64+L):PRINT "“   €ÒÆÀÃÄÅ££ÅÄÃÀÆÒ€":FOR I=1 TO 18:PRINT "§"SPC(16)"¥":NEXT 
7 PRINT "€€º"SPC(16)"Ì€€ 0"SPC(18)" 0’";:SPACE .,22,21,22,99,6:CURSOR 5:DIM R(£N),S(1)
8 FOR I=91 TO 443 STEP 22:FOR J=I TO I+15:COKE J,RND(L):NEXT:NEXT:SPACE 3,4-B,18,3,K,2
9 WHILE £N:B=£N:FOR I=£M TO £H:IF CEEK(I,S)=K:R(B)=I:B=B-1
10 NEXT:CURSOR 4:IF P THEN 12 ELSE PRINT "YOU REMOVE (A-"N$") ?  ’";:POKE 198,.
11 GET A$:IF A$<"A" . ELSE IF A$>N$ OR INSTR(K$,A$) . ELSE PRINT A$:A=ASC(A$)-64:GOTO 16
12 PRINT "HMM..":DIM Q(L):FOR I=1 TO £N:£Z=R(I)+22:B=1.5+(CEEK(£Z,S)=K)
13 FOR J=£Z-1 TO £Z+1:A=CEEK(J,S):IF A>L ELSE Q(A)=Q(A)+B
14 NEXT:NEXT:B=.:FOR I=1 TO L:IF Q(I)>B:B=Q(I):A=I
15 NEXT:ERASE Q:A$=CHR$(64+A):PRINT "I MOVE '"A$"'"
16 K$=K$+A$:FOR I=91 TO 443 STEP 22:FOR J=I TO I+15:IF CEEK(J,S)=A COKE J,S
17 NEXT:NEXT:SPACE .,.,21,.:CURSOR 2:£M=W:£H=.:FOR I=1 TO £N:£Z=R(I):WHILE £Z<W:£D=£Z+22
18 IF CEEK(£D,S)-S:B=SGN(RND(1)-.5):£D=£D+B:IF CEEK(£D,S)-S:£D=£D-2*B:IF CEEK(£D,S)-S QUIT 
19 COKE £Z,S:COKE £D,K:£Z=£D:WEND:IF A$:£M=MIN(£M,£Z):£H=MAX(£H,£Z):GOTO 22
20 FOR J=£Z TO W+2+17*P STEP SGN(P-.5):COKE J,K:SOUND .,1:COKE J,S:NEXT 
21 £N=£N-1:S(P)=S(P)+1:PRINT@ W+20*P,USING F$,S(P);
22 NEXT:P=1-P:WEND:PRINT "Ÿ"MID$(B$,9+8*SGN(S(1)-S(.)),8)" AGAIN (Y/N)?"
23 GET A$:IF A$="Y" RUN ELSE IF A$="N" ELSE .
Last edited by wimoos on Thu Feb 27, 2025 2:03 am, edited 23 times in total.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
wimoos
Vic 20 Afficionado
Posts: 360
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: CASCADE (1982)

Post by wimoos »

Hi orac81,

I must say that applying the last optimizations (keeping track of the highest and the lowest balls in the field, combined with scraping from bottom to top), result in a quick gameplay. At least in WimBasic.

The benefits of MIN/MAX, WHILE/WEND/QUIT, ERASE, SPACE, PRINT@, COKE/CEEK, INSTR and IF/THEN/ELSE make CASCADE a really good showcase for WimBasic !

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
User avatar
MrSterlingBS
Vic 20 Afficionado
Posts: 304
Joined: Tue Jan 31, 2023 2:56 am

Re: CASCADE (1982)

Post by MrSterlingBS »

Hi Wim,

I cannot download the WIMBasic extension anymore from the website.
The server is down?

BR
Sven
orac81
Vic 20 Drifter
Posts: 39
Joined: Fri Jan 06, 2023 12:07 pm
Location: UK
Occupation: coder

Re: CASCADE (1982)

Post by orac81 »

hi wim,

sorry i didn't reply sooner, i haven't had a chance to look at much v20 stuff recently. Your version is starting to look like one of those 10 line basic compy entries! Having the extensions means fewer line numbers are needed, if you allow for the max 250(ish) byte line length you could get there. (but you would need an external tokenizing prog).

By the way there is a pc dos version of cascade (with c source)
with lots of extra features (screen editor, save/load, negators, doublers, regeneration, dynamite, etc)

https://github.com/orac81/miniapples/ra ... cade20.zip

pc-cascade-screen.png
pc-cascade-screen.png (8.46 KiB) Viewed 2458 times
wimoos
Vic 20 Afficionado
Posts: 360
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Re: CASCADE (1982)

Post by wimoos »

Hi orac81,

I was well underway for the 10 lines competition, but I got stuck at 23 lines.
Supporting longer lines might help, but every IF/THEN/ELSE asks for another line number or 2 and there is at least 10 of those, so it would probable never qualify. And I think if I would brew it back to CBM Basic, I would probably need around 50 lines.

Nonetheless, it was a fun thing to do and it led to a neat result.

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
Post Reply