I've made a one liner - called Line

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas »

Replace this:

Code: Select all

LET k=4*(INKEY$<>"")-2
with this:

Code: Select all

LET k=2-4*(INKEY$="")
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas »

Replace this:

Code: Select all

FOR n=-e TO l*3: PRINT AT RND*17+2,RND*25+4;"*": BEEP .0001,60: NEXT n: INK 8: LET y=85: PLOT 8,y
with this:

Code: Select all

FOR y=84-l*3-e TO 84: PRINT AT RND*17+2,RND*25+4;"*": BEEP .0001,60: NEXT y: INK 8: PLOT 8,y
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas »

patters wrote: Fri Aug 02, 2019 10:34 pm Great, thanks Einar. I do prefer one pixel per level, and shorter too - who can argue with that. Thanks for all the help, it's been very educational.
I shall upload the finished game to https://patters.itch.io/line, and update all the screenshots, credits, etc.
You are welcome!

Can we have your permission to this program to ZXDB and host the file at other free websites too?
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas »

patters wrote: Fri Aug 02, 2019 10:34 pm Great, thanks Einar. I do prefer one pixel per level, and shorter too - who can argue with that. Thanks for all the help, it's been very educational.
I shall upload the finished game to https://patters.itch.io/line, and update all the screenshots, credits, etc.
You are welcome!

Can we have your permission to this program to ZXDB and host the file at other free websites too?
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas »

Here's just one more idea.

Since you have plenty of free space now, why don't you could play a short BEEP sequence before the game starts?

If you add a FOR/NEXT with variable 'l', then you can remove LET l=1 from the beginning, and also replace LET l=l+1 with NEXT l.

I mean, replace this:

Code: Select all

1 LET l=1: ... NEXT x: LET l=l+1: ...
with this:

Code: Select all

1 FOR l=-9 TO 0: BEEP .01,l+9: BEEP .01, l: NEXT l: ... NEXT x: NEXT l: ...
Give it a try :)
User avatar
patters
Manic Miner
Posts: 467
Joined: Thu Apr 11, 2019 1:06 am

Re: I've made a one liner - called Line

Post by patters »

Einar Saukas wrote: Fri Aug 02, 2019 10:55 pm You are welcome!

Can we have your permission to this program to ZXDB and host the file at other free websites too?
I'd prefer to confine it to itch.io at first because it offers some useful analytics and logging, then we can add it to ZXDB after a few weeks, like I did with Artillery.
User avatar
patters
Manic Miner
Posts: 467
Joined: Thu Apr 11, 2019 1:06 am

Re: I've made a one liner - called Line

Post by patters »

Einar Saukas wrote: Fri Aug 02, 2019 11:08 pm

Code: Select all

1 LET l=1: ... NEXT x: LET l=l+1: ...
with this:

Code: Select all

1 FOR l=-9 TO 0: BEEP .01,l+9: BEEP .01, l: NEXT l: ... NEXT x: NEXT l: ...
Give it a try :)
Hmm. I just tried that, but it seems to increment the level counter by two on each level completion which is odd, given that I tested something similar in BASIC out of curiosity just before implementing. I did definitely remove the LET l=l+1
EDIT - nevermind - it was my POKE jumping to the wrong statement number and hitting the first NEXT l again.
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas »

patters wrote: Sat Aug 03, 2019 12:02 am
Einar Saukas wrote: Fri Aug 02, 2019 10:55 pm You are welcome!

Can we have your permission to this program to ZXDB and host the file at other free websites too?
I'd prefer to confine it to itch.io at first because it offers some useful analytics and logging, then we can add it to ZXDB after a few weeks, like I did with Artillery.
Sure, no problem!

Thanks for allowing me to participate here, it was really fun! :)
User avatar
patters
Manic Miner
Posts: 467
Joined: Thu Apr 11, 2019 1:06 am

Re: I've made a one liner - called Line

Post by patters »

Final listing below. Einar, before I update my itch.io page, is there a better way to write that BEEP in the second statement?

Code: Select all

1 FOR l=-6 TO 0:
BEEP .02,(l+6)*5-10:
NEXT l:
FOR d=1 TO 3:
POKE 23693,65:
BORDER 0:
CLS :
INK 2:
FOR e=19 TO 20:
PLOT 268-e,69+l/2:
DRAW 0,e-82.1-l/2:
DRAW e+e-286,0:
DRAW 0,163:
DRAW 247,0:
DRAW 0,-e-44-l/2:
NEXT e:
PRINT INK 3;"LEVEL ";l;AT 20,28+d;"//"(d TO ):
INK RND*4+3.5:
FOR y=84-l*3-e TO 84:
PRINT AT RND*17+2,RND*25+4;"*":
BEEP .0001,60:
NEXT y:
INK 8:
PLOT 8,y:
FOR x=5 TO 124:
LET k=2-4*(INKEY$=""):
LET y=y+k:
POKE 23620*POINT (x+x,y),35:
DRAW 2,k:
NEXT x:
NEXT l:
BEEP .01,20:
BEEP .01,30:
POKE 23620,5+32*(l=e):
BEEP .2,-20:
NEXT d:
DIM a$(32):
INK 1+5*(l=e):
FOR n=0 TO 10:
PRINT AT n,0; OVER 1;a$;AT e-n,0;a$:
NEXT n:
PRINT AT 10,n; INK 7;"GAME OVER" AND l<e;"WELL DONE" AND l=e
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: I've made a one liner - called Line

Post by Einar Saukas »

Code: Select all

BEEP .02,l*5+20
User avatar
patters
Manic Miner
Posts: 467
Joined: Thu Apr 11, 2019 1:06 am

Re: I've made a one liner - called Line

Post by patters »

Thanks. Sometimes I can't see the wood for the trees.
Einar Saukas wrote: Sat Aug 03, 2019 1:54 am Thanks for allowing me to participate here, it was really fun! :)
Likewise, it was a good experience and I've learned many new techniques. It's an interesting form the one liner - a bit like the programming equivalent of writing a haiku :)
User avatar
patters
Manic Miner
Posts: 467
Joined: Thu Apr 11, 2019 1:06 am

Re: I've made a one liner - called Line

Post by patters »

I have updated https://patters.itch.io/line with the latest version.
Dr beep
Manic Miner
Posts: 375
Joined: Mon Oct 01, 2018 8:53 pm

Re: I've made a one liner - called Line

Post by Dr beep »

Although much shorter(only 6 pages), this topic brought me back to the OTHELLO oneliner development on WoS.
Post Reply