feat(fsharp): m01-m06 util, model, rules, random, spawn, game, view with Expecto tests

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-29 00:49:42 +01:00
co-authored by Claude Opus 5.5
parent 183821737e
commit 9cbefeb2be
27 changed files with 851 additions and 6 deletions
+11 -1
View File
@@ -1,2 +1,12 @@
/// Placeholder; replaced by the m01 utilities.
/// m01 util: small helpers used by every later module.
/// (The JavaScript track also writes `pipe` and `compose` here; F# has them built in as `|>` and `>>`.)
module Snake.Util
let range (n: int) : int list = [ 0 .. n - 1 ]
let dropLast (xs: 'a list) : 'a list =
match xs with
| [] -> []
| _ -> List.take (List.length xs - 1) xs
let contains (xs: 'a list) (p: 'a) (eq: 'a -> 'a -> bool) : bool = List.exists (fun x -> eq x p) xs