Commit graph

22 commits

Author SHA1 Message Date
98fce9acde [board] Fix the shape_into_char test 2024-01-15 17:18:18 -08:00
e9607573c2 [board] Use absolute paths with $crate in the piece! macro 2024-01-15 17:17:57 -08:00
3ecc263701 [board] Implement piece sight algorithms
Add a new Sight trait, implemented by PlacedPiece. The implementation of this
trait produces a BitBoard representing the squares visible to the placed piece.
2024-01-15 16:03:06 -08:00
ddea2c2d63 [board] Declare three new Display-like traits
- ASCIIDisplay → format a type using ASCII only characters
- UnicodeDisplay → format a type using any Unicode characters
- FENDisplay → format a type for inclusion in a FEN string
2024-01-14 10:51:40 -08:00
64b47a8d70 [board] Remove unused PlacedPiece::bitboard() 2024-01-14 10:27:04 -08:00
94ab64d277 [board] Add a piece! macro
This macro implements a tiny DSL for creating Pieces and PlacedPieces.

"White King" → Piece::new(Color::White, Shape::King)
"White King on E4" → PlacedPiece::new(Piece::new(Color::White, Shape::King), Square::E4)
2024-01-12 22:26:13 -08:00
b62cd1fcd2 [board] Use Unicode chess characters to Display Pieces 2024-01-06 20:49:25 -08:00
7c2b9ed97a [board] Add inline and const modifiers to methods on PlacedPiece 2024-01-06 08:49:51 -08:00
750b16970f [board] Create const arrays for Shape that return &'static to its enum cases 2023-12-31 11:44:47 -08:00
41421dddbb [board] Clean up interfaces of pieces and square structs 2023-12-29 09:17:33 -08:00
e1e27fc668 [board] Implement TryFrom<&str> for Shape
Convert a string to a Shape using the first character in the string.
Rename TryFromCharError → TryFromError
2023-12-28 19:50:02 -07:00
49c5a0b51d [board] Implement fmt::Display for Piece 2023-12-26 21:33:00 -07:00
ecc1ee85d4 [board] Remove an unintentional recursion in fmt::Display for piece::Shape 2023-12-26 21:31:44 -07:00
8e9da6aeff [board] Implement helpful piecewise constructors on Piece 2023-12-26 21:31:05 -07:00
371d37f688 [board] Implement TryFrom<char> and Into<char> for piece::Shape 2023-12-26 13:57:36 -07:00
758a3d95fc [board] Reorganize bitboard and position modules and export some symbols from the crate
Move position.rs to the position module and create a mod.rs.
Do the same for bitboard.rs in the bitboard modules.
Export Color, Piece, Position, and Square and use crate::Thing directly instead of referring to the symbol in the nested modules.
2023-12-26 11:25:27 -07:00
1575c83d31 [board] Rename PiecePlacementError::PieceExistsOnSquare → ExistsOnSquare 2023-12-26 11:20:01 -07:00
32c562e405 [board] Implement Color::other() that swaps the color for the other 2023-12-26 11:13:44 -07:00
fac98735e3 [board] Implement a Pieces iterator
This type iterates the pieces in a Position using the BitScanner struct to iterate all the occupied squares of the position's bitboards.
2023-12-26 09:19:38 -07:00
e0f1e1f6ff [board] Derive a bunch of traits for Color, Shape, Piece, and Square 2023-12-26 09:15:24 -07:00
a2f88f0fde [board] Give piece Color and shape enums integer values
Rename PieceShape → Shape
Remove color and piece modules from position.rs
2023-12-23 20:20:19 -07:00
9bcd0b2148 [board] Add neighbor and piece modules
Add a Direction enum in the neighbor module
Add Color and PieceShape enums, and a Piece struct to the piece module
2023-12-23 09:18:07 -07:00