Commit graph

14 commits

Author SHA1 Message Date
af36b75df7 [board] Implement a pawn move generator
Holy heck I went on a *journey* here. Ultimately, I needed to implement my own
index-based iterator instead of using the Vec's Iterator.

This type establishes some patterns I want to carry forward to other move
generators.

1. The use of a Parameters struct to fully parameterize the move generation
   per-color. That lets these types only need a single color-based branch
2. A list of move lists, one list for each of captures, promotions, and quiet
   moves.
3. An index-based move iterator.
4. Separate impl for generating bitboard representations of these moves

Additional changes:

- Implement BitBoard::from_square()
- Implement a Square::e5() for tests

This class doesn't implement en passant yet. It also doesn't yet have tests for
the bitboard stuff.
2023-12-31 11:44:47 -08:00
1cc8b4520f [board] Return copies of rank and file bitboards from static lists 2023-12-31 09:26:20 -08:00
e30bcb3105 [board] Implement BitBoard::file and fmt::Display for BitBoard
BitBoard::file returns a BitBoard representing the 0-indexed file.
fmt::Display prints a grid of bits in the standard orientation (white on bottom, left to right)
Add asserts to the rank and file constructors to catch out of bounds arguments.
2023-12-30 10:26:37 -08:00
53dc80b6bb [board] Implement BitAndAssign and BitOrAssign on BitBoard 2023-12-29 16:34:11 -08:00
808222eef1 [board] Clean up the formatting of BitBoards
Use debug_tuple in the fmt::Debug implementation.
Implement fmt::Binary, fmt::UpperHex, and fmt::LowerHex by delegating to u64's version.
2023-12-29 15:37:38 -08:00
41421dddbb [board] Clean up interfaces of pieces and square structs 2023-12-29 09:17:33 -08:00
2296be23cc [board] Rename BitBoard::from_bit_field → ::new 2023-12-28 21:42:18 -07:00
4c9e6a51fc [board] Move all the BitBoard shift code to a new bitboard::shifts module 2023-12-28 12:14:30 -07:00
5a08a4477e [board] Implement BitBoard::shift_south 2023-12-28 12:10:39 -07:00
5e47d37aa3 [board] Add a negative test for BitBoard::is_empty()
Remove a stray println!
2023-12-27 10:28:44 -07:00
61448d437f [board] Implement a BitBoard::rank constructor
Also implement BitBoard::shift_north() to support rank().
2023-12-27 10:04:02 -07:00
51a265172b [board] Implement an infix_op! macro for generating BitBoard operator traits 2023-12-27 10:00:30 -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
Renamed from board/src/bitboard.rs (Browse further)