mirror of
https://github.com/remko/waforth
synced 2025-01-14 08:01:34 +01:00
thurtle: Tweak plant
This commit is contained in:
parent
322dff1997
commit
108de077c9
1 changed files with 6 additions and 7 deletions
|
@ -170,24 +170,23 @@ SNOWFLAKE
|
||||||
name: "Plant",
|
name: "Plant",
|
||||||
isExample: true,
|
isExample: true,
|
||||||
program: `
|
program: `
|
||||||
300 CONSTANT SIZE
|
450 CONSTANT SIZE
|
||||||
0 CONSTANT ANGLE
|
6 CONSTANT BRANCHES
|
||||||
5 CONSTANT BRANCHES
|
|
||||||
|
|
||||||
VARIABLE RND
|
VARIABLE RND
|
||||||
HERE RND !
|
HERE RND !
|
||||||
|
|
||||||
: RANDOM ( -- n )
|
: RANDOM ( -- n )
|
||||||
RND @ 31421 * 6927 + 65536 MOD
|
RND @ 75 * 74 + 65537 MOD
|
||||||
DUP RND !
|
DUP RND !
|
||||||
;
|
;
|
||||||
|
|
||||||
: CHOOSE ( n1 -- n2 )
|
: CHOOSE ( n1 -- n2 )
|
||||||
RANDOM 65536 */MOD SWAP DROP
|
RANDOM 65537 */MOD SWAP DROP
|
||||||
;
|
;
|
||||||
|
|
||||||
: PLANT ( size angle -- )
|
: PLANT ( size angle -- )
|
||||||
OVER 10 < IF 2DROP EXIT THEN
|
OVER 20 < IF 2DROP EXIT THEN
|
||||||
DUP RIGHT
|
DUP RIGHT
|
||||||
OVER FORWARD
|
OVER FORWARD
|
||||||
BRANCHES 0 DO
|
BRANCHES 0 DO
|
||||||
|
@ -200,7 +199,7 @@ HERE RND !
|
||||||
;
|
;
|
||||||
|
|
||||||
PENUP 0 SIZE NEGATE SETXY PENDOWN
|
PENUP 0 SIZE NEGATE SETXY PENDOWN
|
||||||
SIZE ANGLE PLANT
|
SIZE 0 PLANT
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
].map((e) => ({ ...e, program: e.program.trimStart() }));
|
].map((e) => ({ ...e, program: e.program.trimStart() }));
|
||||||
|
|
Loading…
Reference in a new issue