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:
co-authored by
Claude Opus 5.5
parent
183821737e
commit
9cbefeb2be
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user