flan/test/programs/sand-headless.flan

28 lines
1.0 KiB
Plaintext

;;;; sand.flan's other half: N frames, no window, hash the grid.
;;;;
;;;; This is the version CI runs on native *and* wasm32, which is why it does
;;;; not import the raylib package — a program that does links libraylib on
;;;; every target regardless of what its main does. The simulation itself is
;;;; shared with the interactive driver; only the input differs.
;;;;
;;;; The hash is a regression test only because the sequence is reproducible:
;;;; rand-f32 is a seeded PRNG written in Flan, so the same seed gives the same
;;;; grains in the same places on both targets (plan.org, RNG is ours).
(import sim "../../sand-sim")
(defconst frames 40)
(defn main [] i32
(rand-seed 20260910)
;; Four clouds, spread across the top, one per colour. Deterministic
;; positions: the mouse is what the interactive driver has and this does not.
(dotimes [i 4]
(sim/next-color)
(sim/paint-at 4 (* (+ i 1) (/ sim/cols 5))))
(dotimes [f frames]
(sim/step))
(print-i64 (i64 (sim/hash-grid)))
(newline)
0)