Compare commits

..

175 Commits

Author SHA1 Message Date
b37f904264 Merge branch 'main' into release 2025-07-08 16:48:15 -04:00
e29ca9642f Merge branch 'main' into release 2025-07-08 16:44:55 -04:00
Scott Richmond
fb9c49a9de add wasm? 2025-07-08 16:39:24 -04:00
Scott Richmond
617994c98b fix penwidth bug 2025-07-08 16:38:47 -04:00
Scott Richmond
b7e4aebb95 bugfixes & shorthand methods on turtles 2025-07-08 16:05:54 -04:00
edd21bec5e trying lfs again again
Former-commit-id: 395f53f91e
2025-07-07 16:11:16 -04:00
Scott Richmond
cfcd61b471 merge
Former-commit-id: 76862341c1
2025-07-07 16:06:19 -04:00
c177b81b6a trying lfs again
Former-commit-id: 8d6026d934
2025-07-07 15:53:20 -04:00
Scott Richmond
e4fc18d63c premerge
Former-commit-id: 2619e3ee56
2025-07-07 15:49:13 -04:00
Scott Richmond
c105bd699a release build
Former-commit-id: 7e1034f7d1
2025-07-07 15:45:03 -04:00
Scott Richmond
de048d425a remove process return spam
Former-commit-id: 5ee4d87db7
2025-07-07 15:44:08 -04:00
7b5936718f Merge branch 'main' of alea.ludus.dev:twc/ludus
Former-commit-id: 3360e0d96b
2025-07-07 13:53:11 -04:00
807bb95ec0 moving wasm to lfs
Former-commit-id: 8c27f63cb0
2025-07-07 13:46:03 -04:00
Scott Richmond
a2fa95c0cb release build
Former-commit-id: 14e4cf93ae
2025-07-07 13:25:50 -04:00
Scott Richmond
1abeef46e9 improve svg background box logic
Former-commit-id: 4134a69fcc
2025-07-07 13:25:31 -04:00
Scott Richmond
3539a41dad fix comment template string
Former-commit-id: ee54da0305
2025-07-07 13:03:00 -04:00
Scott Richmond
f1ab81760f release build
Former-commit-id: b9803c8357
2025-07-07 11:12:36 -04:00
Scott Richmond
72ef94bdf7 remove printlns again
Former-commit-id: 6c4ea6d12e
2025-07-07 11:11:44 -04:00
Scott Richmond
39e5d1ff08 build
Former-commit-id: ddeb63d977
2025-07-07 10:40:10 -04:00
Scott Richmond
13865f5a4c release build
Former-commit-id: 9fc1a1ef7f
2025-07-07 09:06:39 -04:00
Scott Richmond
a3780af60c fix receive stack regression/re introduce await regression
Former-commit-id: f2dbb2743e
2025-07-07 09:06:02 -04:00
Scott Richmond
c45a35a631 builded
Former-commit-id: fd7152a91b
2025-07-07 08:43:12 -04:00
Scott Richmond
f9e1b598f6 release build
Former-commit-id: 3f6bafb1bd
2025-07-07 08:42:44 -04:00
Scott Richmond
261f0ee8ee fix prelude bindings
Former-commit-id: c2329519d7
2025-07-07 08:42:09 -04:00
Scott Richmond
1511b43097 update prelude location in docs
Former-commit-id: 28cc6ddf1d
2025-07-07 00:40:26 -04:00
Scott Richmond
a3e736179d bring in old readme
Former-commit-id: f04522e62b
2025-07-07 00:27:20 -04:00
Scott Richmond
c81a87526b Merge branch 'main' into actors
Former-commit-id: 75c90c50a4
2025-07-07 00:22:56 -04:00
Scott Richmond
670cb0b393 commit some changes
Former-commit-id: 69b6b0cce6
2025-07-07 00:17:57 -04:00
Scott Richmond
5c4c416cb6 build
Former-commit-id: 74ecea9ff6
2025-07-07 00:12:45 -04:00
Scott Richmond
e348d33ac4 release build
Former-commit-id: f5b34e3bc6
2025-07-07 00:12:36 -04:00
Scott Richmond
4095e2256f locate new prelude
Former-commit-id: 3946e5d6fa
2025-07-07 00:12:01 -04:00
Scott Richmond
f9096c2454 actually add doc
Former-commit-id: 2c10c5bf07
2025-07-07 00:10:58 -04:00
Scott Richmond
5b1c2f7c7b build a doc file, bring in some other documentation
Former-commit-id: 49bb50ada1
2025-07-07 00:10:37 -04:00
Scott Richmond
9ba4b51b9a moar cleanup
Former-commit-id: 79720ba833
2025-07-06 23:31:12 -04:00
Scott Richmond
83fe2d1aab clean up files
Former-commit-id: f9ff565db1
2025-07-06 23:30:14 -04:00
Scott Richmond
f397045844 bring in old janet interpreter for doc purposes
Former-commit-id: 2353b6eb9a
2025-07-06 23:14:32 -04:00
Scott Richmond
e4d6522923 old->new prelude
Former-commit-id: d20c453180
2025-07-06 23:14:01 -04:00
Scott Richmond
7c0cac2ccd add new actor functions
Former-commit-id: a444f789f3
2025-07-06 19:40:55 -04:00
Scott Richmond
2f5c17a2ce release build
Former-commit-id: 842f1e7634
2025-07-06 19:06:27 -04:00
Scott Richmond
37efb3e09a remove printlns, soften language
Former-commit-id: e768323a6c
2025-07-06 19:05:45 -04:00
Scott Richmond
6bd98b6515 release build
Former-commit-id: 3527530e39
2025-07-06 19:00:45 -04:00
Scott Richmond
ff08479bef improve pattern representation; fix get callsites
Former-commit-id: a534e241f9
2025-07-06 19:00:03 -04:00
Scott Richmond
f4d038fc52 release build
Former-commit-id: a5e1aad83d
2025-07-06 18:54:45 -04:00
Scott Richmond
8d4ba24ced build + fix some turtle stuff
Former-commit-id: 45d999d32e
2025-07-06 18:54:10 -04:00
Scott Richmond
c1852bad19 release build
Former-commit-id: cce3a2410f
2025-07-06 18:44:10 -04:00
Scott Richmond
51de03a64e fix key_up bug in ludus.js
Former-commit-id: 2b2875720f
2025-07-06 18:43:35 -04:00
Scott Richmond
bf11aa3e11 improve (but not fully fix?) reported line numbers in tracebacks
Former-commit-id: 6eb28888ca
2025-07-06 18:27:43 -04:00
Scott Richmond
515798b79e builded again
Former-commit-id: 05792d631a
2025-07-06 17:57:01 -04:00
Scott Richmond
08bbbd482e release build
Former-commit-id: 827008d426
2025-07-06 17:56:26 -04:00
Scott Richmond
0da80cff22 improve signature for last
Former-commit-id: 10236c5005
2025-07-06 17:55:48 -04:00
Scott Richmond
d8cf28b62c fix guard clause bug in function calls
Former-commit-id: 14d07e40de
2025-07-06 17:53:10 -04:00
Scott Richmond
4d571ea87c release build
Former-commit-id: 151f56d9d6
2025-07-06 17:19:12 -04:00
Scott Richmond
0e6fc8d266 get doc! to where it needs to be; make show much longer
Former-commit-id: 64a02bec08
2025-07-06 17:18:37 -04:00
Scott Richmond
1ffa2f6898 release build
Former-commit-id: 3b535ed05c
2025-07-06 16:53:39 -04:00
Scott Richmond
e304700794 oxidize index_of and indices_of for dissociated press
Former-commit-id: fb797fcd87
2025-07-06 16:52:54 -04:00
Scott Richmond
2bf2e01221 builded
Former-commit-id: baf2dcb7c9
2025-07-06 16:40:21 -04:00
Scott Richmond
cc1fc83a78 release build
Former-commit-id: a513aaf3cd
2025-07-06 16:40:05 -04:00
Scott Richmond
2543ac1dac have rust make words
Former-commit-id: a75a5b8881
2025-07-06 16:39:29 -04:00
Scott Richmond
866a511fab release build
Former-commit-id: 05dfd01326
2025-07-06 16:17:58 -04:00
Scott Richmond
51c5e7d0d2 do some things and stuff?
Former-commit-id: 1c7d5b4782
2025-07-06 16:17:21 -04:00
Scott Richmond
855705043a build
Former-commit-id: d59b01462f
2025-07-06 12:09:52 -04:00
Scott Richmond
1b51767a6d release build
Former-commit-id: 83c4f02f6a
2025-07-06 12:09:41 -04:00
Scott Richmond
26fbd81a8a asdf
Former-commit-id: 1fcd5b0f98
2025-07-06 12:08:57 -04:00
Scott Richmond
b34a3a907f wire up keyboard events
Former-commit-id: 0ecaaaa258
2025-07-06 01:40:03 -04:00
Scott Richmond
f5e84c01c4 use NotNan as number representation
Former-commit-id: e41d6b802b
2025-07-06 00:27:50 -04:00
Scott Richmond
2c63ba1496 add pow, work on sets
Former-commit-id: d8c999d5ab
2025-07-05 23:56:10 -04:00
Scott Richmond
9f4f55044a js & rust code for key inputs
Former-commit-id: a95f575260
2025-07-05 23:33:39 -04:00
Scott Richmond
16be2bce3d factor svg/p5 into modules; fix svg rendering
Former-commit-id: f635e878c9
2025-07-05 23:20:41 -04:00
Scott Richmond
795a50a69c improve panic message, slightly
Former-commit-id: e4e32bb308
2025-07-05 22:40:11 -04:00
Scott Richmond
5ac87d97b6 build
Former-commit-id: 728614879c
2025-07-05 18:42:38 -04:00
Scott Richmond
ca62f693cd release build
Former-commit-id: ccbbfebbbe
2025-07-05 18:36:47 -04:00
Scott Richmond
33721cd712 debug multiturtles?
Former-commit-id: 8e75713cd7
2025-07-05 18:36:01 -04:00
Scott Richmond
0057c270db fix p5 drawing command conversion
Former-commit-id: 50da642758
2025-07-05 17:38:40 -04:00
Scott Richmond
7a435d3970 release build
Former-commit-id: f9cdd43367
2025-07-05 17:30:58 -04:00
Scott Richmond
a59045cfb1 fix p5 state calculations
Former-commit-id: 45984e190a
2025-07-05 17:30:19 -04:00
Scott Richmond
fa23f53bb0 release build
Former-commit-id: 20e46b4d62
2025-07-05 17:09:38 -04:00
Scott Richmond
33caa07f8b first pass at multiturtles
Former-commit-id: bac3c29d1d
2025-07-05 17:09:01 -04:00
Scott Richmond
4583951463 massage prelude into multiturtles; wip
Former-commit-id: f1f954de46
2025-07-05 15:57:05 -04:00
Scott Richmond
7d8f2b1c39 add canadian spellings
Former-commit-id: 4988ea6626
2025-07-05 15:51:45 -04:00
Scott Richmond
2b9e5db59a oops: implement called keywords!
Former-commit-id: 84101711f2
2025-07-05 15:49:36 -04:00
Scott Richmond
9d3ec05ef9 middleware should now handle multiple turtles
Former-commit-id: ff6aaf5cdf
2025-07-05 15:26:48 -04:00
Scott Richmond
4e2ce0bf1d do some work on linking, unravel it, spawn! is now a normal fn
Former-commit-id: 369f8a54f4
2025-07-05 14:45:50 -04:00
Scott Richmond
cb83c8f122 don't try to export state, which no longer exists
Former-commit-id: e76e9f5348
2025-07-05 14:45:04 -04:00
Scott Richmond
087cf68cff revert spawn! as a special form
Former-commit-id: a38a686a76
2025-07-05 14:39:17 -04:00
Scott Richmond
d6d8679d8c actually export llist fns
Former-commit-id: 3a5415e1c7
2025-07-05 14:26:50 -04:00
Scott Richmond
4c3e5f9d5d add functions from June 2025 CC1
Former-commit-id: 1688aaccf7
2025-07-05 14:24:38 -04:00
Scott Richmond
2724e71aa6 update validator
Former-commit-id: 10692b4b41
2025-07-04 17:44:44 -04:00
Scott Richmond
9606d9485e spawn is now a special form
Former-commit-id: bbdab93cf0
2025-07-04 17:24:54 -04:00
Scott Richmond
d9752a3e46 stringify -> show in explicit panics
Former-commit-id: 8ce6a33573
2025-07-04 16:17:55 -04:00
Scott Richmond
ae8d530d42 asdf
Former-commit-id: d52faeff41
2025-07-04 15:57:16 -04:00
Scott Richmond
58901a9b24 asdf
Former-commit-id: ed6976fe35
2025-07-04 15:37:39 -04:00
Scott Richmond
81f3ac3a34 release build
Former-commit-id: 22ac3cb0fe
2025-07-04 15:30:26 -04:00
Scott Richmond
24763d929d add is_starting_up
Former-commit-id: 8851002a90
2025-07-04 15:29:44 -04:00
Scott Richmond
224e64a9d1 release build
Former-commit-id: cd80e65528
2025-07-04 15:19:32 -04:00
Scott Richmond
5313afaf33 fix slice_n
Former-commit-id: f853e02f00
2025-07-04 15:18:49 -04:00
Scott Richmond
927009be0b release build
Former-commit-id: dc11d6cc58
2025-07-04 15:10:51 -04:00
Scott Richmond
6f28634729 globalize key_down and key_up
Former-commit-id: 7cffa43c3e
2025-07-04 15:09:02 -04:00
Scott Richmond
c0ca6a9cfb release build
Former-commit-id: 294d7d6be2
2025-07-04 14:44:50 -04:00
Scott Richmond
2394e29485 add slice_n to prelude
Former-commit-id: 2808c0b709
2025-07-04 14:44:09 -04:00
Scott Richmond
88febf97b1 release build
Former-commit-id: 55483d54a2
2025-07-04 14:11:01 -04:00
Scott Richmond
5b14e2ab02 consolidate js functions
Former-commit-id: 3b8d3ff5e3
2025-07-04 14:10:27 -04:00
Scott Richmond
15ed1ee718 keep working on panics: tracebacks sort of work?
Former-commit-id: 9228e060bb
2025-07-04 14:10:03 -04:00
Scott Richmond
e2461590b6 also put the new panic mod under version control
Former-commit-id: 050a0f987d
2025-07-04 01:23:31 -04:00
Scott Richmond
53e295ac37 working on panics
Former-commit-id: 0d8b42662b
2025-07-04 01:23:16 -04:00
Scott Richmond
ad3d67114e pretty good parsing errors
Former-commit-id: f97f6670bd
2025-07-03 23:23:14 -04:00
Scott Richmond
44de23c6a8 scanning errors are now nice
Former-commit-id: d6a004d9ac
2025-07-03 20:45:55 -04:00
Scott Richmond
49b2249e14 use serde to serialize the things
Former-commit-id: c6709bb2e8
2025-07-03 20:22:11 -04:00
Scott Richmond
9040d53e32 string keys on dicts now fully work
Former-commit-id: 9f9f59b33b
2025-07-03 15:30:51 -04:00
Scott Richmond
e741446ece add string keys to dicts
Former-commit-id: 659fdd3506
2025-07-03 12:41:00 -04:00
Scott Richmond
f6374b652a work on errors
Former-commit-id: d334e483a5
2025-07-02 23:47:02 -04:00
Scott Richmond
dd43d20e71 properly scan escape chars
Former-commit-id: 2ffff9edd9
2025-07-02 20:54:21 -04:00
Scott Richmond
ef0d2acce0 make an attempt at fixing string escaping
Former-commit-id: 28d6dc24f0
2025-07-02 19:44:12 -04:00
Scott Richmond
1b1b04f014 method syntax sugar achieved
Former-commit-id: 0cd682de21
2025-07-02 19:29:49 -04:00
Scott Richmond
2fadff05ff do and panic are now simple forms
Former-commit-id: 12389ae371
2025-07-02 17:29:09 -04:00
Scott Richmond
b9d424473b release build
Former-commit-id: bf204696a5
2025-07-02 16:56:59 -04:00
Scott Richmond
7c44f4325f don't discard initial messages
Former-commit-id: 6bdb9779d8
2025-07-02 16:56:30 -04:00
Scott Richmond
7e24295ff7 add log to input
Former-commit-id: 2f4ab41a62
2025-07-02 16:20:22 -04:00
Scott Richmond
f1a89cedb4 release build
Former-commit-id: 1316c8228f
2025-07-02 16:05:49 -04:00
Scott Richmond
36672de970 wasm->build
Former-commit-id: dcf550ba2f
2025-07-02 16:05:38 -04:00
Scott Richmond
6572d2d364 fix complete reset
Former-commit-id: df5c745ce9
2025-07-02 16:05:06 -04:00
Scott Richmond
49b66ecf45 move default to the top
Former-commit-id: 1435e753e8
2025-07-02 15:47:33 -04:00
Scott Richmond
3063fe304e clean up justfile
Former-commit-id: f6ad3b6966
2025-07-02 15:43:44 -04:00
Scott Richmond
cb21d53992 try again w/ justfile
Former-commit-id: 5a778d9a55
2025-07-02 15:37:56 -04:00
Scott Richmond
5d45063689 finish release recipe?
Former-commit-id: 62ad321a88
2025-07-02 15:35:19 -04:00
Scott Richmond
6f7bca9f1f justinging
Former-commit-id: 14a41dc1bd
2025-07-02 15:34:36 -04:00
Scott Richmond
59d99ba136 keep justing
Former-commit-id: d9b095c3f3
2025-07-02 15:26:19 -04:00
Scott Richmond
3ae1e0e1a2 keep working on justfile
Former-commit-id: 44739adfe5
2025-07-02 15:19:54 -04:00
Scott Richmond
1d58f0d3a4 start work on release recipe
Former-commit-id: 624c0bd2f8
2025-07-02 15:04:54 -04:00
Scott Richmond
010f0b53c1 build
Former-commit-id: 1158821aff
2025-07-02 14:52:22 -04:00
Scott Richmond
d9b9ddc654 ready handshake for better message passing
Former-commit-id: cfe8009861
2025-07-02 14:51:42 -04:00
Scott Richmond
b466d76b2f build
Former-commit-id: 33b7f78038
2025-07-02 13:49:36 -04:00
Scott Richmond
a807ac0b58 prevent rust panic on kill signal
Former-commit-id: 116a5b2ed9
2025-07-02 13:44:26 -04:00
Scott Richmond
3a720e3163 actually (?!) fix drunk turtle problem
Former-commit-id: 9414dc64d9
2025-07-01 20:10:24 -04:00
Scott Richmond
4889da3368 try again
Former-commit-id: 197cbfc795
2025-07-01 20:07:02 -04:00
Scott Richmond
0710f23603 maybe fix drunk turtle bug?
Former-commit-id: f3801b3c37
2025-07-01 19:55:49 -04:00
Scott Richmond
4547d9fe51 another wasm release
Former-commit-id: f8983d24a4
2025-07-01 19:20:33 -04:00
Scott Richmond
bd8004146c wasm release
Former-commit-id: e5467e9e7e
2025-07-01 19:08:13 -04:00
Scott Richmond
e79ac7859e thoughts
Former-commit-id: bba3e1e800
2025-07-01 19:07:16 -04:00
Scott Richmond
d68f1bfa4e get reading input up and running
Former-commit-id: b7ff0eda80
2025-07-01 19:04:38 -04:00
Scott Richmond
ee41d99393 get fetch up & running
Former-commit-id: 5b2fd5e2d7
2025-07-01 18:52:03 -04:00
Scott Richmond
6111d3e2e8 get input working
Former-commit-id: b12d0e00aa
2025-07-01 16:59:42 -04:00
Scott Richmond
3765edd8d9 update worker url resolution
Former-commit-id: 808368d2b9
2025-07-01 16:30:17 -04:00
Scott Richmond
4ad6ccf355 fix worker path
Former-commit-id: 88ff5886bb
2025-07-01 16:07:01 -04:00
Scott Richmond
63ac8fe80c get commands wired up, probs
Former-commit-id: 1ec60b9362
2025-07-01 14:35:36 -04:00
Scott Richmond
8d011f1212 fix FF event loop bug
Former-commit-id: 400bd5864b
2025-07-01 12:54:11 -04:00
Scott Richmond
e5e1d9ba0e add thoughts
Former-commit-id: 991705e734
2025-07-01 11:10:50 -04:00
Scott Richmond
3c93cd67ea stash changes
Former-commit-id: 989e217917
2025-07-01 10:42:34 -04:00
Scott Richmond
5a6b7387d9 fix truly heinous memory bug
Former-commit-id: 4e7557cbcc
2025-07-01 01:30:10 -04:00
Scott Richmond
ac089eeb22 hook the things up and discover a possible stop-the-world bug
Former-commit-id: 2f3f362f49
2025-07-01 00:43:01 -04:00
Scott Richmond
82a20f00c3 integration work continues
Former-commit-id: 4eceb62ce5
2025-06-30 18:59:59 -04:00
Scott Richmond
27e035c545 also add the new io file
Former-commit-id: 173fdb913c
2025-06-30 12:49:07 -04:00
Scott Richmond
0608caf90c stub out first pass of io system
Former-commit-id: bc49ece0cf
2025-06-30 12:48:50 -04:00
Scott Richmond
cc3020f22b use a hashset instead of vec for dead ids
Former-commit-id: 5478e5e40e
2025-06-29 18:14:06 -04:00
Scott Richmond
a02eb06279 start working on packaging better
Former-commit-id: f6cbe3f800
2025-06-29 18:13:49 -04:00
Scott Richmond
ac3c74ac8e update chumsky, lose ariadne, update parser to conform to new chumsky
Former-commit-id: c62b5c903d
2025-06-29 18:08:44 -04:00
Scott Richmond
442cdffa61 add a justfile, some project management
Former-commit-id: de6cb5380d
2025-06-29 17:47:08 -04:00
Scott Richmond
74a173a415 save work
Former-commit-id: 4dd47dd56c
2025-06-29 11:38:45 -04:00
Scott Richmond
542abc6d43 actually get receive working????
Former-commit-id: f710beff46
2025-06-28 16:40:31 -04:00
Scott Richmond
c61eeae690 some notes
Former-commit-id: f873be7668
2025-06-27 20:54:48 -04:00
Scott Richmond
2361750f31 make progress, I guess
Former-commit-id: 48342ba4ea
2025-06-27 20:41:29 -04:00
Scott Richmond
70531c5922 parser housekeeping; add receive to lexer and parser
Former-commit-id: db52bc2687
2025-06-27 19:15:59 -04:00
Scott Richmond
f3d8e9caf1 move Ast into its own module
Former-commit-id: a175ee7a41
2025-06-27 19:05:17 -04:00
Scott Richmond
56771bf1df ugh. spin my wheels a lot. decide to start work on the receive special form
Former-commit-id: 759fc63cae
2025-06-27 18:48:27 -04:00
Scott Richmond
948a874e4a add sleep, which was unexpectedly titchy!
Former-commit-id: 8923581eed
2025-06-27 14:27:42 -04:00
Scott Richmond
c382b2c1d3 make some new process functions
Former-commit-id: 90505f89fe
2025-06-27 12:27:54 -04:00
Scott Richmond
f20f9ee64b some notes for tomorrow's work
Former-commit-id: 00ebac17ce
2025-06-26 23:28:17 -04:00
Scott Richmond
1136c6ca79 send messages, motherfucker!
Former-commit-id: 888f5b62da
2025-06-26 20:30:40 -04:00
Scott Richmond
1754a6fd12 add a process value
Former-commit-id: c144702b98
2025-06-26 17:17:41 -04:00
Scott Richmond
ef9dc7d6bd devise a way of communicating between ludus and processes
Former-commit-id: 801e5bcc01
2025-06-26 17:15:00 -04:00
Scott Richmond
07da35f1b6 refactor to have a world run a process
Former-commit-id: b35657e698
2025-06-26 16:11:35 -04:00
Scott Richmond
f81a7e7b8a start work on actor model
Former-commit-id: b5528ced8f
2025-06-26 01:28:33 -04:00
Scott Richmond
b4d3876ed0 maybe get git right? ugh
Former-commit-id: 0c17b64fd7
2025-06-25 23:21:22 -04:00
Scott Richmond
ddbc1836b0 fix blasted merge conflicts
Former-commit-id: 97547b1f7f
2025-06-25 23:18:59 -04:00
Scott Richmond
4337fc2061 cleanup before next text publish
Former-commit-id: e86f077247
2025-06-25 22:58:29 -04:00
Scott Richmond
f570cc3154 maybe figure out the wasm thing?
Former-commit-id: 44f7ce7b06
2025-06-25 22:56:39 -04:00
6 changed files with 176 additions and 51 deletions

