Basic and Machine Language
Moderator: Moderators
RobertBe
Vic 20 Elite
Posts: 2377 Joined: Sat Jul 14, 2007 2:48 pm
Post
by RobertBe » Thu Mar 07, 2013 12:49 am
Kweepa wrote: I'd prefer a byte count. What is the C64 line limit? Is it 4x40=160 'bytes'?
BASIC will let you use up to 255 bytes per line.
Truly,
Robert Bernardo
Fresno Commodore User Group
http://videocam.net.au/fcug
Shaun.Bebbington
Vic 20 Dabbler
Posts: 78 Joined: Fri Jan 20, 2006 3:41 am
Post
by Shaun.Bebbington » Thu Mar 07, 2013 4:18 am
Kweepa wrote:
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'?
The reason for the competition is that it presents an interesting challenge, especially as BASIC 2 does not have else if conditions, nor while loops (although you can use a FOR loop to the same effect).
Regardless of the limits, there have been some amazing results, although no one has entered anything for the VIC-20, PET or C16/+4 yet. There is still time, more that 24 hours at the time of writing this
Regards,
Shaun.
Without context, we are only data.
Leeeeee
soldering master
Posts: 396 Joined: Fri Apr 23, 2004 8:14 am
Post
by Leeeeee » Thu Mar 07, 2013 8:01 am
I've made Kweepa's program as a two liner available
here .
Here's the listing..
Code: Select all
0 X=0:Y=11:PRINT" L"L"B"B:FORI=1TO505:PRINTCHR$(32-3*(RND(1)<.3+L/44));:NEXT
1 FORA=-1TO0:O=7680+22*Y+X:POKEO,94:K=PEEK(197):X=X+(K=33ANDX>0ANDPEEK(O-1)=32)-(K=26ANDPEEK(O+1)=32):Y=Y+(K=52ANDY>0ANDPEEK(O-22)=32)-(K=44ANDY<22ANDPEEK(O+22)=32):POKEO-(K=13ANDB>0),32:B=B+(K=13):A=X<21:NEXT:L=L+1:B=B+1:GOTO0
Lee.
pallas
Vic 20 Devotee
Posts: 212 Joined: Mon Dec 24, 2012 2:38 am
Post
by pallas » Thu Mar 07, 2013 8:11 am
isn't 0 the default for GOTO? so you can remove the last character.
Leeeeee
soldering master
Posts: 396 Joined: Fri Apr 23, 2004 8:14 am
Post
by Leeeeee » Thu Mar 07, 2013 9:25 am
Even using abbreviated keywords line 1 is about 120 characters too long to enter but yes you could lose that 0 from the end.
Lee.
Shaun.Bebbington
Vic 20 Dabbler
Posts: 78 Joined: Fri Jan 20, 2006 3:41 am
Post
by Shaun.Bebbington » Thu Mar 07, 2013 9:29 am
Leeeeee wrote: Even using abbreviated keywords line 1 is about 120 characters too long to enter but yes you could lose that 0 from the end.
Lee.
Great, thanks for that!
If you want to enter, please send the prg to Nigel Parker before the deadline, along with an explanation of how the program works. Obviously, Kweepa will have to take the credit for the initial listing and you obfuscated it into two lines of BASIC 2 for the VIC-20.
Nigel's email address may be found through
www.commodorefree.com
Kind regards,
Shaun.
Without context, we are only data.
pallas
Vic 20 Devotee
Posts: 212 Joined: Mon Dec 24, 2012 2:38 am
Post
by pallas » Thu Mar 07, 2013 9:39 am
it can be shortened further.
for example, the number "32" is used many times: it can be assigned to a variable in line 0 and this will save some chars from line 1.
Leeeeee
soldering master
Posts: 396 Joined: Fri Apr 23, 2004 8:14 am
Post
by Leeeeee » Thu Mar 07, 2013 10:10 am
If you want to enter, please send the prg to Nigel Parker before the deadline,
It's Kweepa's program not mine. If Kweepa wants to enter the two line version I posted I have no objection.
Lee.
Mike
Herr VC
Posts: 5130 Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer
Post
by Mike » Thu Mar 07, 2013 11:15 am
Kweepa's program could go into a single line, BTW.
Mike
Herr VC
Posts: 5130 Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer
Post
by Mike » Thu Mar 07, 2013 12:55 pm
Here's my ultimate-rule-bending entry: '
bird.prg '.
Last edited by
Mike on Thu Feb 20, 2014 5:37 pm, edited 1 time in total.
Kweepa
Vic 20 Scientist
Posts: 1303 Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker
Post
by Kweepa » Thu Mar 07, 2013 1:09 pm
Thanks Leeeeee!
I'll enter it, why not?
You get some credit of course.
pallas, I considered that - before I added one more 32, apparently. Thanks!
Here's the final one-liner:
Code: Select all
0 forl=0to9:x=0:y=11:s=32:print"{clr}l"l"b"b:fori=1to505:printchr$(s-3*(rnd(1)<.3+l/44));:next:fora=-1to0:o=7680+22*y+x:pokeo,94:k=peek(197):x=x+(k=33andx>0andpeek(o-1)=s)-(k=26andpeek(o+1)=s):y=y+(k=52andy>0andpeek(o-22)=s)-(k=44andy<22andpeek(o+22)=s):pokeo-(k=13andb>0),s:b=b+(k=13):a=x<21:next:b=b+1:next:poke198,0
And the batch file to create it:
Code: Select all
petcat -l 1001 -w2 -o vicmaze.prg -- vicmaze.txt
c1541 -format vicmaze,20 d64 vicmaze.d64 -attach vicmaze.d64 -write vicmaze.prg
http://www.kweepa.com/step/vic20/games/vicmaze.zip
It comes out at 255 bytes, although for some reason petcat splits it into two lines
Last edited by
Kweepa on Thu Mar 07, 2013 2:00 pm, edited 2 times in total.
Shaun.Bebbington
Vic 20 Dabbler
Posts: 78 Joined: Fri Jan 20, 2006 3:41 am
Post
by Shaun.Bebbington » Thu Mar 07, 2013 1:27 pm
Mike wrote: Here's my ultimate-rule-bending entry: '
bird.prg '.
I'll tell Nigel to look out for some VIC-20 entries.
Regards,
Shaun.
Without context, we are only data.
Mike
Herr VC
Posts: 5130 Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer
Post
by Mike » Thu Mar 07, 2013 1:30 pm
I already sent it to Nigel as e-mail, together with an explanation how the exploit works.
Shaun.Bebbington
Vic 20 Dabbler
Posts: 78 Joined: Fri Jan 20, 2006 3:41 am
Post
by Shaun.Bebbington » Thu Mar 07, 2013 1:36 pm
Kweepa wrote: Thanks Leeeeee!
I'll enter it, why not?
You get some credit of course.
pallas, I considered that - before I added one more 32, apparently. Thanks!
I've noticed that, on occasion, your bombs run out when they shouldn't
Regards,
Shaun.
Without context, we are only data.
Kweepa
Vic 20 Scientist
Posts: 1303 Joined: Fri Jan 04, 2008 5:11 pm
Location: Austin, Texas
Occupation: Game maker
Post
by Kweepa » Thu Mar 07, 2013 1:59 pm
You really need to tap P lightly so as not to use multiple 'bombs'.