summaryrefslogtreecommitdiff
path: root/2024/OCaml/lib/grid/cell.ml
diff options
context:
space:
mode:
authorDJ O'Leary <dijitol@proton.me>2025-08-19 00:48:54 +0200
committerDJ O'Leary <dijitol@proton.me>2025-08-19 00:49:06 +0200
commitdbdeb7eaf3b92308e4895eb76dd9f3c5dae5b041 (patch)
treeff33f18e876fd3e4b23492c6241b03061b741de0 /2024/OCaml/lib/grid/cell.ml
parentbb9b8f0d29195f19df38608af9371a18c45b6d61 (diff)
some change idk
Diffstat (limited to '2024/OCaml/lib/grid/cell.ml')
-rw-r--r--2024/OCaml/lib/grid/cell.ml18
1 files changed, 18 insertions, 0 deletions
diff --git a/2024/OCaml/lib/grid/cell.ml b/2024/OCaml/lib/grid/cell.ml
new file mode 100644
index 0000000..186e451
--- /dev/null
+++ b/2024/OCaml/lib/grid/cell.ml
@@ -0,0 +1,18 @@
+type t = {
+ value : string;
+ up : t option;
+ down : t option;
+ left : t option;
+ right : t option;
+}
+
+let create value = { value; up = None; down = None; left = None; right = None }
+let with_up up c = { c with up = Some up }
+let with_down down c = { c with down = Some down }
+let with_left left c = { c with left = Some left }
+let with_right right c = { c with right = Some right }
+let move_up co = match co with Some c -> c.up | None -> None
+let move_down co = match co with Some c -> c.down | None -> None
+let move_left co = match co with Some c -> c.left | None -> None
+let move_right co = match co with Some c -> c.right | None -> None
+let ( = ) c1 c2 = c1.value = c2.value