Commit graph

33 commits

Author SHA1 Message Date
7e45e49502 [BitBoard] Build out the documentation 2024-07-13 07:20:18 -07:00
daf5c86792 [BitBoard] Clean up the API; implement some traits
Clean up the BitBoard API by renaming methods with simpler names.
run-help Redo
Redo the implementation of a couple methods to be more succinct.
2024-07-13 07:19:47 -07:00
480a009e63 [BitBoard] Address a bunch of rust-analyzer suggestions
Add #[must_use] to many methods
2024-07-13 07:17:43 -07:00
14ab669763 Clean up BitBoard's bit ops impl macros
Declare the `forward_ref` crate as a dependency (my first external dependency!)
and use it to clean up the infix, assign, and unary op impls. This crate
automatically implements A+&B, &A+B, and &A+&B for me.
2024-07-13 07:08:18 -07:00
2480ef25e9 Remove BitBoardBuilder
It's unused except for the macro, and BitBoard itself can be declared mutable,
and implements Copy and Clone. So, I don't think having a separate Builder type
helps much.
2024-07-13 07:05:57 -07:00
1b63f56042 [bitboard, core] Make library getters const; parameterize Library attributes
- Add chessfriend_core::Color::NUM
- All the library getters can be const.
- Use the constants from the core library to define the length of the slices in
  the Library struct.
2024-04-25 07:59:39 -07:00
cad040e454 [bitboard] Fix some warnings and clippy suggestions in library.rs
- Add allow(dead_code) to LIGHT_SQUARES and DARK_SQUARES. These aren't used yet
  but I have a feeling they'll come in handy.
- Add some separators to long numeric literals.
- Lightly reformat BitBoard -> Bitboard in the module documentation
2024-04-25 07:23:59 -07:00
27a36565f3 [bitboard,core,position] Address a bunch of clippy warnings 2024-03-14 17:00:46 -07:00
3f6ffef9f3 [bitboard] Write some documentation; mark some methods const
- Implement BitBoard::is_populated(), the opposite of ::is_empty()
- Write a bit of documentation for the BitBoard Library and for some methods on BitBoard
- Mark a few methods as const
2024-03-08 08:15:45 -08:00
349d82304d [bitboard] Implement From<Option<Square>> for BitBoard
Return an empty BitBoard if the input is None.
2024-03-01 15:25:33 -08:00
742b00119a [bitboard] Implement From<File>, From<Rank> for BitBoard and TryFrom<BitBoard> for Square 2024-02-11 09:58:06 -07:00
997621eea7 [bitboard] Make a few tweaks to some definitions in BitBoard
Use u64::MIN and u64::MAX to define the empty and full bitboards
Write From<Square> as `1u64 << sq as u32`
Write a doc test for BitBoard::is_single_square()
Make library::RANKS and library::FILES pub(crate) instead of pub(super)
2024-02-11 09:58:06 -07:00
a8034c79aa [bitboard] Use a OnceLock to hold the global BitBoard library instance
Thread safe and a single object instead of two!
2024-02-05 13:59:26 -08:00
032fabe072 [bitboard] Return BitBoard::EMPTY from BitBoard's Default impl 2024-02-01 08:45:10 -08:00
ca861df9c4 [bitboard] Use TrailingBitScanner in occupied_squares_trailing
This was an oversight.
2024-02-01 08:44:53 -08:00
deea23352b [bitboard] Implement BitBoard::population_count()
Uses u64::count_ones() to return the population count of the BitBoard.
2024-02-01 08:44:25 -08:00
722a90b860 [position] Implement a SliderRayToSquare trait
This trait declares ray_to_square() which should return a BitBoard representing
a ray from a Square to another Square. The ray should include the target Square.

PlacedPiece implements this trait.
2024-02-01 08:42:19 -08:00
b93f8684fa [position] Plumb capture mask and push mask arguments through all move generators
These masks will help when generating moves that address checks.
Create BitBoard::EMPTY and BitBoard::FULL.
2024-01-29 20:12:12 -08:00
3239f288d7 [bitboard] Bitboards for kingside and queenside per color
Add two small BitBoard slices that represent kingside and queenside squares per
color.

Add doc comments to DARK_SQUARES and LIGHT_SQUARES.
Add getters on BitBoard for getting a boardside bitboard.
Clean up imports. Import the whole library module and refer to library things in
BitBoard by path.
2024-01-29 15:00:53 -08:00
cb48413ce7 [bitboard] Implement BitBoard::is_single_square()
Returns true if there's only one square set in the bitboard.
2024-01-29 14:46:16 -08:00
0f664f6c80 [bitboard] Implement BitBoard::as_bits; let rank and file take &u8 instead of usize 2024-01-29 14:46:16 -08:00
ea74b214da [position] Implement generating pawn moves by looking up bitboards in the Library
This enables a bunch of clean up! Remove the MoveGenerationParameters and MoveList
types from move_generator::pawn.

Implement BitBoard::pawn_pushes to look up pawn pushes by square and color.
2024-01-28 10:25:01 -08:00
66d03d3514 [board] Clean up a bunch of imports 2024-01-28 09:46:38 -08:00
1f873879bb [bitboard] Add pawn attacks bitboards to the Library 2024-01-28 09:08:57 -08:00
3cec64d686 [bitboard] Make the bitboard crate more crate-like
Export symbols needed to use BitBoard and BitBoardBuilder.
Fix build errors.
2024-01-24 09:16:21 -08:00
b0b22048a8 [core] Rename (once again) chess_core → chessfriend_core 2024-01-24 08:48:19 -08:00
625bfb2446 [bitboard] Move everything in board::bitboard to the bitboard crate 2024-01-24 08:35:28 -08:00
32100b9553 [bitboard] Make an empty chess_bitboard crate
This crate lives in bitboard/
2024-01-24 08:34:23 -08:00
d776bd18e2 [board] Move bitboard lib to "board" 2023-12-20 11:45:55 -08:00
ab55a7994c [bitboard] Implement a Square type; fix all the build issues after adding a mod line to lib.rs 2023-12-20 11:45:12 -08:00
567cb8d787 [bitboard] Commit the lock file 2023-12-19 11:13:20 -08:00
ebed5c05ed [bitboard] Add a BitBoard and a Position struct 2023-12-19 11:13:06 -08:00
8fd01e4f11 Add bitboard Rust library 2023-12-19 10:32:26 -08:00