Re: [Ql-Users] A small machine code program...
En/Je/On 2010-11-27 02:32, Marcel Kilgus escribió / skribis / wrote : > > 1for i=1to 100:print i!"FIZZ"(to 4*not i mod 3);"BUZZ"(to 4*not i mod 5) > This is pure awesomeness, I wish I had thought of that! It's "Forthness" :-) I'm used to "think in Forth" in any other programming language. > But now that I've seen this trick, I hereby steal it and improve it to > 1FOR i=1TO 100:PRINT i!"FIZZBUZZ"(1+4*(i MOD 3>0)TO 4+4*(i MOD 5=0)) It seems unbeatable... I wish I had thought of that! ;-) Marcos -- http://alinome.net ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Marcos Cruz wrote: > 1for i=1to 100:print i!"FIZZ"(to 4*not i mod 3);"BUZZ"(to 4*not i mod 5) > > (73 bytes including LF). This is pure awesomeness, I wish I had thought of that! But now that I've seen this trick, I hereby steal it and improve it to 1FOR i=1TO 100:PRINT i!"FIZZBUZZ"(1+4*(i MOD 3>0)TO 4+4*(i MOD 5=0)) (69 bytes including LF) I think we're getting close to the minimum ;-) BTW, the assembler contest was I my eyes won by George, due to the creative usage of the DBF command. I really liked that. Cheers, Marcel ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Marcos Cruz wrote: En/Je/On 2010-11-26 17:17, P Witte escribió / skribis / wrote : The rules are simple - write out the values 1 to 100 on screen If the value is divisble by 3 write 'FIZZ' after the number If the value is divisble by 5 write 'BUZZ' after the number If the value is divisble by 3 and 5 write 'FIZZBUZZ' after the number Maybe the shortest thus far? -- calcutations instead of conditional structures, kind of Forth's style: 1for i=1to 100:print i!"FIZZ"(to 4*not i mod 3);"BUZZ"(to 4*not i mod 5) (73 bytes including LF). More alternatives: 1for i=1to 100:print i!"FI"(to 2*not i mod 3);"BU"(to 2*not i mod 5);"ZZ" (74 bytes including LF). 1deffn m(n):ret 4*not i mod n:enddef:for i=1to 100:print i!"FIZZ"(to m(3));"BUZZ"(to m(5)) (91 bytes including LF). 1deffn t$(a$,n):ret (a$&"ZZ")(to 4*not i mod n):enddef:for i=1to 100:print i!t$("FI",3);t$("BU",5) (99 bytes including LF). 1deffn t$(a$,n):ret a$(to 4*not i mod n):enddef:for i=1to 100:print i!t$("FIZZ",3);t$("BUZZ",5) (95 bytes including LF). A pretty waste of time :-) Very nice ;o) I'd like to raise your 73 to 72: You dont need the line number unless you start with a def* (You could remove the lf too, but then you cant LOAD or DO it. ;o) Per ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] Snowfall
Thanks - apart from reminding of my days of typing in ZX81 programs from magazine listings and then trying to save space (defining variables from text values, I seem to recall was one method) you have inspired me to fire up my copy of QL2K and try your listing out. I had to use an editor to strip out the CR characters as you suggest and then QLAYT.EXE to link the file into my win1_ directory. It mostly works until density% becomes 5 at which point it fails at line 310 with "bad parameter", presumably because it is trying to do a RND(1 to 0). Any suggestions? On 26/11/2010 18:01, Dilwyn Jones wrote: Reminds me of ZX81 days, trying to save a byte here and a byte there...not so much oneupmanship as "onelessship" :-) I'm sat here surrounded by snow (well, outside the house). So, what better than to write a snowfall simulator? -- Regards, Stephen ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
En/Je/On 2010-11-26 17:17, P Witte escribió / skribis / wrote : >> The rules are simple - >> write out the values 1 to 100 on screen >> If the value is divisble by 3 write 'FIZZ' after the number >> If the value is divisble by 5 write 'BUZZ' after the number >> If the value is divisble by 3 and 5 write 'FIZZBUZZ' after the number Maybe the shortest thus far? -- calcutations instead of conditional structures, kind of Forth's style: 1for i=1to 100:print i!"FIZZ"(to 4*not i mod 3);"BUZZ"(to 4*not i mod 5) (73 bytes including LF). More alternatives: 1for i=1to 100:print i!"FI"(to 2*not i mod 3);"BU"(to 2*not i mod 5);"ZZ" (74 bytes including LF). 1deffn m(n):ret 4*not i mod n:enddef:for i=1to 100:print i!"FIZZ"(to m(3));"BUZZ"(to m(5)) (91 bytes including LF). 1deffn t$(a$,n):ret (a$&"ZZ")(to 4*not i mod n):enddef:for i=1to 100:print i!t$("FI",3);t$("BU",5) (99 bytes including LF). 1deffn t$(a$,n):ret a$(to 4*not i mod n):enddef:for i=1to 100:print i!t$("FIZZ",3);t$("BUZZ",5) (95 bytes including LF). A pretty waste of time :-) Marcos -- http://alinome.net ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Am 26.11.2010 20:41, schrieb Tony Firshman: P Witte wrote, on 26/Nov/10 19:34 | Nov26: Marcel Kilgus wrote: Tony Firshman wrote: I obeyed the rules (8-)# Maybe, but that is more creativity in applying the rules than creativity in programming. You clearly have chosen the wrong career, you should have been a lawyer ;) ... and there is nothing to say the program has to be run more than once. I did considering initialising and it would still have been under 89. And yet I still don't think your entry is valid ;-) Otherwise my new entry is this: 1a a is machine code function loaded beforehand that prints out the values 1 to 100 on screen and writes FIZZ if the value is divisible by 3 and BUZZ if the value is divisible by 5. Surely the rules didn't say anything about only using inbuilt commands ;-) I bet theres a built-in command in perl called FUZZBUZZ (with 1a as a common ailias) I knew it would get down to semantics in the end. But I agree: Tony's cheating ;o) Anyway, just for the sake of a tidy reputation: I found some more unnecessary fat to trim: 1defproc z:if i mod 3=0:print'FIZZ';:endif:if i mod 5=0:print'BUZZ';:endif:print:enddef:for i=1to 100:print i,:z 113b Ok, if fancy formatting is not a requirement then Im raising your 91 to: 1for i=1to 100:print i,:if i mod 3=0:print'FIZZ';:endif:if i mod 5=0:print'BUZZ' 81b ! I don't agree I cheated - I obeyed the rules (8-)# In your program there is no line break if no BUZZ. What a pity SB does not have .= operator. Tony Hi, this all reminds me very much of the "obfuscated C" competition: http://www.de.ioccc.org/main.html There an entry would look like main(){for(;;i++){puts(!i%3)?"FIZZ":(!(i%5)?"BUZZ":""));}} 59 bytes but expands to 13856 when fed through C68 (But is wa faster than any of your old SBASIC stuff ;-) ) And is of course way more readable, structured, object-oriented and modern as well. Cheers, Tobias ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
P Witte wrote, on 26/Nov/10 19:34 | Nov26: Marcel Kilgus wrote: Tony Firshman wrote: I obeyed the rules (8-)# Maybe, but that is more creativity in applying the rules than creativity in programming. You clearly have chosen the wrong career, you should have been a lawyer ;) ... and there is nothing to say the program has to be run more than once. I did considering initialising and it would still have been under 89. And yet I still don't think your entry is valid ;-) Otherwise my new entry is this: 1a a is machine code function loaded beforehand that prints out the values 1 to 100 on screen and writes FIZZ if the value is divisible by 3 and BUZZ if the value is divisible by 5. Surely the rules didn't say anything about only using inbuilt commands ;-) I bet theres a built-in command in perl called FUZZBUZZ (with 1a as a common ailias) I knew it would get down to semantics in the end. But I agree: Tony's cheating ;o) Anyway, just for the sake of a tidy reputation: I found some more unnecessary fat to trim: 1defproc z:if i mod 3=0:print'FIZZ';:endif:if i mod 5=0:print'BUZZ';:endif:print:enddef:for i=1to 100:print i,:z 113b Ok, if fancy formatting is not a requirement then Im raising your 91 to: 1for i=1to 100:print i,:if i mod 3=0:print'FIZZ';:endif:if i mod 5=0:print'BUZZ' 81b ! I don't agree I cheated - I obeyed the rules (8-)# In your program there is no line break if no BUZZ. What a pity SB does not have .= operator. Tony -- QBBS (QL fido BBS 2:257/67) +44(0)1442-828255 t...@firshman.co.uk http://firshman.co.uk Voice: +44(0)1442-828254 Fax: +44(0)1442-828255 Skype: tonyfirshman TF Services, 29 Longfield Road, TRING, Herts, HP23 4DG ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Marcel Kilgus wrote: Tony Firshman wrote: I obeyed the rules (8-)# Maybe, but that is more creativity in applying the rules than creativity in programming. You clearly have chosen the wrong career, you should have been a lawyer ;) ... and there is nothing to say the program has to be run more than once. I did considering initialising and it would still have been under 89. And yet I still don't think your entry is valid ;-) Otherwise my new entry is this: 1a a is machine code function loaded beforehand that prints out the values 1 to 100 on screen and writes FIZZ if the value is divisible by 3 and BUZZ if the value is divisible by 5. Surely the rules didn't say anything about only using inbuilt commands ;-) I bet theres a built-in command in perl called FUZZBUZZ (with 1a as a common ailias) I knew it would get down to semantics in the end. But I agree: Tony's cheating ;o) Anyway, just for the sake of a tidy reputation: I found some more unnecessary fat to trim: 1defproc z:if i mod 3=0:print'FIZZ';:endif:if i mod 5=0:print'BUZZ';:endif:print:enddef:for i=1to 100:print i,:z 113b Ok, if fancy formatting is not a requirement then Im raising your 91 to: 1for i=1to 100:print i,:if i mod 3=0:print'FIZZ';:endif:if i mod 5=0:print'BUZZ' 81b ! Per ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Cheater! ;-) Also, one can only run your program once. This meets all Rich's requirements: -- The rules are simple - write out the values 1 to 100 on screen If the value is divisible by 3 write 'FIZZ' after the number If the value is divisible by 5 write 'BUZZ' after the number If the value is divisible by 3 and 5 write 'FIZZBUZZ' after the number -- Nothing about having to stop at 100 (8-)# Okay, if you want to get creative with the rules: Hmmm, I just did this without any bytes at all. I just took a soft pen and wrote the answers on the screen. There. No bytes of computer memory involved at all! Admittedly I now need a new monitor ;-)) Dilwyn Jones ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Marcel Kilgus wrote, on 26/Nov/10 18:48 | Nov26: Tony Firshman wrote: I obeyed the rules (8-)# Maybe, but that is more creativity in applying the rules than creativity in programming. You clearly have chosen the wrong career, you should have been a lawyer ;) ... and there is nothing to say the program has to be run more than once. I did considering initialising and it would still have been under 89. And yet I still don't think your entry is valid ;-) Otherwise my new entry is this: 1a a is machine code function loaded beforehand that prints out the values 1 to 100 on screen and writes FIZZ if the value is divisible by 3 and BUZZ if the value is divisible by 5. Surely the rules didn't say anything about only using inbuilt commands ;-) (8-)# I agree my entry was creative in not the way intended, but rules are rules. ... and I suppose I would have liked to be a lawyer - I am a renowned pedant - but I enjoy what I do more. Tony -- QBBS (QL fido BBS 2:257/67) +44(0)1442-828255 t...@firshman.co.uk http://firshman.co.uk Voice: +44(0)1442-828254 Fax: +44(0)1442-828255 Skype: tonyfirshman TF Services, 29 Longfield Road, TRING, Herts, HP23 4DG ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Tony Firshman wrote: > I obeyed the rules (8-)# Maybe, but that is more creativity in applying the rules than creativity in programming. You clearly have chosen the wrong career, you should have been a lawyer ;) > ... and there is nothing to say the program has to be run more than once. > I did considering initialising and it would still have been under 89. And yet I still don't think your entry is valid ;-) Otherwise my new entry is this: 1a a is machine code function loaded beforehand that prints out the values 1 to 100 on screen and writes FIZZ if the value is divisible by 3 and BUZZ if the value is divisible by 5. Surely the rules didn't say anything about only using inbuilt commands ;-) Marcel ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Marcel Kilgus wrote, on 26/Nov/10 18:09 | Nov26: Tony Firshman wrote: and CTRL SPACE after 100. Cheater! ;-) Also, one can only run your program once. This meets all Rich's requirements: -- The rules are simple - write out the values 1 to 100 on screen If the value is divisible by 3 write 'FIZZ' after the number If the value is divisible by 5 write 'BUZZ' after the number If the value is divisible by 3 and 5 write 'FIZZBUZZ' after the number -- Nothing about having to stop at 100 (8-)# Okay, if you want to get creative with the rules: 1i=0 2i=i+1:print i,"FIZZBUZZ":goto 2 There's nothing about NOT printing FIZZ if the number is not divisible by 3 etc.! :-P I obeyed the rules (8-)# ... and there is nothing to say the program has to be run more than once. I did considering initialising and it would still have been under 89. Tony -- QBBS (QL fido BBS 2:257/67) +44(0)1442-828255 t...@firshman.co.uk http://firshman.co.uk Voice: +44(0)1442-828254 Fax: +44(0)1442-828255 Skype: tonyfirshman TF Services, 29 Longfield Road, TRING, Herts, HP23 4DG ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Tony Firshman wrote: > and CTRL SPACE after 100. Cheater! ;-) Also, one can only run your program once. > This meets all Rich's requirements: > -- > The rules are simple - > write out the values 1 to 100 on screen > If the value is divisible by 3 write 'FIZZ' after the number > If the value is divisible by 5 write 'BUZZ' after the number > If the value is divisible by 3 and 5 write 'FIZZBUZZ' after the number > -- > Nothing about having to stop at 100 (8-)# Okay, if you want to get creative with the rules: 1i=0 2i=i+1:print i,"FIZZBUZZ":goto 2 There's nothing about NOT printing FIZZ if the number is not divisible by 3 etc.! :-P Marcel ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
[Ql-Users] Snowfall
Damn, missed something: 1for i=1to 100 2a$="":if i mod 3=0:a$="FIZZ" 3if i mod 5=0:a$=a$&"BUZZ" 4print i,a$:next (89 bytes including 4 LF) Marcel Never mind FIZZBUZZ... (and this afternoon's solutions only work on SBASIC what with NEXT with no variable and uninitialised variables... Reminds me of ZX81 days, trying to save a byte here and a byte there...not so much oneupmanship as "onelessship" :-) I'm sat here surrounded by snow (well, outside the house). So, what better than to write a snowfall simulator? Admittedly, Per should be the expert on this in Norway... we Brits ain't exactly known for our skills in handling snow ;-) This should run in SuperBASIC and you can EX it as a SBASIC program as well. It compiles with QLiberator if you prefer. If you are using a hires screen, change the screen coordinate values in line 880 to shove it somewhere out of the way on the screen. Obviosuly, you'll need to save the listing as text from this email and copy it to your QL or emulator (and possibly fix end-of-line characters if my email prog has added CRs). Could probably be adapted to work as a screen saver with my LPsaver program if you try really hard :-) Dilwyn Jones == 100 REMark snowfall 110 OPEN #3,con 120 RANDOMISE 130 Screen_Size 140 flakes% = 200 : REMark change for more snowflakes at slower speed 150 : 160 DIM flakex%(flakes%-1),flakey%(flakes%-1),flakew%(flakes%-1),ground%(w%-1) 170 : 180 Start : REMark initialise this snowfall 190 : 200 REPeat snowfall 210 IF INKEY$(#3) = CHR$(27) THEN EXIT snowfall 220 : 230 REMark change density of snowfall at random 240 IF RND(1 TO 5) = 1 THEN density% = RND(2 TO 5) 250 : 260 REMark change wind direction at random every now and then 270 IF RND(1 TO 1000) = 1 THEN 280 gradient% = RND(-2 TO 2) : slope% = 5*ABS(gradient%) 290 END IF 300 : 310 IF RND(1 TO 5-density%) = 1 THEN 320 REPeat make_a_flake 330 rand% = RND(0 TO flakes%-1) 340 IF flakey%(rand%) = -1 THEN 350 flakew%(rand%)=1+RND(0 TO 1) : REMark flake size 360 IF gradient% <> 0 AND RND(1 TO 10) = 1 THEN 370 REMark random flake from edge of screen 380 flakey%(rand%) = RND(.25*h% TO .75*h%) 390 IF gradient% < 0 THEN flakex%(rand%) = w%-flakew%(rand%) : ELSE flakex%(rand%) = 0 400 ELSE 410 REMark from top of screen 420 flakex%(rand%) = RND(0 TO w%-flakew%(rand%)) : flakey%(rand%) = 0 430 END IF 440 BLOCK #3,flakew%(rand%),1,flakex%(rand%),flakey%(rand%),7 : EXIT make_a_flake 450 END IF 460 END REPeat make_a_flake 470 END IF 480 : 490 REMark make it snow by moving the flakes down the screen 500 FOR x = 0 TO flakes%-1 510 IF flakey%(x) > -1 THEN 520 REMark erase original flake position... 530 BLOCK #3,flakew%(x),1,flakex%(x),flakey%(x),0 540 : 550 IF RND(1 TO slope%) = 1 THEN 560 REMark which way is the wind blowing? 570 flakex%(x) = flakex%(x)+gradient% 580 IF flakex%(x) < 0 OR flakex%(x) >= (w%-1) THEN 590 REMark flake off screen, back to top until reactivated 600 flakey%(x) = -1 : NEXT x : EXIT x 610 END IF 620 END IF 630 : 640 flakey%(x) = flakey%(x)+RND(1 TO 2) : REMark random falling speed 650 : 660 IF flakey%(x) < ground%(flakex%(x)) THEN 670 REMark not yet reached ground 680 BLOCK #3,flakew%(x),1,flakex%(x),flakey%(x),7 : REMark print snowflake 690 ELSE 700 REMark reached ground, so ground snow builds up 710 FOR a = 0 TO flakew%(x)-1 : ground%(flakex%(x)+a) = ground%(flakex%(x)+a)-1 720 flakey%(x) = -1 : REMark stop this flake 730 BLOCK #3,flakew%(x),h%-ground%(flakex%(x)),flakex%(x),ground%(flakex%(x)),7 740 FOR a = 0 TO flakew%(x)-1 750 IF ground%(flakex%(x)+a) < 1 THEN Start : EXIT x : REMark restart snowfall when screen full 760 END FOR a 770 END IF 780 END IF 790 END FOR x 800 END REPeat snowfall 810 : 820 CLOSE #3 830 : 840 STOP 850 : 860 DEFine PROCedure Screen_Size 870 REMark set window size and location 880 w% = 256 : h% = 128 : ox% = 256 : oy% = 128 890 WINDOW #3,w%,h%,ox%,oy% : BORDER #3,1,2 : PAPER #3,0 : INK#3,7 : CLS #3 900 w% = w%-4 : h% = h%-2 : REMark allow for border 910 END DEFine Screen_Size 920 : 930 DEFine PROCedure Start 940 LOCal x 950 density% = RND(2 TO 5) 960 gradient% = RND(-2 TO 2) : REMark which way the snow blows 970 slope% = 5*ABS(gradient%) : REMark 980 FOR x = 0 TO flakes%-1 : flakey%(x) = -1 990 FOR x = 0 TO w%-1 : ground%(x) = h%-1 1000 CLS #3 1010 END DEFine Start ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
[Ql-Users] QL2K/Qlay 2 articles
In case it helps anyone with using the QLay2 and QL2K emulators, I've posted a couple of reviews of the emulators as PDF files on my website's documents section. http://www.dilwyn.me.uk/docs/qlay/index.html The QLay 2 article in particular gives details of how to use the tools programs for transferring files to and from floppy disk, as QLay2 and QL2K have no FLP device. The articles were originally published in QL Today back in 2007/8. Dilwyn Jones ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Marcel Kilgus wrote, on 26/Nov/10 17:02 | Nov26: Marcel Kilgus wrote: 1for i=1to 100 2a$="":if i mod 3=0:a$="FIZZ" 3if i mod 5=0:a$=a$&"BUZZ" 4print i,a$:next i (91 bytes including 4 LF) Damn, missed something: 1for i=1to 100 2a$="":if i mod 3=0:a$="FIZZ" 3if i mod 5=0:a$=a$&"BUZZ" 4print i,a$:next (89 bytes including 4 LF) 1i=i+1 2a$="":if i mod 3=0:a$="FIZZ" 3if i mod 5=0:a$=a$&"BUZZ" 4print i,a$:goto 1 82 bytes incl LF and CTRL SPACE after 100. This meets all Rich's requirements: -- The rules are simple - write out the values 1 to 100 on screen If the value is divisible by 3 write 'FIZZ' after the number If the value is divisible by 5 write 'BUZZ' after the number If the value is divisible by 3 and 5 write 'FIZZBUZZ' after the number -- Nothing about having to stop at 100 (8-)# Tony -- QBBS (QL fido BBS 2:257/67) +44(0)1442-828255 t...@firshman.co.uk http://firshman.co.uk Voice: +44(0)1442-828254 Fax: +44(0)1442-828255 Skype: tonyfirshman TF Services, 29 Longfield Road, TRING, Herts, HP23 4DG ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Marcel Kilgus wrote: > 1for i=1to 100 > 2a$="":if i mod 3=0:a$="FIZZ" > 3if i mod 5=0:a$=a$&"BUZZ" > 4print i,a$:next i > > (91 bytes including 4 LF) Damn, missed something: 1for i=1to 100 2a$="":if i mod 3=0:a$="FIZZ" 3if i mod 5=0:a$=a$&"BUZZ" 4print i,a$:next (89 bytes including 4 LF) Marcel ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
P Witte wrote: > Just had another look: Is this the shortest possible version? > > 1defproc z:if i mod 3=0:print'FIZZ';:endif:if i mod > 5=0:print'BUZZ';:endif:print:enddef:for i=1to 100:print i,:z:endfor i > > Thats all one line. It should result in a file of 122b including eol. > Once LOADed it expands, of course, and should parse on JS, Minerva and > SMSQ/E. I'll raise you an 1for i=1to 100:a$="":if i mod 3=0:a$="FIZZ":endif:if i mod 5=0:a$=a$&"BUZZ":endif:print i,a$ (93 bytes including LF) or 1for i=1to 100 2a$="":if i mod 3=0:a$="FIZZ" 3if i mod 5=0:a$=a$&"BUZZ" 4print i,a$:next i (91 bytes including 4 LF) Marcel ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
Re: [Ql-Users] A small machine code program...
Rich Mellor wrote: I was just reading that 99/100 job applicants for programming jobs apparently cannot write a short "fizzbuzz" program when given 10 minutes to do so in an interview. The rules are simple - write out the values 1 to 100 on screen If the value is divisble by 3 write 'FIZZ' after the number If the value is divisble by 5 write 'BUZZ' after the number If the value is divisble by 3 and 5 write 'FIZZBUZZ' after the number Just had another look: Is this the shortest possible version? 1defproc z:if i mod 3=0:print'FIZZ';:endif:if i mod 5=0:print'BUZZ';:endif:print:enddef:for i=1to 100:print i,:z:endfor i Thats all one line. It should result in a file of 122b including eol. Once LOADed it expands, of course, and should parse on JS, Minerva and SMSQ/E. Per ___ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm