Brownian tree: Difference between revisions
Content added Content deleted
m (Added reference to nimPNG.) |
(→{{header|Liberty BASIC}}: add Locomotive Basic version) |
||
Line 2,209: | Line 2,209: | ||
close #1 |
close #1 |
||
end</lang> |
end</lang> |
||
=={{header|Locomotive Basic}}== |
|||
{{trans|ZX Spectrum Basic}} |
|||
This program is ideally run in [https://benchmarko.github.io/CPCBasic/cpcbasic.html CPCBasic] and should finish after about 20 to 25 minutes (Chrome, desktop CPU). At normal CPC speed, it would probably take several days to run when set to 10000 particles. |
|||
<lang locobasic>10 MODE 1:DEFINT a-z:RANDOMIZE TIME:np=10000 |
|||
20 INK 0,0:INK 1,26:BORDER 0 |
|||
30 PLOT 320,200 |
|||
40 FOR i=1 TO np |
|||
50 GOSUB 1000 |
|||
60 IF TEST(x+1,y+1)+TEST(x,y+1)+TEST(x+1,y)+TEST(x-1,y-1)+TEST(x-1,y)+TEST(x,y-1)<>0 THEN 100 |
|||
70 x=x+RND*2-1: y=y+RND*2-1 |
|||
80 IF x<1 OR x>640 OR y<1 OR y>400 THEN GOSUB 1000 |
|||
90 GOTO 60 |
|||
100 PLOT x,y |
|||
110 NEXT |
|||
120 END |
|||
1000 ' Calculate new position |
|||
1010 x=RND*640 |
|||
1020 y=RND*400 |
|||
1030 RETURN</lang> |
|||
=={{header|Lua}}== |
=={{header|Lua}}== |