Snake 1K

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
dr beep
Posts: 2093
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Snake 1K

Post by dr beep »

I think it is possible to move a charachter over a fullsize screen in 1K. A few 100 bytes left for display and movement.
Snake in 1K is something different. You need to keep track of the positions used by the snake which would be at least 2x size of screen when snake is almost full sized.

I am thinking of coding a Snake with the largest screen possiblle in 1K.
Half sized seems possible. According to above statement this would mean that I would need at least 3 halfscreens.
1 for the display
1 store used x-positions
1 store used y-positions

This would be (768)/2*3 +25 = 1177 bytes without any program.
However. Instead of using a normal lowres screen I can use defined routine that will use bit 7 to invert (and indicate) the snake. Target to reach is hires data block like in Othello. In rest of the linebuffers I can store the x-positions. The y-positions are stored in the next samesized databuffer (or x/y per position together). This will only need 768 bytes for data and screen.
So rest of program free for coding.

Just a wild idea.
dr beep
Posts: 2093
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Snake 1K

Post by dr beep »

I have almost a 2/3 screen (16x30 char).
Still 300 bytes free.

Screen will have lowres view, but I only need the memory to stack the tail of the snake.
Gameplay will be easy. Just keep on moving while snake keeps growing in time.
How large can the snake get. Max. size reached makes you a winner.

Screen will be inverted so you can see the side of the screen.
dr beep
Posts: 2093
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Snake 1K

Post by dr beep »

Well, the storage of the snake could even be easier. Each screenposition also holds a pointer to the previous part of the tail
In fact I can add more lines to the gameplay, but I will keep it as it is.

So SNAKE 1K is a fact.

Controls:
QWERT = up
ASDFG = down
12345 = left
67890 = right
Newline = start game

Just keep moving.... each 32 steps the snake grows a position.
The snake is traced from head to tail to erase the tail, but not after 32 steps.

The graphics are lowres, but displayroutine of hires is used so each position can not only contain the screencharacter, but also information
about the tail. Otherwise it could never fit in 1K with a large tail.

Video: https://youtu.be/hPCuUBli7Uk
snake.p
(900 Bytes) Downloaded 134 times
snake.png
snake.png (46.38 KiB) Viewed 1730 times
dr beep
Posts: 2093
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Snake 1K

Post by dr beep »

I have added a nice hires snake passing by under the black screen.
Each pass adds a block to the snake.
snake.p
(942 Bytes) Downloaded 137 times
Post Reply