Commodore FREE One Liners competition.

Basic and Machine Language

Moderator: Moderators

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

Post by Jeff-20 »

Kweepa wrote:Wow, Jeff, that's almost too fast!
Also, you managed to fit it into two standard BASIC lines. Kudos!
Thanks! It's kind of lame, but I'm hoping there won't be many games entered. I manage to follow the rules and keep variables in one line and the whole game in another line.
High Scores, Links, and Jeff's Basic Games page.
groepaz
Vic 20 Scientist
Posts: 1180
Joined: Wed Aug 25, 2010 5:30 pm

Post by groepaz »

Code: Select all

0 b=36864: poke b,2: poke b+1,75: poke b+2,162: poke b+3,130: print"{CLEAR}":a$="                     commodore free 
 1 a$=right$(a$,44)+left$(a$,1): print"{HOME}" a$ " ":for i=0 to 99:next:poke 646, 2+rnd(.)*6: goto 1
if this is a valid entry, then your rules are broken.
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post by Witzo »

Shaun.Bebbington wrote:
Witzo wrote:I'll study that!
But I won't have time for it before the deadline, so my submission will have to stand, clumsily, as it was.
Now that the competition is over, here is your listing which will change the colours of the text whilst it's scrolling:

Code: Select all

0 b=36864: poke b,2: poke b+1,75: poke b+2,162: poke b+3,130: print"{CLEAR}":a$="                     commodore free
1 a$=right$(a$,44)+left$(a$,1): print"{HOME}" a$ " ":for i=0 to 99:next:poke 646, 2+rnd(.)*6: goto 1
I've added some spaces to make it more readable.

You'd type it into a real VIC-20 like this:
Image
The scroll logic reads the string variable a$ from right to left and adds the first character from left to right to the end of the string. So, each pass will move the characters once from right to left, creating the scroll.

The random colour generator basically will pick a colour from 2 to 7 using the rnd command and poke that to location 646. As the screen colour is white (colour 1), that is avoided so that the text doesn't disappear from time to time.

There are much more knowledgeable people here who will put the whole code into just one line. I don't yet know of these tricks, but would like to learn such feats.

Regards,

Shaun.
It took me a while to wrap my head around stepping through the A$ without a counter; rolling a character to the other end, brilliant!
So now I know three ways of making/moving through a list: by index, as a stack and by rolling around.

Unfortunately, I lose line 0 when I type it as in the screenshot, in Vice. Tried it with line zero with its line number as 1 too, same problem.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Witzo wrote:Unfortunately, I lose line 0 when I type it as in the screenshot, in Vice.
That has nothing to do with VICE, this also happens on a real VIC-20: the cursor must be within one of the physical lines of a logical line to enter that logical line into memory when RETURN is pressed.

I suppose you pressed RETURN when the cursor was positioned in the 'gap' between lines 0 and 1. In that case, that gap between those two listed lines is a physical line, that isn't linked to the lines above, because there are already the maximum of four physical lines linked together. The screen editor then only enters the empty line, which of course does nothing.

You can still move the cursor up into the line, and RETURN then enters it as expected.
User avatar
vicist
Vic 20 Afficionado
Posts: 352
Joined: Tue Oct 09, 2012 5:26 am
Location: Sheffield, UK

Post by vicist »

All these entries are brilliant - short, simple, but very entertaining :)

Congratulations.
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post by Witzo »

Mike wrote:You can still move the cursor up into the line, and RETURN then enters it as expected.
Now it works. Thanks!
Shaun.Bebbington
Vic 20 Dabbler
Posts: 78
Joined: Fri Jan 20, 2006 3:41 am

Post by Shaun.Bebbington »

Witzo wrote:
Mike wrote:You can still move the cursor up into the line, and RETURN then enters it as expected.
Now it works. Thanks!
Technically, you don't need to add all of the spaces to the beginning of the string A$ as the program will do that for you (as long as the first character in the string is a space). But this takes a bit longer when you initially run the program.

Regards,

Shaun.
Without context, we are only data.
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

I didn't really crunch my lines. I wish I did. I could have added more features. :(

FYI:

Code: Select all

1 A$="{yellow}{shift Q}{blue}":B$="{red}{cmd L}":A=197:B=7734:C=22:D=16:E=29:F=37:G=.1:H=10:I=80:POKE36879,10:PRINT"{clr}" 
2 POKEB,C:PRINTINT(H)B$SPC(RND(1)*D)A$:Z=PEEK(A):B=B+(Z=E)-(Z=F):H=H+G:IFPEEK(B)<ITHEN2 
High Scores, Links, and Jeff's Basic Games page.
User avatar
Witzo
Vic 20 Afficionado
Posts: 381
Joined: Thu Dec 01, 2011 9:14 am
Location: The Hague

Post by Witzo »

When and where can we read the results of this compo?
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

I got an e-mail from Shaun Bebbington, he has finished the evaluation of the entries. The results are going to be featured in Commodore Free soon (as #72 has just been released without the results, that hopefully means in the next issue).
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

My game got trashed, but I protest! I followed the spirit of the rules and feel proud to have pulled off some form of working game! :lol: I seemed like most had to outsmart the rules. I think one really needs to be more familiar with the VIC to be impressed by anything done in one line.
High Scores, Links, and Jeff's Basic Games page.
Post Reply