refactor: NCS-8 removed Context and replaced it with History

This commit is contained in:
2026-03-28 16:08:35 +01:00
parent 4d800e88eb
commit 7bfd2468ce
15 changed files with 396 additions and 583 deletions
@@ -8,10 +8,12 @@ object Board:
extension (b: Board)
def pieceAt(sq: Square): Option[Piece] = b.get(sq)
def updated(sq: Square, piece: Piece): Board = b.updated(sq, piece)
def removed(sq: Square): Board = b.removed(sq)
def withMove(from: Square, to: Square): (Board, Option[Piece]) =
val captured = b.get(to)
val updated = b.removed(from).updated(to, b(from))
(updated, captured)
val updatedBoard = b.removed(from).updated(to, b(from))
(updatedBoard, captured)
def pieces: Map[Square, Piece] = b
val initial: Board =