Page 1 of 4

Commodore FREE One Liners competition.

Posted: Tue Jan 08, 2013 9:01 pm
by Shaun.Bebbington
Commodore FREE is running a One Liners competition to link in with the publication of this book.

All Commodore 8-bit formats are welcome, and your program must be a maximum of two lines (so there are two categories: genuine one liners, and two liners). The two line thing is to compensate for the lack of characters per line in most dialects of Commodore BASIC. For instance, you can get a lot of logic into Sinclair BASIC and others in just one line of BASIC.

I've done an example disk to get everyone started. The full article should be published in the next issue of Commodore FREE - if not then the deadline might have to be moved. It's announced here to give you a head start :-)

Here are some rules:

* Machine code can be used if it's using a MC loader (DATA/FOR/POKE combo) – 0 sys 2059 which then runs an entire game written in assembly, C or some other compiled or assembled code is not a one liner for the purposes of this competition.

* For two-liners, the first line should be used for variables, functions and data, and the second should contain the logic.

* Please provide as much information as possible with your submissions, ie, what you were trying to achieve, and how far you think you got to achieving it; how you created your program (genuine one liner, BASIC 7 or whatever).

* Entries are welcome on all Commodore 8-bit formats in any known variant of BASIC – please save them to a D64 disk image along with your documentation. So, you could try something for the VIC-20, for instance.

* Have fun with it – remember, 640 bytes ought to be enough for anyone!

* The closing date is Friday 8th March 2013 at 11:59pm GMT. The winner will be announced in the next available issue of Commodore FREE, and through the various forums that we use. We will dig out some prizes for you.

Please feel free to ask any questions.

Posted: Sat Feb 09, 2013 11:56 am
by groepaz
"the first line should be used for variables, functions and data"
could you clearify what that does actually exclude? my code usually purely consists of variables, functions and data.

Posted: Sun Feb 10, 2013 1:19 am
by Kweepa
Hmm... 176 bytes of basic (on the vic) isn't a heck of a lot. :)

Posted: Wed Feb 20, 2013 4:31 pm
by Shaun.Bebbington
groepaz wrote:"the first line should be used for variables, functions and data"
could you clearify what that does actually exclude? my code usually purely consists of variables, functions and data.
It's just a rule of BASIC, isn't it? You can't declare a variable in line 200 to use in line 100 without a gosub or something. But yes, you are correct. Programs are basically variables, functions and data.

Regards,

Shaun.

Posted: Sun Mar 03, 2013 10:13 am
by groepaz
that doesnt answer in any way what exactly i am allowed to put into the first line and what not

Posted: Sun Mar 03, 2013 7:05 pm
by Kweepa
I suppose by functions he means function definitions.
So you can put anything except control logic and output in the first line.

Posted: Mon Mar 04, 2013 4:03 pm
by Witzo
I'm a little confused.
A two-liner on the VIC is 2x2x22=88 characters of basic. The length of a basic line is two screen lines, am I right?
And then a maximum of 640 bytes is mentioned, which would fit a lot longer program than in two lines of VIC basic.

I have a little idea, but I don't think it'll fit in two lines of VIC basic. But 640 bytes of basic code must be more than enough. So can I use that?

Posted: Mon Mar 04, 2013 4:30 pm
by Mike
The screen editor of the VIC-20 accepts up to four physical lines as a single logical line, i.e. 88 characters.

With abbreviations (for example, ? for PRINT, F SHIFT-O for FOR, N SHIFT-E for NEXT, etc., see the VIC User's manual), you can enter some more code into these four lines. When this line is LISTed again though, the abbreviations are expanded to the complete keywords. The line then spans more than four physical lines, and cannot be edited anymore as a whole (unless you retype it again in abbreviated form).

BASIC itself is not limited though to lines of just 88 characters, regardless whether typed in full or in abbreviated form. Rather, the interpreter accepts lines with up to 255 bytes in length, including the two-byte link pointer, two-byte line number, and the terminating null byte at the end of the line. Keywords of BASIC (the 'tokens') count for a single byte. Lines longer than this cannot be handled by the routine that relinks the lines when a program is loaded.

Such an over-length line can't be entered in quite the usual way, but - at least in principle - one could POKE it into memory by hand. Or use petcat.

The 640 bytes note is presumably just a joke referring to an old saying attributed to Bill Gates. :wink:

Posted: Mon Mar 04, 2013 11:23 pm
by Kweepa
Hmm... I had a go, but I couldn't write much in less than 256 bytes.
So here's my 256 byte attempt. ZXOK to move, P to bomb.
http://www.kweepa.com/step/vic20/games/twofiftysix.prg

Posted: Tue Mar 05, 2013 3:33 am
by Witzo
Thanks Mike. Two basic lines of four physical lines each, then that's what I'll be aiming for.
I'll disregard Shaun.Bebbington's remark about the 640 bytes.

Posted: Wed Mar 06, 2013 4:25 am
by Shaun.Bebbington
Witzo wrote:Thanks Mike. Two basic lines of four physical lines each, then that's what I'll be aiming for.
I'll disregard Shaun.Bebbington's remark about the 640 bytes.
It's a reference to Bill Gate's supposed claim that 640 Kilobytes ought to be enough for anyone (that's only part of what he said, as I recall). But if you've written something in *less than* 640 bytes then 640 bytes *was enough* for your one-liner as you've got space to spare.

So far, there has been one disqualification - it was a program listing that had around 30 lines.

Anyway, the deadline is close, so feel free to submit your entries.

Regards,

Shaun.

Posted: Wed Mar 06, 2013 1:14 pm
by Shaun.Bebbington
Kweepa wrote:Hmm... I had a go, but I couldn't write much in less than 256 bytes.
So here's my 256 byte attempt. ZXOK to move, P to bomb.
http://www.kweepa.com/step/vic20/games/twofiftysix.prg
Very good, but I count five lines of BASIC.

Regards,

Shaun.

Posted: Wed Mar 06, 2013 1:57 pm
by Leeeeee
I count six, but lines 1 through 4 can be turned onto one long FOR .. NEXT loop with line 5 tagged on the end.

Entering the thus modified very long second line may be a bit of a problem though.

Lee.

Posted: Wed Mar 06, 2013 10:28 pm
by Jeff-20
I really wanted to do this, but I haven't had time to program in a while. The deadline is just too close.

Posted: Wed Mar 06, 2013 11:53 pm
by Kweepa
Shaun.Bebbington wrote: Very good, but I count five lines of BASIC.
Great! We can hide a line by numbering it 0! :)

It wasn't really an attempt to enter, since I think the rules are too strict for the VIC, although as Leeeeeee says the same game could theoretically be entered as two lines. I'd prefer a byte count. What is the C64 line limit? Is it 4x40=160 'bytes'?