Skip to content

Commit

Permalink
New start
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacperacy committed Oct 13, 2024
1 parent 4ac718e commit 433d0f3
Show file tree
Hide file tree
Showing 6 changed files with 479 additions and 964 deletions.
12 changes: 11 additions & 1 deletion src/bitboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@ use std::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Bitboard(pub u64);

impl Default for Bitboard {
fn default() -> Self {
Self::new()
}
}

impl Bitboard {
pub fn new() -> Self {
Bitboard(0)
}

pub fn from_index(index: usize) -> Self {
Bitboard(1 << index)
}

pub fn value(&self) -> u64 {
self.0
}
Expand Down Expand Up @@ -119,4 +129,4 @@ impl Shr<u32> for Bitboard {
fn shr(self, shift: u32) -> Bitboard {
Bitboard(self.0 >> shift)
}
}
}
Loading

0 comments on commit 433d0f3

Please sign in to comment.