Commit graph

17 commits

Author SHA1 Message Date
40e8e055f9 [board, moves, position] Move make_move routines to moves crate
Declare a MakeMove trait and export it from chessfriend_moves. Declare a
BoardProvider trait that both Board and Position implement.

Implement the MakeMove trait for all types that implement BoardProvider, and move
all the move making code to the moves crate.

This change makes it possible to make moves directly on a Board, rather than
requiring a Position. The indirection of declaring and implementing the trait
in the moves crate is required because chessfriend_board is a dependency of
chessfriend_moves. So, it would be a layering violation for Board to implement
make_move() directly. The board crate cannot link the moves crate because that
would introduce a circular dependency.
2025-05-31 19:04:21 -07:00
34e8c08c36 [moves, position] Move MoveRecord to the moves crate 2025-05-31 14:32:39 -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
a9268ad194 [position] Add move tracking to Position
Create a new MoveRecord struct that tracks the move (aka ply) and irreversible
board properties. This should make it easier to unmake moves in the future.
2025-05-23 10:00:20 -07:00
05c62dcd99 [position] Remove CastleEvaluationError from this crate
It moved to board.
2025-05-23 09:58:29 -07:00
dbca7b4f88 [position, board] Move castle, movement, and sight modules to the board crate
Nothing about this code depends on Position, so push it down to a lower layer.
2025-05-21 10:08:59 -07:00
7c9c5484ba [position, board] Remove a bunch of dead code 2025-05-20 19:29:39 -07:00
0c1863acb9 [board, core, moves, position] Implement castling
Implement a new method on Position that evaluates whether the active color can castle
on a given wing of the board. Then, implement making a castling move in the position.

Make a new Wing enum in the core crate to specify kingside or queenside. Replace the
Castle enum from the board crate with this one. This caused a lot of churn...

Along the way fix a bunch of tests.

Note: there's still no way to actually make a castling move in explorer.
2025-05-19 16:50:30 -07:00
a78526befa [position] Move make_move to its own module: position::make_move
Rework sight.rs and add a new module, movement.rs, to calculate piece sight and
movement. I discovered during this process that "sight" and "movement" are different
because pawns (in particular) can move in ways that don't follow their sight lines.
The routines in the movement module account for this, but also pass through to the
sight routines for other pieces.
2025-05-18 08:12:10 -07:00
091cc99cb3 WIP 2025-05-08 17:37:51 -07:00
f96fa79dc1 [position] Remove fen.rs 2024-07-13 08:14:33 -07:00
d668091d0d Replace uses of types in r#move with types from the moves package types 2024-02-25 09:52:40 -08:00
36db46ac18 Move position::tests → testing
Expand information printed in assert_move_list
2024-02-25 09:20:45 -08:00
f4e57d7d6c [position] Implement all the example positions from Peter Ellis Jones' blog post
https://peterellisjones.com/posts/generating-legal-chess-moves-efficiently/
2024-02-03 15:16:00 -08:00
8aa5dacfc8 Initial implementation of CheckingPieces and Position::checking_pieces() 2024-01-30 08:53:13 -08:00
cd3cb82192 Add an assert_move_list! macro to help with verifying move lists 2024-01-29 14:46:41 -08:00
220da08727 Directly rename board -> position 2024-01-28 09:56:57 -08:00
Renamed from board/src/lib.rs (Browse further)