cleanup
This commit is contained in:
parent
d29095bc9d
commit
2011ae001b
33
Cargo.lock
generated
33
Cargo.lock
generated
@ -129,17 +129,6 @@ version = "0.7.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "comptime"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ed5e683f1f8879ac923fa7f69d180872f9bb8a417505c332f08fa6955f537dd2"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console"
|
name = "console"
|
||||||
version = "0.15.10"
|
version = "0.15.10"
|
||||||
@ -442,7 +431,6 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"bitvec",
|
"bitvec",
|
||||||
"comptime",
|
|
||||||
"const_fn",
|
"const_fn",
|
||||||
"criterion",
|
"criterion",
|
||||||
"either",
|
"either",
|
||||||
@ -638,7 +626,7 @@ checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.98",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -659,17 +647,6 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "syn"
|
|
||||||
version = "1.0.109"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"unicode-ident",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.98"
|
version = "2.0.98"
|
||||||
@ -750,7 +727,7 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.98",
|
"syn",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -772,7 +749,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.98",
|
"syn",
|
||||||
"wasm-bindgen-backend",
|
"wasm-bindgen-backend",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
@ -933,7 +910,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.98",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -944,5 +921,5 @@ checksum = "76331675d372f91bf8d17e13afbd5fe639200b73d01f0fc748bb059f9cca2db7"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.98",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -29,8 +29,7 @@ bitvec = [ "dep:bitvec" ]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
arrayvec = "0.7"
|
arrayvec = "0.7"
|
||||||
bitvec = { version = "1", optional = true }
|
bitvec = { version = "1", optional = true }
|
||||||
comptime = "1.0.0"
|
const_fn = "0.4"
|
||||||
const_fn = "0.4.11"
|
|
||||||
either = "1.13"
|
either = "1.13"
|
||||||
indicatif = "0.17"
|
indicatif = "0.17"
|
||||||
lazy_static = "1.5"
|
lazy_static = "1.5"
|
||||||
|
|||||||
@ -26,19 +26,15 @@ pub struct BitBoard(BitBoardInner);
|
|||||||
// BitBoard should be big enough to fit all points on the board
|
// BitBoard should be big enough to fit all points on the board
|
||||||
const_assert!(std::mem::size_of::<BitBoard>() * 8 >= Board::BOARD_AREA);
|
const_assert!(std::mem::size_of::<BitBoard>() * 8 >= Board::BOARD_AREA);
|
||||||
|
|
||||||
impl Default for BitBoard {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BitBoard {
|
impl BitBoard {
|
||||||
#[cfg(feature = "bitvec")]
|
#[cfg(feature = "bitvec")]
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self(bitarr!(BBBaseType, Lsb0; 0; Board::BOARD_AREA))
|
Self(bitarr!(BBBaseType, Lsb0; 0; Board::BOARD_AREA))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "bitvec"))]
|
#[cfg(not(feature = "bitvec"))]
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self(0)
|
Self(0)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,24 +14,17 @@ type Chain = ArrayVec<(usize, usize), { Board::BOARD_SIZE - 1 }>;
|
|||||||
/// A collection of chains (up vert, down vert, left horiz, right horiz, diagonals....)
|
/// A collection of chains (up vert, down vert, left horiz, right horiz, diagonals....)
|
||||||
type ChainCollection = ArrayVec<Chain, 8>;
|
type ChainCollection = ArrayVec<Chain, 8>;
|
||||||
|
|
||||||
const BOARD_AREA: usize = Board::BOARD_AREA;
|
|
||||||
|
|
||||||
/// Map of all points on the board against some type T
|
/// Map of all points on the board against some type T
|
||||||
/// Used to index like so: example[i][j]
|
/// Used to index like so: example[i][j]
|
||||||
/// with each coordinate
|
/// with each coordinate
|
||||||
pub struct PosMap<T: Default>(ArrayVec<T, BOARD_AREA>);
|
pub struct PosMap<T: Default>(ArrayVec<T, { Board::BOARD_AREA }>);
|
||||||
|
|
||||||
impl<T: Default> Default for PosMap<T> {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: Default> PosMap<T> {
|
impl<T: Default> PosMap<T> {
|
||||||
const fn index(row: usize, col: usize) -> usize {
|
const fn index(row: usize, col: usize) -> usize {
|
||||||
row * Board::BOARD_SIZE + col
|
row * Board::BOARD_SIZE + col
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self(ArrayVec::from_iter(
|
Self(ArrayVec::from_iter(
|
||||||
(0..Board::BOARD_AREA).map(|_| Default::default()),
|
(0..Board::BOARD_AREA).map(|_| Default::default()),
|
||||||
@ -186,12 +179,6 @@ impl fmt::Debug for Board {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Board {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Board {
|
impl Board {
|
||||||
pub const BOARD_SIZE: usize = 8;
|
pub const BOARD_SIZE: usize = 8;
|
||||||
|
|
||||||
@ -199,6 +186,7 @@ impl Board {
|
|||||||
pub const BOARD_AREA: usize = Self::BOARD_SIZE.pow(2);
|
pub const BOARD_AREA: usize = Self::BOARD_SIZE.pow(2);
|
||||||
|
|
||||||
/// Create a new empty board
|
/// Create a new empty board
|
||||||
|
#[allow(clippy::new_without_default)]
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
white_board: BitBoard::new(),
|
white_board: BitBoard::new(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user