mirror of
https://github.com/remko/waforth
synced 2024-12-27 09:59:29 +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",
|
||||
isExample: true,
|
||||
program: `
|
||||
300 CONSTANT SIZE
|
||||
0 CONSTANT ANGLE
|
||||
5 CONSTANT BRANCHES
|
||||
450 CONSTANT SIZE
|
||||
6 CONSTANT BRANCHES
|
||||
|
||||
VARIABLE RND
|
||||
HERE RND !
|
||||
|
||||
: RANDOM ( -- n )
|
||||
RND @ 31421 * 6927 + 65536 MOD
|
||||
RND @ 75 * 74 + 65537 MOD
|
||||
DUP RND !
|
||||
;
|
||||
|
||||
: CHOOSE ( n1 -- n2 )
|
||||
RANDOM 65536 */MOD SWAP DROP
|
||||
RANDOM 65537 */MOD SWAP DROP
|
||||
;
|
||||
|
||||
: PLANT ( size angle -- )
|
||||
OVER 10 < IF 2DROP EXIT THEN
|
||||
OVER 20 < IF 2DROP EXIT THEN
|
||||
DUP RIGHT
|
||||
OVER FORWARD
|
||||
BRANCHES 0 DO
|
||||
|
@ -200,7 +199,7 @@ HERE RND !
|
|||
;
|
||||
|
||||
PENUP 0 SIZE NEGATE SETXY PENDOWN
|
||||
SIZE ANGLE PLANT
|
||||
SIZE 0 PLANT
|
||||
`,
|
||||
},
|
||||
].map((e) => ({ ...e, program: e.program.trimStart() }));
|
||||
|
|
Loading…
Reference in a new issue