commit c856b10ffb2ee95198f94e30985abcd0610208cd parent 5da15dd8cf425a89f4ec9358b8d473a99f22705a Author: alex wennerberg <alex@alexwennerberg.com> Date: Sun, 11 Dec 2022 03:14:46 -0800 start day 11 Diffstat:
M | 2022/10.fs | | | 2 | +- |
A | 2022/11.fs | | | 31 | +++++++++++++++++++++++++++++++ |
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/2022/10.fs b/2022/10.fs @@ -7,7 +7,7 @@ variable signalsum if xreg @ * signalsum +! else drop then ; : dostep signalcheck 1 cycle +! ; -: addx dostep dostep interpret xreg +! ; +: addx dostep dostep bl word number drop xreg +! ; : noop dostep ; include input.txt signalsum ? diff --git a/2022/11.fs b/2022/11.fs @@ -0,0 +1,31 @@ +begin-structure monkey +16 +field items +\ all xts +field: operation +field: test +field: next-monkey +end-structure + +: monkeyarr ( u -- ) create monkey * allot + does> ( u -- a ) swap monkey * + ; + +8 monkeyarr monkeys + +variable monkeyptr +: Monkey [char] : word number monkeys monkeyptr ! ; +: Starting 0 bl word drop begin [char] , word number drop 0= until drop ; + +variable (old) +: old (old) @ ; +: = noop ; +\ make operators infix (lol) +: + bl word number + ; +: * bl word number * ; +: Operation: ( build execution token ) monkeyptr operation !; +: Test: ; +: If ; + +include sample.txt + +: run ; +run