878d771d86
[board] Replace Moves' separate properties with a Vec of Iterators
...
This makes iteration easier. Move to the next iterator if the current one returns None.
No tests for Moves yet though.
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
65a7bec5f9
[board] Implement Position::move_generator
2023-12-29 08:59:13 -08:00
1a986e4c27
[board] Implement Position::occupied_squares and Position::empty_squares
...
These methods return bitboards marking the occupied and empty squares, made by ORing the two pieces_per_color bitboards.
2023-12-29 08:58:34 -08:00
2296be23cc
[board] Rename BitBoard::from_bit_field → ::new
2023-12-28 21:42:18 -07:00
af53eb932c
[board] Populate the color bitboards when placing pieces
2023-12-28 21:41:55 -07:00
50a6be2f72
[board] Pass piece argument to Position::bitboard_for_piece() by value instead of by reference
2023-12-27 08:31:02 -07:00
4bec1538a1
[board] Add the missing trailing } to fmt::Debug for Position
2023-12-27 08:01:44 -07:00
b9ba2629c4
[board] Fix the King's position in the Position::starting()
...
I wrote a test of the starting position for DiagramFormatter and discovered that Position::starting() was placing the king incorrectly. Fixed it!
2023-12-27 08:01:44 -07:00
19c48b9816
[board] Implement a DiagramFormatter that writes a graphical diagram of a Position
...
Remove fmt::Display from Position and move display to a DiagramFormatter type that implements that trait and writes a position to a formatter.
2023-12-26 21:37:22 -07:00
17511e9d63
[board] Implement a rather dumb Position::piece_on_square
...
This method does an iteration over all piece colors and shapes to find the piece on a given square.
2023-12-26 21:34:01 -07:00
a963cee1e7
Merge branch 'main' into pretty-print-position
2023-12-26 13:28:55 -07:00
9d0761f8c6
[board] Rename from_algebraic_string → from_algebraic_str
2023-12-26 13:28:25 -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