ocaml: phase 5.1 tic_tac_toe.ml baseline (3x3 winner check, X wins top row = 1)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 47s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 47s
Board as 9-element flat int array, 0=empty, 1=X, 2=O. Three predicate functions: check_row b r check_col b c check_diag b each return the winning player's mark or 0. Main 'winner' loops i = 0..2 calling row(i)/col(i) then check_diag, threading via a result ref. Test board: X X X . O . . . O X wins on row 0 -> winner returns 1. Tests Array.of_list with row-major 'b.(r * 3 + c)' indexing, multi-fn collaboration, and structural equality on int values. 66 baseline programs total.
This commit is contained in:
@@ -407,6 +407,13 @@ _Newest first._
|
||||
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
|
||||
'a tree`) with insert + in-order traversal. Tests parametric ADT,
|
||||
recursive match, List.append, List.fold_left.
|
||||
- 2026-05-09 Phase 5.1 — tic_tac_toe.ml baseline (3x3 winner check,
|
||||
X wins top row → 1). Board encoded as 9-element flat int array
|
||||
with 0=empty, 1=X, 2=O. Three predicate functions check row,
|
||||
column, and either diagonal; main `winner` loops over the 8
|
||||
winning lines. Tests Array.of_list with row-major indexing,
|
||||
multi-fn collaboration, and structural equality on int values.
|
||||
66 baseline programs total.
|
||||
- 2026-05-09 Phase 5.1 — subset_sum.ml baseline (count subsets of
|
||||
[1..8] summing to 10 = 8). Pure recursion: at each element, take
|
||||
it or don't. Base case: target=0 → 1, target≠0 → 0. 2^8 = 256
|
||||
|
||||
Reference in New Issue
Block a user