|
@@ -0,0 +1,41 @@
|
|
|
+use bitboard::Bitboard;
|
|
|
+
|
|
|
+type Square = u8;
|
|
|
+type Side = bool;
|
|
|
+
|
|
|
+const WHITE: Side = false;
|
|
|
+const BLACK: Side = true;
|
|
|
+
|
|
|
+pub enum Move {
|
|
|
+ Default { from: Square, to: Square },
|
|
|
+ Castling { side: Side, left: bool },
|
|
|
+ EnPassant { side: Side, column: u8}
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+pub struct BitboardIterator { pub board: Bitboard }
|
|
|
+
|
|
|
+impl Iterator for BitboardIterator {
|
|
|
+ type Item = Bitboard;
|
|
|
+
|
|
|
+ fn next(&mut self) -> Option<Bitboard> {
|
|
|
+ if self.board != 0 {
|
|
|
+ let lsb = self.board & (0_u64.wrapping_sub(self.board));
|
|
|
+ self.board &= !lsb;
|
|
|
+ //Some(lsb.trailing_zeros())
|
|
|
+ Some(lsb)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ None
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+fn generate_pawn_moves()
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|