commit 56e4038c96bfb0f453f37b5fad5581ed7d59e5c9
parent 7ef256ffb4f03490b479f1ff3f7d1f560c5ce6f8
Author: Alex Wennerberg <alex@Alexs-Air.lan>
Date: Fri, 2 Jan 2026 18:48:35 -0800
WIP day 1 (part 1 works, bug in part 2)
Diffstat:
4 files changed, 35 insertions(+), 17 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -0,0 +1,2 @@
+input
+sample
diff --git a/01.f b/01.f
@@ -0,0 +1,23 @@
+\ 5866 too low
+
+\ utilities
+4545 constant input-size
+: tibs ( -- a u ) tib >limit @ tib - ;
+: s>n ( a u -- n ) 0 -rot 0 do dup r@ + c@ h# 30 - rot 10 * + swap loop drop ;
+
+\ solution
+variable password
+variable passwordB \ for short
+: rotation ( a u -- n ) over c@ [char] O - 3 / -rot 1 /string s>n * ;
+: wrap100+ ( n1 n2 -- n ) + dup 0 < if 100 mod 100 swap - then 100 mod ;
+: count-crosses ( n1 n2 -- ) 2dup over 0= if drop drop exit then + 100 /mod abs swap 0< + .s cr passwordB +! ;
+: solve ( -- ) 50
+ input-size 0 do
+ query tibs rotation count-crosses wrap100+
+ dup 0= if 1 password +! then
+ loop
+ password @ . cr
+ password @
+ passwordB @ + .s cr
+ bye ;
+solve
diff --git a/01.scm b/01.scm
@@ -1,15 +0,0 @@
-(import (chicken io)
- (sequences))
-
-(define pass 0)
-(define pass0x434C49434B 0)
-(foldl (lambda (a move)
- (if (= a 0) (set! pass (+ pass 1)))
- (modulo
- ((if (char=? #\R (string-ref move 0)) + -) a (string->number (substring move 1)))
- 100)
- )
- 50
- (read-lines))
-(print pass)
-(print pass0x434C49434B)
diff --git a/README.md b/README.md
@@ -1,8 +1,16 @@
-# Advent of Code 2025 in Scheme
+# Advent of Code 2025 in Forth
The abbreviated season.
-In [CHICKEN Scheme](https://call-cc.org/)
+In [UF Forth](http://www.call-with-current-continuation.org/uf/uf.html) for the [Uxn/Varvara](https://100r.co/site/uxn.html) system.
+
+To run, first install the uxn toolset, then build uf as described in its README. We'll use `uf.rom`
+
+```
+cat 01.f input | uxncli uf.rom
+```
+
+This will print each solution on a line
Previous years: