20 Line Contest: Egg Salad

Discussion, Reviews & High-scores

Moderator: Moderators

User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

20 Line Contest: Egg Salad

Post by Jeff-20 »

Here is my entry.

Egg Salad
http://sleepingelephant.com/denial/EGGSALAD.PRG

You need a Joystick and Unexpanded memory. I, of course, prefer that you play it on the actual VIC 20 :lol:

You can comment on the program in this thread. I look forward to seeing individual threads for each entry before we start voting. This should give us time to properly inspect and review them.
Egg Salad Instructions:

You are a paranoid mouse in a burning house looking for a flag during an air raid. Yes. Fortunately you have a helmet and excellent hearing to help you.

Use your keen hearing to locate the flag. High tones will let you know when you are closer. The fire will not hurt you, but it will limit your movement. The timer on the edge of the screen will give you about 30 seconds to achieve this task for every round.

Whenever a bomb drops you must put on your safety helmet by pressing the fire button. If you are caught without a helmet, you will expire. Release the button to resume your search. The most flags recovered is 12.
Last edited by Jeff-20 on Wed Jun 08, 2005 8:16 pm, edited 1 time in total.
High Scores, Links, and Jeff's Basic Games page.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I can't seem to get the screen to properly reposition in emulation! I like to use screen movement effects.

I think there may also be problems on PAL systems.
:cry:
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Yes, NTSC and PAL use different values on screen positioning. Based on how it is emulated in VICE, I would say that:

Code: Select all

min  def  max
<-----|-----> 36864 (based on a 22 column screen)
6    12    18 PAL
1     5     7 NTSC

min  def  max
<-----|-----> 36865 (based on a 23 row screen)
14   38    64 PAL 
4    25    39 NTSC
which at least for PAL corresponds quite well with reality, a little depending on how versatile TV or monitor you have.
Anders Carlsson

Image Image Image Image Image
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Good thing it is a basic program. If anyone happens to be running it on a real vic, you can make adjustments to the program in line 11.

I used location 36881 to adjust screen position.
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Ok, 36881 is one of the "evil" mirror registers (36880-36895 supposedly do the same thing as 36864-36879, but may have negative side effects from what I remember).
Anders Carlsson

Image Image Image Image Image
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Very nice game! The screen "bug" doesn't bother me much. Everything is still visible...

/Anders
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I forgot to post the program for inspection. (If anyone cares)
1 PRINT "{CLR}{RVS}2004 JDANIELS": FORT=1TO48: READI: POKE7167+T,I: POKE7423+T,0: NEXT: U=7177: GOTO15
2 POKED,255: M=PEEK(P): J=Y: IF(MAND4)=.THENJ=J-22
3 IF(MAND8)=.THENJ=J+22
4 POKES-4,0: IF(MAND16)=.THENJ=J-1
5 POKED,127: IF(PEEK(Q)AND128)=.THENJ=J+1
6 IFPEEK(J)>2THENPOKEY,33: Y=J: POKEY,2: IFF>14THENC$="TIME UP!": GOTO12
7 V=V+1AND7: ON-(Y=W)GOTO14: IFV=1THENPOKES-4,250-ABS(Y-W)/3: F=F+.5: POKE7765+INT(F)*22,32
8 POKEU,12-PEEK(U): IFRND(0)>1-G/10THENGOSUB13: IFPEEK(X)=33THENPOKEX+30720,7:POKEX,1
9 ON-(RND(0)>.02)GOTO2: M=230: POKES-4,0: C$="BOMBED!": POKES,10: Z=25
10 POKES-3,M: M=M-G: POKEY,2-(PEEK(P)<99): ON-(M>120)GOTO10: POKES-3,0: POKES-2,148: POKES,42
11 FORT=1TO59: POKE36881,Z: Z=55-Z: NEXT: POKES,8; POKES-2,0: IFPEEK(Y)>2THENWAITP,32: GOTO6
12 PRINT"{DOWN}{2 RIGHT}{RVS}{CYN}"C$: FORT=UTOC: POKET,0: NEXT: POKEW,4: POKEY+30720,2: WAITP,32: WAITP,32,32: RUN
13 X=7770+INT(RND(1)*302): RETURN
14 FORT=0TO9: POKEY,6-PEEK(Y): POKES-5,220-PEEK(S-5): FORI=15TO1STEP-.4: POKES-1,I: NEXTI,T
15 A$="{BLU}{2 RIGHT}{16 @'S}": B$="{2 RIGHT}{BLU}@{WHT}{14 !'S}{BLU}@{RIGHT}{GRN}E": S=36879: POKES,8: POKES-10,255
16 PRINT"{CLR}{2 DOWN}{2 RIGHT}{RVS}{YEL}EGG SALAD{4 RIGHT}{RVS}{CYN}"G+1: PRINTA$: FORT=1TO14: PRINTB$: NEXT: PRINTA$: F=0: Y=7910
17 GOSUB13: ON-(PEEK(X)><33)GOTO17: W=X: POKEW,32: POKEY,2: G=G+1: FORT=2TO8: POKE38630,9-T
18 POKES-3,240-T*15: FORI=0TO15STEP.5: POKES-1,0: NEXTI,T: C=U+6: D=37154: Q=D-2: P=D-3: GOTO2
19 DATA223,223,223,0,251,251,251,0,0,8,12,12,30,30,30,12,34,119,127,42,42,62,28,8
20 DATA28,62,62,127,0,42,62,28,248,142,138,138,250,158,128,128,0,24,60,60,60,60,60,24
I used the compute magazine style for key combos. I've never been very good at math so I am looking for ways to make this code more efficient.
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

