I hope you enjoy this little graphical treat. Long-time MSX mailinglist subscribers may recognise the image, but not the code
Yup, it's the Sierpinski triangle. You must be refering the MSX-BASIC oneliner contest back in 1998? I remember, that you sent a version of this triangle to that compo as well... After that I also ported this code to BrainFuck (esoteric.sange.fi/brainfuck/bf-source/prog/triangle.bf) ;)
Has your A returned already?
/me checks hind...
Yup. Everything in place
Thanx for your concern
Name: Worm
System: MSX1
1 SCREEN1:KEYOFF:FORW=0TO9:COLOR5,1,1:S=-10:LOCATE8,11:PRINT"'s' to start":W=0 2 M=32:D=736:IFINKEY$<>"s"THENNEXTELSECLS:F=6176:V=4096:H=6480:T=H-V:FORX=0TOD 3 VPOKEX+F,7:X=X+15*(X-30AND30AND31R):LOCATE1,0:VPOKEL,215: U=(2+62*(WAND1))*((W>1)+.5):Z=0:VPOKEH-V,U+M 6 PRINT"SCORE:"S,"HIGH:"R: H=H+U: O=VPEEK(H):VPOKEH,9:IFO<>MANDO<>215THENNEXTW 7 J$=INKEY$:K=0:IFO=215THENNEXTZELSEVPOKET+V,M: T=T+VPEEK(T)-M:VPOKEV*2,6:NEXT
I made a little old school game. Its been a while (like 15 years) since I wrote an MSX Basic program so I hope it is readable.
To run it press 's' to start and 'z' and 'x' to control the thing. Enjoy
And a little one liner (although I don't really think it qualifies for one since it is quite long....) Its pretty obvious what it does maybe...
0 DEFINTA-Z:A=1:FORX=0TO0STEP0:A=A+2:B=-1:C=B:D=A:FORT=OTO0STEP0:IFD=0THENIF(C-B)=2THENPRINTA:NEXTXELSENEXTXELSEIFD>0THENC=C+2:D=D-C:NEXTELSEB=B+2:D=D+B:NEXT
I made a more entertaining version of the prime number generator. This one is a lot slower but more interesting. It doesn't contain any branches except a goto (anyone have any ideas on how to get rid of this one. I tried run but that clears the variables?). It does however use multiplications which the other one didn't.
Since I just posted a similar entry I guess this one can be left outside IOMBCC but I wanted to show you it since it looks pretty fun. So once again, enjoy
1 A=A-2*(D=0)-(A=0):B=(D=0)-(D<>0)*B:C=(D=0)-(D<>0)*C:D=D-A*(D=0):C=C-2*(D>0):B=B-2*(D<0):D=D+C*(D>0)-B*(D<0):PRINTCHR$(-30*(D<>0OR(C-B)<>2))A:GOTO1
Great entries! ^_^ I’ve enjoyed them!
Kindof. I used that in the first prime number version but its not very obfuscated (and the goto isn't either). I was thinking if there is a way to restart the program (some kind of jump) without clearing the variables.
Btw, a bit more obscure infinite for loop is (all numbers are zero):
FOR I=0 TO 0 STEP 0: NEXT
Hey Grauw, Were did your last post go?
Snout, I actually like the new one liner better, so if you don't mind I'd like to change the prime number entry to this one instead (I just moved the print statement to the beginning):
1 PRINTCHR$(-30*(D<>0OR(C-B)<>2))A:A=A-2*(D=0)-(A=0):B=(D=0)-(D<>0)*B:C=(D=0)-(D<>0)*C:D=D-A*(D=0):C=C-2*(D>0):B=B-2*(D<0):D=D+C*(D>0)-B*(D<0):GOTO1
I'll add it as an extra entry, as I find the other one to be quite interesting as well
dvik: because he already uses for i=0 to 0 step 0 in his previous version, so it was a bit stupid remark .