mirror of
https://github.com/remko/waforth
synced 2025-01-14 08:01:34 +01:00
thurtle: Tweak examples
This commit is contained in:
parent
629707587a
commit
47b83fc610
2 changed files with 18 additions and 17 deletions
|
@ -65,10 +65,10 @@ export default [
|
|||
name: "Flower",
|
||||
program: `
|
||||
: SQUARE ( n -- )
|
||||
4 0 DO
|
||||
DUP FORWARD
|
||||
90 RIGHT
|
||||
LOOP
|
||||
4 0 DO
|
||||
DUP FORWARD
|
||||
90 RIGHT
|
||||
LOOP
|
||||
;
|
||||
|
||||
: FLOWER ( n -- )
|
||||
|
@ -95,31 +95,32 @@ LOOP
|
|||
`,
|
||||
},
|
||||
{
|
||||
name: "Square Spiral",
|
||||
name: "Outward Square Spiral",
|
||||
program: `
|
||||
: SPIRAL ( n1 n2 -- )
|
||||
OVER 1 < IF 2DROP EXIT THEN
|
||||
OVER 800 > IF 2DROP EXIT THEN
|
||||
OVER FORWARD
|
||||
DUP RIGHT
|
||||
SWAP 95 100 */ SWAP
|
||||
SWAP 10 + SWAP
|
||||
RECURSE
|
||||
;
|
||||
|
||||
450 90 SPIRAL
|
||||
1 90 SPIRAL
|
||||
`,
|
||||
},
|
||||
{
|
||||
name: "Crooked Square Spiral",
|
||||
name: "Crooked Outward Square Spiral",
|
||||
program: `
|
||||
: SPIRAL ( n1 n2 -- )
|
||||
OVER 1 < IF 2DROP EXIT THEN
|
||||
OVER FORWARD
|
||||
DUP RIGHT
|
||||
SWAP 95 100 */ SWAP
|
||||
91 CONSTANT ANGLE
|
||||
|
||||
: SPIRAL ( n -- )
|
||||
DUP 800 > IF DROP EXIT THEN
|
||||
DUP FORWARD
|
||||
ANGLE RIGHT
|
||||
10 +
|
||||
RECURSE
|
||||
;
|
||||
|
||||
450 91 SPIRAL
|
||||
`,
|
||||
1 SPIRAL`,
|
||||
},
|
||||
].map((e) => ({ ...e, program: e.program.trimStart() }));
|
||||
|
|
|
@ -326,4 +326,4 @@ document.addEventListener("keydown", (ev) => {
|
|||
|
||||
reset();
|
||||
|
||||
loadExample(examples[1].name);
|
||||
loadExample(examples[4].name);
|
||||
|
|
Loading…
Reference in a new issue