Also preserves the original features where some threads are spaces and not characters.  The loop forever is accomplished with a never-ending for loop allowing the init line to be combined with the start of the main loop.  Next statements work the same as GOTO but they allow jumping back to the middle of a line. 😄  The INT statements are mostly unnecessary since apple basic treats everything as floating point and it is the functions themselves that strip off the mantissa and use the integer portion.  If you run a value through INT and store it into a variable, it will be converted back to float anyway so it just wastes CPU cycles.  I do use INT in one place to normalize a value as 0 or 1, and that is also how I eliminate an if statement by just multiplying the result by 96 -- it will either be 0 (space) or some other character as a result, etc.
This commit is contained in:
Brendan Robert 2022-01-05 16:25:41 -06:00 committed by GitHub
parent c845a08095
commit ce63c91ff3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -1,5 +1,2 @@
1POKE 35,25:DIM K(3,2):C=-1:A=0
2C=(C+1)-INT((C+1)/3)*3:R=INT(RND(1)*A):IF C=2 THEN A=20
3IF R=0 THEN K(C,0)=INT(RND(1)*40)+1:K(C,1)=0:K(C,2)=INT(RND(1)*2):GOTO2
4K(C,1)=K(C,1)+1:IF K(C,1)<25THEN HTAB K(C,0):VTAB K(C,1):PRINT CHR$(INT(RND(1)*96*K(C,2)+32));
5GOTO2
1 HOME:POKE 35,25:DIM K(3,2):Z=0:FOR D=0 TO 2:FOR C=0 TO 3:D=1:R=RND(1)*Z:IF R<1 OR K(C,1)>23 THEN K(C,0)=RND(1)*40+1:K(C,1)=0:K(C,2)=INT(RND(1)*2)*96:NEXT C:Z=20:NEXT D
2 K(C,1)=K(C,1)+1:VTAB K(C,1):HTAB K(C,0):PRINT CHR$(RND(1)*K(C,2)+32);:NEXT C,D