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.Kweepa wrote:Wow, Jeff, that's almost too fast!
Also, you managed to fit it into two standard BASIC lines. Kudos!
Commodore FREE One Liners competition.
Moderator: Moderators
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
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!Shaun.Bebbington wrote:Now that the competition is over, here is your listing which will change the colours of the text whilst it's scrolling: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.I've added some spaces to make it more readable.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
You'd type it into a real VIC-20 like this:
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.
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.
- Mike
- Herr VC
- Posts: 5131
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
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.Witzo wrote:Unfortunately, I lose line 0 when I type it as in the screenshot, in Vice.
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.
-
- Vic 20 Dabbler
- Posts: 78
- Joined: Fri Jan 20, 2006 3:41 am
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.Witzo wrote:Now it works. Thanks!Mike wrote:You can still move the cursor up into the line, and RETURN then enters it as expected.
Regards,
Shaun.
Without context, we are only data.
I didn't really crunch my lines. I wish I did. I could have added more features. 
FYI:

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