Snake
Moderator: Moderators
- joshuadenmark
- Big Mover
- Posts: 1180
- Joined: Sat Oct 23, 2010 11:32 am
- Location: Denmark
- Occupation: Old and tired
Re: Snake
Thanks
will give this a good try.

Kind regards, Peter.
____________________________________________________
In need of a wiki logon - PM me
____________________________________________________
In need of a wiki logon - PM me
Re: Snake
I got to 138, but usually when I finally die it doesn't feel like it's really my fault.
I realise it's just a programming exercise but if I had a comment for it I would say the controls are not responsive enough. I will be going straight down the screen then I'll press 'right' then 'up' but the right doesn't respond so it eats itself and dies.

I realise it's just a programming exercise but if I had a comment for it I would say the controls are not responsive enough. I will be going straight down the screen then I'll press 'right' then 'up' but the right doesn't respond so it eats itself and dies.

Re: Snake
It's written in BASIC and there is quite a bit going on in-between key-presses so it's never going to be super responsive.
However, I have looked at the way the key-presses / joystick detection works and tried a different approach.
See if this is any better.
EDIT: This is the same file now as the original post.
However, I have looked at the way the key-presses / joystick detection works and tried a different approach.
See if this is any better.
EDIT: This is the same file now as the original post.
Last edited by vicist on Sun Mar 17, 2019 6:47 am, edited 1 time in total.
Re: Snake
Hm, my new attempts are worse that my previous, either with joystick or, more controlled, with keys.
I held a direction too long and ran into a wall while winding around to get the long tail out of the way
I held a direction too long and ran into a wall while winding around to get the long tail out of the way

-
- Vic 20 Afficionado
- Posts: 360
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Re: Snake
I brought it down to a little over 2k bytes.
Regards,
Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
-
- Vic 20 Afficionado
- Posts: 360
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Re: Snake
I applied these to calculate the next memory location for PEEK and POKE.
This can also be done in vanilla Basic and saves processing programlines and searching for variables.
Code: Select all
DEFFNP(X)=X+300*(X=1020)-157*(X=767)
DEFFNQ(X)=X+251*(X=924)-108*(X=720)
Another one is the line where variable B is compared to the body or the tail of the snake or the border. These three comparisons can be changed to one, namely: B<99 . This also saves a lot of processing.
Regards,
Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic