Hi senior_falcon,
your Isabella made me say "this is too fast" for the first time about a XB program I wrote. In fact I resumed writing an old game I abandoned in 1984 because it was too slow to be fun. After some crude hacks it compiled and started working with intergers within 2 hours. But some 36 years ago I had the brilliant idea of not storing level data and save the memory, but recreating it every time by using the RANDOMIZE X function, feeding the level-number as the seed to the randomizer. As stated in the manual, Isabella ignores the RANDOMIZE statement, with and without an argument. It might be strange at first, but I use RANDOMIZE and RND to do the exact opposite of random numer generation, I generate repeatable numbers.
This code produces identical output on XB for the same seed, but (pseudo-) random numbers when compiled:
10 INPUT "SEED:":S
20 RANDOMIZE S
30 PRINT INT(RND*100)
40 GOTO 10
With the help of an old IEEE article "RANDOM NUMBER GENERATOR FOR 16-BIT MACHINES" by John J. Komo and William J. Reid (1989) I developed the following subroutine:
1000 SUB RAND(SEED,OG,ERG)
1010 XDQ=INT(SEED/144)
1020 XMQ=SEED-(XDQ*144)
1030 SEED2=(227*XMQ)-(61*XDQ)
1040 IF SEED2>0 THEN SEED=SEED2 ELSE SEED=SEED2+32749
1050 ERG=INT(SEED/(32749/OG))
1060 SUBEND
The Seed will be updated with every call and starts to repeat after some 30.000 calls. The ERG will be 0<= ERG < OG, i.e. SEED=13 :: CALL RAND(SEED,100,X) will set X to a number between 0 and 99 and advances the seed. Consecutive calls will bring the same sequence each time it is executed.
Will there be an Isabella 7 with RANDOMIZE SEED function or should I rewrite my code to use my own RAND function?
Thank you and I LOVE working on my old projects again with ISABELLA. My wife starts getting jealous...
Steve