Commit graph

20 commits

Author SHA1 Message Date
eaab34587c [board, explorer, moves] Make Board::active_color private
Make the struct attribute private, and export two new methods. A getter, active_color(),
and a setter, set_active_color().

Update all references to the attribute to use the methods.
2025-06-02 17:29:52 -07:00
8f42a4c94e [explorer, moves, position] Implement bespoke make_move and unmake_move methods on Position
Instead of inheriting the MakeMove and UnmakeMove traits by being a BoardProvider,
implement bespoke versions of these two methods. This gives Position a chance to
do some of its own work (tracking captures, move records, etc) when making a move.

Pass the move record by reference to the unmake_move() method. Saves a copy.

Export the Result types for MakeMove and UnmakeMove.
2025-06-01 19:02:53 -07:00
942d9fe47b [explorer, moves, position] Implement a moves command in explorer
The moves command writes all possible moves to the terminal.

Move the previous implementation of the moves command, which marked squares that
a piece could move to, to a 'movement' command.
2025-05-28 16:25:55 -07:00
10ba21f7e3 [explorer] Remove the unused starting command; add aliases to make (m) and place (p) 2025-05-21 08:27:15 -07:00
9010f1e9c2 [explorer, moves, core] Improve error handling in explorer
Implement thiserror::Error for a bunch of error types, and remove string errors
from the implementation of the command handler in explorer.

Clean up parsing of basic types all over the place.

Update Cargo files to include thiserror and anyhow.
2025-05-19 14:18:31 -07:00
72eeba84ba [explorer] Specify the chessfriend_board dependency 2025-05-19 08:42:53 -07:00
39ca74459d [explorer] Implement a reset command
Resets the board to an empty or starting state, or to a position specified by a FEN string.
2025-05-19 08:42:34 -07:00
d67c2cfb99 [explorer] A bunch of random changes to this binary
Too many changes mixed up together to tease apart.
2025-05-19 08:41:48 -07:00
00c4aa38f0 [explorer] make command no longer requires specifying a piece 2025-05-19 08:38:52 -07:00
539b1fca6e [expolorer] Add two new commands for showing available moves and sight of a piece on a square 2025-05-19 08:28:23 -07:00
f1cd36952b Fix build errors in explorer 2024-02-25 09:52:49 -08:00
ed55eda901 Update the Cargo.toml files 2024-01-28 09:58:50 -08:00
569693bda9 Merge branch 'main' into rename-board-crate
# Conflicts:
#	explorer/src/main.rs
2024-01-28 09:55:53 -08:00
8eb180df67 [explorer] Add fen and make commands
Clean up the implementation of the place command.

Track state with a State struct that contains a position and a builder. The place
command will place a new piece and then regenerate the position.

The make command makes a move. The syntax is:

    make [color:w|b] [shape] [from square] [to square]

The fen command prints a FEN string representing the position.
2024-01-28 09:50:39 -08:00
66d03d3514 [board] Clean up a bunch of imports 2024-01-28 09:46:38 -08:00
76ac719418 [position] Rename the board crate → chessfriend_position in Cargo.toml
Rename the crate, but don't move any files.
2024-01-28 09:40:45 -08:00
a73355c769 [explorer] Track result of command with a CommandResult type, and overall state with a State type 2024-01-24 17:16:33 -08:00
d901be53d2 [explorer] Depends on core 2024-01-24 09:15:18 -08:00
7071f6a742 [board] Cave to pressure and implement fmt::Display for Position
It prints a nice diagram!

Now I can make the position module private.
2024-01-19 18:12:28 -08:00
f340578cf2 [explorer] A REPL-style command line app to fiddle with chess boards
Build a REPL that enables placing pieces on a chess board. Nothing else so far!
2023-12-28 15:09:15 -07:00