I think you can save two lines by changing lines 2-3 and 4-5 to:

2 POKE D,255:M=PEEK(P):J=Y+(NOT MAND4)*22 - (NOT MAND8)*22
4 POKE S-4,0:J=J+(NOT MAND 16) - (NOT PEEK(Q) AND 128):POKE D,127

I dunno if the spaces in NOT M AND can be left out, but they don't take whole lines anyway. If you want, you could combine the two assignments:

J=Y+(NOT MAND4)*22 - (NOT MAND8)*22 + (NOT MAND16) - (NOT PEEK(Q)AND128)

I guess you count on the delay between POKE D,255 and POKE D,127 to make it flash? You could try to see if this assignment statement will make it faster, slower or equal.

Otherwise, I see that you utilized some of my tricks (or you knew from before about the ON .. GOTO).
Anders Carlsson

Image Image Image Image Image
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I rely on the ON ... GOTO statement.

I remember as a child being really excited when I discovered it. It greatly improves the efficiency of BASIC.

YOur suggestions are great. I am not much of a mathematician... It makes sense. I think I need to poke d, 127 to read the final joy position. THe order of the suggested line 4 might be problematic.
High Scores, Links, and Jeff's Basic Games page.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Ah, sorry. I never bothered to find out where variable D pointed (37154). However, I think you only have to POKE 37154,127 once in order to read direction "right" from the joystick, and then restore it to 255 when you exit the program or wish to use the keyboard (upper row) for input.

Thus, you should really POKE D,127 before reading all the joystick directions and then restore it afterwards if you want a completely fool-proof behavior when the program ends.

Breaking into the program in the middle of reading the value will not be solved unless you go into ML details and add a patch to the break vector, but that is way beyond the 20 line Basic compo. :lol:
Anders Carlsson

Image Image Image Image Image
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

I played your game again yesterday, and when you have learned the tricks how to play it, I think it's way too easy!!! I went on to level 150 just to be sure that I would own the all time high score forever! ;)

/Anders
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Wow! I am so excited someone played my game!

There is a cheat to make it easy, but no one should go beyond level 20 because the reaction time for pressing the fire button is much too small! You should be bombed immediately. Did you figure out the trick?
High Scores, Links, and Jeff's Basic Games page.
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

I don't know if it's the trick you think about, but I just held down fire all the time to prevent me from incomming bombs and briefly released it just after a bomb (to make the game continue).

/Anders
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

Cheater cheater cheater! :P ha ha ha
High Scores, Links, and Jeff's Basic Games page.
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Is it cheating to use the joystick while playing a joystick controlled game? :roll: ;)

/Anders
Post Reply