VIC FRUZZLE

This is an old mini-puzzle game with 6 frogs and 7 pillars

GOAL

You want to reach the inverse of the initial configuration of the frogs.

Constraints:

Frogs can only jump by 1 or 2 steps.

Frogs can only jump onto the (sole) empty pillar.

CONTROLS:

Choose next frog to move with A B C D E F G

Reset the game with X

EXPANDED CODE (CBM Prg Studio syntax)

```0v=36878:t=30720:pokev+1,110:b=7816:c=b+12:z=65:q=.:g=160:dimc(g):data17,85:pokev-9,255
2s=3:fori=.to3:p(i)=1:p(6-i)=0:next:c(0)=3:c(1)=5:print"{clear}{reverse on}  {cyan}{reverse off}@{green}a{reverse on} {white}vic {green}fruzzle {cyan}{reverse off}@{green}a"
3h=42:q=.:p(s)=g:print"{down*18}{reverse on}{yellow}    use {white}abcdefg{down}"spc(11)"{yellow}reset with {white}x"
4e=22:fori=.to6:poke8036+i*2,i+129:forj=1to8:pokeb+e*j+i*2,230:pokeb+e*j+i*2+t,7:next:next
5fori=.to6:pokeb+t+i*2,c(p(i)):pokeb+i*2,p(i):next:prints\$;q;:d\$="{down}done!":data170,136,,127,,
6geta\$:on-(a\$="")goto6:f=asc(a\$)-z:on-(f=23)goto2:on-(f<.orf>6orf=sors<.ors>6)goto6:data98
7x=peek(b+f*2):on-((x=1)and(((s-f)>2)or(f>s)))goto6:on-((x=0)and(((f-s)>2)or(s>f)))goto6
8pokeb+f*2,g:q=q+1:j=b+f*2-22-sgn(f-s):pokej+t,c(x):pokej,x:pokev,9:pokev,0:p(s)=x:p(f)=g
9k=tan(9.9):s=f:pokej,g:on-(p(4)*p(5)*p(6)<>1orp(3)<2)goto5:print"{home}"spc(9)d\$:pokev+1,h:goto5```

MAIN VARIABLES

v: sound volume register used to produce a click sound by bit-banging. v+1 is used to set screen colors. v-9 is used to enable user defined characters

b: base position on the screen ram

s: index of the empty slow.

p(i): value of the i-th slow

c(x): color for character x

q: number of steps

f: index for the pressed key

g: inverted space character (which is mapped to the normal space character)

EXPLAINED CODE

0

// Initialize variables v (video register), t (color ram offset wrt to screen ram)

v=36878:t=30720:

// Set screen color to blue

pokev+1,110:

// Initial several variables

b=7816:c=b+12:z=65:q=.:g=160:dimc(g):data17,85:

// Set first 64 characters as user defined colors and set reversed characters to map normal characters.

pokev-9,255

1

// Initial s\$

s\$="{home}{down*3}{reverse on}        {white}step{yellow}":

// Some graphics data

data17,,254,,,70,136

2

// Set empty slot at middle slot (3)

s=3:

// Set values of the slots

fori=.to3:p(i)=1:p(6-i)=0:next:

// Set colors of different shapes (0->green, 1->cyan)

c(0)=3:c(1)=5:

// Display title

print"{clear}{reverse on}  {cyan}{reverse off}@{green}a{reverse on} {white}vic {green}fruzzle {cyan}{reverse off}@{green}a"

3

// Initial variables

h=42:

// Initial number of steps = 0

q=.:

// Empty slot is filled with space bar (g=160 is the inverted space bar which is now mapped to rom character for the space bar)

p(s)=g:

// Display instructions

print"{down*18}{reverse on}{yellow}    use {white}abcdefg{down}"spc(11)"{yellow}reset with {white}x"

4

// Initialize e (number of columns)

e=22:

// Display letter ABCDEFG

fori=.to6:poke8036+i*2,i+129:

// Display poles

forj=1to8:pokeb+e*j+i*2,230:pokeb+e*j+i*2+t,7:next:next

5

// Display display frog

fori=.to6:pokeb+t+i*2,c(p(i)):pokeb+i*2,p(i):next:

// Display number of steps

prints\$;q;:

// Initialize d\$

d\$="{down}done!":

// Some graphics data

data170,136,,127,,

6

// Read and wait for an input from keyboard. If input key is X then go back to line 2.

// If input key is invalid, then restart from the beginning of this line.

geta\$:on-(a\$="")goto6:f=asc(a\$)-z:on-(f=23)goto2:on-(f<.orf>6orf=sors<.ors>6)goto6:

// Graphics data

data98

7

// Read value in stored location

x=peek(b+f*2):

// If movement is in bad direction go back to line 6

on-((x=1)and(((s-f)>2)or(f>s)))goto6:on-((x=0)and(((f-s)>2)or(s>f)))goto6

8

// Delete frog. Increase steps.

pokeb+f*2,g:q=q+1:

//Display jumping frog.

j=b+f*2-22-sgn(f-s):pokej+t,c(x):pokej,x:

// Click sound.

pokev,9:pokev,0:

// Update slot values.

p(s)=x:p(f)=g

9

// Short pause (tan is used for this). Update empty slot index s. Display frog at new position.

k=tan(9.9):s=f:pokej,g:

// Check non-winning condition. If yes, go back to line 5

on-(p(4)*p(5)*p(6)<>1orp(3)<2)goto5:

// Otherwise, display winning message; change screen color and go back to line 5

print"{home}"spc(9)d\$:pokev+1,h:goto5

 Status Released Author BASIC 10Liner Genre Puzzle Tags 8-Bit, basic, basic10liner, Commodore 64

## Install instructions

Use any VIC 20 emulator such as for example Vice and use the .PRG or .D64 file.

You can load the game into a real VIC 20 by using many methods such as an SD2IEC card reader to load the .PRG or .D64 file.

Remark: If not already done, you must set the emulator to emulate an UNEXPANDED VIC 20.