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?
Well spotted!

It actually runs OK on QPC (more brownie points to Marcel). RND(1 TO 0) in SBASIC always returns 1, while even better RND(1 TO -1) can produce negative numbers, presumably it takes the signed second parameter as an unsigned 16 or 32 bit integer, produces a random number in this range, then signs it all again to return it!

Should work with changing that line to 310 IF RND(1 TO 6-density%)=1 THEN which should make sure it gives a snow density of 1 to 5, whichis what I'd intended.

Varying that line would probably just increase the snow density even further (and make it slower) but changing it so that it returns a negative number would probably try to generate negative snow (the wrong kind of snow???) and that would cause all sorts of chaos :-)

It's one of those programs you can tinker with forever, subject to the whims of the creaded Sinclair random number generator.

When I figure out how to copy it from QPC to QemuLator (floppy disk?) or QL2K I'll test it in QDOS. Just goes to show the dangers of assuming that because it ran OK on one computer doesn't mean it'll always run OK on another! I didn't know until you pointed this out that the RND function works in this way in SBASIC.

Dilwyn Jones


_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to