View File

@ -1299,7 +1299,11 @@ let pd! = pendown!
fn pencolor! { fn pencolor! {
"Changes the turtle's pen color. Takes a single grayscale value, an rgb tuple, or an rgba tuple. Alias: `pencolour!`, `pc!`" "Changes the turtle's pen color. Takes a single grayscale value, an rgb tuple, or an rgba tuple. Alias: `pencolour!`, `pc!`"
(color as :keyword) -> add_command! (:turtle_0, (:pencolor, color)) (color as :keyword) -> {
if color (colors)
then add_command! (:turtle_0, (:pencolor, color))
else panic! ("There is no color named {color} in the colors dict.")
}
(gray as :number) -> add_command! (:turtle_0, (:pencolor, (gray, gray, gray, 255))) (gray as :number) -> add_command! (:turtle_0, (:pencolor, (gray, gray, gray, 255)))
((r as :number, g as :number, b as :number)) -> add_command! (:turtle_0, (:pencolor, (r, g, b, 255))) ((r as :number, g as :number, b as :number)) -> add_command! (:turtle_0, (:pencolor, (r, g, b, 255)))
((r as :number, g as :number, b as :number, a as :number)) -> add_command! (:turtle_0, (:pencolor, (r, g, b, a))) ((r as :number, g as :number, b as :number, a as :number)) -> add_command! (:turtle_0, (:pencolor, (r, g, b, a)))
@ -1368,16 +1372,29 @@ fn loadstate! {
fn turtle_listener () -> { fn turtle_listener () -> {
receive { receive {
(:forward!, steps as :number) -> add_command! (self (), (:forward, steps)) (:forward!, steps as :number) -> add_command! (self (), (:forward, steps))
(:fd!, steps as :number) -> add_command! (self (), (:forward, steps))
(:back!, steps as :number) -> add_command! (self (), (:back, steps)) (:back!, steps as :number) -> add_command! (self (), (:back, steps))
(:bk!, steps as :number) -> add_command! (self (), (:back, steps))
(:left!, turns as :number) -> add_command! (self (), (:left, turns)) (:left!, turns as :number) -> add_command! (self (), (:left, turns))
(:lt!, turns as :number) -> add_command! (self (), (:left, turns))
(:right!, turns as :number) -> add_command! (self (), (:right, turns)) (:right!, turns as :number) -> add_command! (self (), (:right, turns))
(:rt!, turns as :number) -> add_command! (self (), (:right, turns))
(:penup!) -> add_command! (self (), (:penup)) (:penup!) -> add_command! (self (), (:penup))
(:pu!) -> add_command! (self (), (:penup))
(:pendown!) -> add_command! (self (), (:pendown)) (:pendown!) -> add_command! (self (), (:pendown))
(:pencolor!, color as :keyword) -> add_command! (self (), (:pencolor, color)) (:pd!) -> add_command! (self (), (:pendown))
(:pencolor!, color as :keyword) -> if color (colors)
then add_command! (self (), (:pencolor, color))
else panic! ("There is no color {color} in the colors dict.")
(:pencolor!, gray as :number) -> add_command! (self (), (:pencolor, (gray, gray, gray, 255))) (:pencolor!, gray as :number) -> add_command! (self (), (:pencolor, (gray, gray, gray, 255)))
(:pencolor!, (r as :number, g as :number, b as :number)) -> add_command! (self (), (:pencolor, (r, g, b, 255))) (:pencolor!, (r as :number, g as :number, b as :number)) -> add_command! (self (), (:pencolor, (r, g, b, 255)))
(:pencolor!, (r as :number, g as :number, b as :number, a as :number)) -> add_command! (self (), (:pencolor, (r, g, b, a))) (:pencolor!, (r as :number, g as :number, b as :number, a as :number)) -> add_command! (self (), (:pencolor, (r, g, b, a)))
(:pc!, color as :keyword) -> add_command! (self (), (:pencolor, color))
(:pc!, gray as :number) -> add_command! (self (), (:pencolor, (gray, gray, gray, 255)))
(:pc!, (r as :number, g as :number, b as :number)) -> add_command! (self (), (:pencolor, (r, g, b, 255)))
(:pc!, (r as :number, g as :number, b as :number, a as :number)) -> add_command! (self (), (:pencolor, (r, g, b, a)))
(:penwidth!, width as :number) -> add_command! (self (), (:penwidth, width)) (:penwidth!, width as :number) -> add_command! (self (), (:penwidth, width))
(:pw!, width as :number) -> add_command! (self (), (:penwidth, width))
(:home!) -> add_command! (self (), (:home)) (:home!) -> add_command! (self (), (:home))
(:goto!, x as :number, y as :number) -> add_command! (self (), (:goto, (x, y))) (:goto!, x as :number, y as :number) -> add_command! (self (), (:goto, (x, y)))
(:goto!, (x as :number, y as :number)) -> add_command! (self (), (:goto, (x, y))) (:goto!, (x as :number, y as :number)) -> add_command! (self (), (:goto, (x, y)))

View File

@ -68,11 +68,13 @@ export function p5 (commands) {
const new_state = command_to_state(prev_state, this_command) const new_state = command_to_state(prev_state, this_command)
all_states[turtle_id].push(new_state) all_states[turtle_id].push(new_state)
} }
console.log(all_states)
const [r, g, b, _] = resolve_color(background_color) const [r, g, b, _] = resolve_color(background_color)
if ((r + g + b)/3 > 128) set_turtle_color([0, 0, 0, 150]) if ((r + g + b)/3 > 128) set_turtle_color([0, 0, 0, 150])
const p5_calls = [...p5_call_root()] const p5_calls = [...p5_call_root()]
for (const states of Object.values(all_states)) { for (const states of Object.values(all_states)) {
// console.log(states) p5_calls.push(["strokeWeight", 1])
p5_calls.push(["stroke", 255])
for (let i = 1; i < states.length; ++i) { for (let i = 1; i < states.length; ++i) {
const prev = states[i - 1] const prev = states[i - 1]
const curr = states[i] const curr = states[i]

4
pkg/rudus.d.ts vendored
View File

@ -14,8 +14,8 @@ export interface InitOutput {
readonly __wbindgen_malloc: (a: number, b: number) => number; readonly __wbindgen_malloc: (a: number, b: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_export_6: WebAssembly.Table; readonly __wbindgen_export_6: WebAssembly.Table;
readonly closure355_externref_shim: (a: number, b: number, c: any) => void; readonly closure362_externref_shim: (a: number, b: number, c: any) => void;
readonly closure368_externref_shim: (a: number, b: number, c: any, d: any) => void; readonly closure385_externref_shim: (a: number, b: number, c: any, d: any) => void;
readonly __wbindgen_start: () => void; readonly __wbindgen_start: () => void;
} }

View File

@ -17,6 +17,22 @@ function handleError(f, args) {
} }
} }
function logError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
let error = (function () {
try {
return e instanceof Error ? `${e.message}\n\nStack:\n${e.stack}` : e.toString();
} catch(_) {
return "<failed to stringify thrown value>";
}
}());
console.error("wasm-bindgen: imported JS function that was not marked as `catch` threw an error:", error);
throw e;
}
}
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@ -54,6 +70,8 @@ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
function passStringToWasm0(arg, malloc, realloc) { function passStringToWasm0(arg, malloc, realloc) {
if (typeof(arg) !== 'string') throw new Error(`expected a string argument, found ${typeof(arg)}`);
if (realloc === undefined) { if (realloc === undefined) {
const buf = cachedTextEncoder.encode(arg); const buf = cachedTextEncoder.encode(arg);
const ptr = malloc(buf.length, 1) >>> 0; const ptr = malloc(buf.length, 1) >>> 0;
@ -82,7 +100,7 @@ function passStringToWasm0(arg, malloc, realloc) {
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
const ret = encodeString(arg, view); const ret = encodeString(arg, view);
if (ret.read !== arg.length) throw new Error('failed to pass whole string');
offset += ret.written; offset += ret.written;
ptr = realloc(ptr, len, offset, 1) >>> 0; ptr = realloc(ptr, len, offset, 1) >>> 0;
} }
@ -104,6 +122,12 @@ function isLikeNone(x) {
return x === undefined || x === null; return x === undefined || x === null;
} }
function _assertBoolean(n) {
if (typeof(n) !== 'boolean') {
throw new Error(`expected a boolean argument, found ${typeof(n)}`);
}
}
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
? { register: () => {}, unregister: () => {} } ? { register: () => {}, unregister: () => {} }
: new FinalizationRegistry(state => { : new FinalizationRegistry(state => {
@ -134,6 +158,71 @@ function makeMutClosure(arg0, arg1, dtor, f) {
CLOSURE_DTORS.register(real, state, state); CLOSURE_DTORS.register(real, state, state);
return real; return real;
} }
function debugString(val) {
// primitive types
const type = typeof val;
if (type == 'number' || type == 'boolean' || val == null) {
return `${val}`;
}
if (type == 'string') {
return `"${val}"`;
}
if (type == 'symbol') {
const description = val.description;
if (description == null) {
return 'Symbol';
} else {
return `Symbol(${description})`;
}
}
if (type == 'function') {
const name = val.name;
if (typeof name == 'string' && name.length > 0) {
return `Function(${name})`;
} else {
return 'Function';
}
}
// objects
if (Array.isArray(val)) {
const length = val.length;
let debug = '[';
if (length > 0) {
debug += debugString(val[0]);
}
for(let i = 1; i < length; i++) {
debug += ', ' + debugString(val[i]);
}
debug += ']';
return debug;
}
// Test for built-in
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
let className;
if (builtInMatches && builtInMatches.length > 1) {
className = builtInMatches[1];
} else {
// Failed to match the standard '[object ClassName]'
return toString.call(val);
}
if (className == 'Object') {
// we're a user defined class or Object
// JSON.stringify avoids problems with cycles, and is generally much
// easier than looping through ownProperties of `val`.
try {
return 'Object(' + JSON.stringify(val) + ')';
} catch (_) {
return 'Object';
}
}
// errors
if (val instanceof Error) {
return `${val.name}: ${val.message}\n${val.stack}`;
}
// TODO we could test for more things here, like `Set`s and `Map`s.
return className;
}
/** /**
* @param {string} src * @param {string} src
* @returns {Promise<void>} * @returns {Promise<void>}
@ -145,12 +234,19 @@ export function ludus(src) {
return ret; return ret;
} }
function __wbg_adapter_18(arg0, arg1, arg2) { function _assertNum(n) {
wasm.closure355_externref_shim(arg0, arg1, arg2); if (typeof(n) !== 'number') throw new Error(`expected a number argument, found ${typeof(n)}`);
}
function __wbg_adapter_20(arg0, arg1, arg2) {
_assertNum(arg0);
_assertNum(arg1);
wasm.closure362_externref_shim(arg0, arg1, arg2);
} }
function __wbg_adapter_44(arg0, arg1, arg2, arg3) { function __wbg_adapter_46(arg0, arg1, arg2, arg3) {
wasm.closure368_externref_shim(arg0, arg1, arg2, arg3); _assertNum(arg0);
_assertNum(arg1);
wasm.closure385_externref_shim(arg0, arg1, arg2, arg3);
} }
async function __wbg_load(module, imports) { async function __wbg_load(module, imports) {
@ -195,7 +291,7 @@ function __wbg_get_imports() {
const ret = arg0.call(arg1, arg2); const ret = arg0.call(arg1, arg2);
return ret; return ret;
}, arguments) }; }, arguments) };
imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) { imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function() { return logError(function (arg0, arg1) {
let deferred0_0; let deferred0_0;
let deferred0_1; let deferred0_1;
try { try {
@ -205,7 +301,7 @@ function __wbg_get_imports() {
} finally { } finally {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1); wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
} }
}; }, arguments) };
imports.wbg.__wbg_io_5a3c8ea72d8c6ea3 = function() { return handleError(function (arg0, arg1) { imports.wbg.__wbg_io_5a3c8ea72d8c6ea3 = function() { return handleError(function (arg0, arg1) {
let deferred0_0; let deferred0_0;
let deferred0_1; let deferred0_1;
@ -218,17 +314,17 @@ function __wbg_get_imports() {
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1); wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
} }
}, arguments) }; }, arguments) };
imports.wbg.__wbg_log_11652c6a56eeddfb = function(arg0, arg1) { imports.wbg.__wbg_log_11652c6a56eeddfb = function() { return logError(function (arg0, arg1) {
console.log(getStringFromWasm0(arg0, arg1)); console.log(getStringFromWasm0(arg0, arg1));
}; }, arguments) };
imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) { imports.wbg.__wbg_new_23a2665fac83c611 = function() { return logError(function (arg0, arg1) {
try { try {
var state0 = {a: arg0, b: arg1}; var state0 = {a: arg0, b: arg1};
var cb0 = (arg0, arg1) => { var cb0 = (arg0, arg1) => {
const a = state0.a; const a = state0.a;
state0.a = 0; state0.a = 0;
try { try {
return __wbg_adapter_44(a, state0.b, arg0, arg1); return __wbg_adapter_46(a, state0.b, arg0, arg1);
} finally { } finally {
state0.a = a; state0.a = a;
} }
@ -238,65 +334,65 @@ function __wbg_get_imports() {
} finally { } finally {
state0.a = state0.b = 0; state0.a = state0.b = 0;
} }
}; }, arguments) };
imports.wbg.__wbg_new_8a6f238a6ece86ea = function() { imports.wbg.__wbg_new_8a6f238a6ece86ea = function() { return logError(function () {
const ret = new Error(); const ret = new Error();
return ret; return ret;
}; }, arguments) };
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) { imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function() { return logError(function (arg0, arg1) {
const ret = new Function(getStringFromWasm0(arg0, arg1)); const ret = new Function(getStringFromWasm0(arg0, arg1));
return ret; return ret;
}; }, arguments) };
imports.wbg.__wbg_now_8dddb61fa4928554 = function() { imports.wbg.__wbg_now_8dddb61fa4928554 = function() { return logError(function () {
const ret = Date.now(); const ret = Date.now();
return ret; return ret;
}; }, arguments) };
imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) { imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function() { return logError(function (arg0) {
queueMicrotask(arg0); queueMicrotask(arg0);
}; }, arguments) };
imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) { imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function() { return logError(function (arg0) {
const ret = arg0.queueMicrotask; const ret = arg0.queueMicrotask;
return ret; return ret;
}; }, arguments) };
imports.wbg.__wbg_random_57c118f142535bb6 = function() { imports.wbg.__wbg_random_57c118f142535bb6 = function() { return logError(function () {
const ret = Math.random(); const ret = Math.random();
return ret; return ret;
}; }, arguments) };
imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) { imports.wbg.__wbg_resolve_4851785c9c5f573d = function() { return logError(function (arg0) {
const ret = Promise.resolve(arg0); const ret = Promise.resolve(arg0);
return ret; return ret;
}; }, arguments) };
imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) { imports.wbg.__wbg_stack_0ed75d68575b0f3c = function() { return logError(function (arg0, arg1) {
const ret = arg1.stack; const ret = arg1.stack;
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN; const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
}; }, arguments) };
imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() { imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() { return logError(function () {
const ret = typeof global === 'undefined' ? null : global; const ret = typeof global === 'undefined' ? null : global;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}; }, arguments) };
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() { imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() { return logError(function () {
const ret = typeof globalThis === 'undefined' ? null : globalThis; const ret = typeof globalThis === 'undefined' ? null : globalThis;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}; }, arguments) };
imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() { imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() { return logError(function () {
const ret = typeof self === 'undefined' ? null : self; const ret = typeof self === 'undefined' ? null : self;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}; }, arguments) };
imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() { imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() { return logError(function () {
const ret = typeof window === 'undefined' ? null : window; const ret = typeof window === 'undefined' ? null : window;
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
}; }, arguments) };
imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) { imports.wbg.__wbg_then_44b73946d2fb3e7d = function() { return logError(function (arg0, arg1) {
const ret = arg0.then(arg1); const ret = arg0.then(arg1);
return ret; return ret;
}; }, arguments) };
imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) { imports.wbg.__wbg_then_48b406749878a531 = function() { return logError(function (arg0, arg1, arg2) {
const ret = arg0.then(arg1, arg2); const ret = arg0.then(arg1, arg2);
return ret; return ret;
}; }, arguments) };
imports.wbg.__wbindgen_cb_drop = function(arg0) { imports.wbg.__wbindgen_cb_drop = function(arg0) {
const obj = arg0.original; const obj = arg0.original;
if (obj.cnt-- == 1) { if (obj.cnt-- == 1) {
@ -304,11 +400,19 @@ function __wbg_get_imports() {
return true; return true;
} }
const ret = false; const ret = false;
_assertBoolean(ret);
return ret; return ret;
}; };
imports.wbg.__wbindgen_closure_wrapper1080 = function(arg0, arg1, arg2) { imports.wbg.__wbindgen_closure_wrapper8195 = function() { return logError(function (arg0, arg1, arg2) {
const ret = makeMutClosure(arg0, arg1, 356, __wbg_adapter_18); const ret = makeMutClosure(arg0, arg1, 363, __wbg_adapter_20);
return ret; return ret;
}, arguments) };
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
const ret = debugString(arg1);
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len1 = WASM_VECTOR_LEN;
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
}; };
imports.wbg.__wbindgen_init_externref_table = function() { imports.wbg.__wbindgen_init_externref_table = function() {
const table = wasm.__wbindgen_export_2; const table = wasm.__wbindgen_export_2;
@ -322,10 +426,12 @@ function __wbg_get_imports() {
}; };
imports.wbg.__wbindgen_is_function = function(arg0) { imports.wbg.__wbindgen_is_function = function(arg0) {
const ret = typeof(arg0) === 'function'; const ret = typeof(arg0) === 'function';
_assertBoolean(ret);
return ret; return ret;
}; };
imports.wbg.__wbindgen_is_undefined = function(arg0) { imports.wbg.__wbindgen_is_undefined = function(arg0) {
const ret = arg0 === undefined; const ret = arg0 === undefined;
_assertBoolean(ret);
return ret; return ret;
}; };
imports.wbg.__wbindgen_string_get = function(arg0, arg1) { imports.wbg.__wbindgen_string_get = function(arg0, arg1) {

BIN
pkg/rudus_bg.wasm (Stored with Git LFS)

Binary file not shown.

View File

@ -9,6 +9,6 @@ export const __wbindgen_free: (a: number, b: number, c: number) => void;
export const __wbindgen_malloc: (a: number, b: number) => number; export const __wbindgen_malloc: (a: number, b: number) => number;
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
export const __wbindgen_export_6: WebAssembly.Table; export const __wbindgen_export_6: WebAssembly.Table;
export const closure355_externref_shim: (a: number, b: number, c: any) => void; export const closure362_externref_shim: (a: number, b: number, c: any) => void;
export const closure368_externref_shim: (a: number, b: number, c: any, d: any) => void; export const closure385_externref_shim: (a: number, b: number, c: any, d: any) => void;
export const __wbindgen_start: () => void; export const __wbindgen_start: () => void;