diff options
Diffstat (limited to 'src/board/io.rs')
-rw-r--r-- | src/board/io.rs | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/src/board/io.rs b/src/board/io.rs index 30d487f..ca75c8c 100644 --- a/src/board/io.rs +++ b/src/board/io.rs @@ -1,8 +1,5 @@ -use std::io::{stdin, stdout, Write}; -use crate::{bitboard::Bitboard, attacks::Attacks, moves::Move, square::Square}; - - -use super::{Board, Piece, ttable::TTABLE_SIZE, zobrist::Zobrist}; +use crate::{bitboard::Bitboard, attacks::Attacks, moves::Move}; +use super::{Board, Piece, zobrist::Zobrist}; const PIECE_CHARS: [&str; 12] = [ "♟︎", "♞", "♝", "♜", "♛", "♚", @@ -45,6 +42,7 @@ impl IO for Board { println!(" a b c d e f g h"); } + #[allow(non_snake_case)] fn from_FEN(fen: String) -> Self { let mut piece_sets = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; @@ -99,7 +97,6 @@ impl IO for Board { castling_rights: [[true; 2]; 2], // TODO: actualy parse from FEN ep_target: None, // TODO: parse from FEN hash: 0, - transposition_table: vec![None; TTABLE_SIZE as usize], zobrist_seed: Board::seed(), }; board.update_occupancy(); @@ -113,29 +110,30 @@ impl IO for Board { } fn read_move(&self) -> Result<Move, String> { - print!("\nEnter a move: "); - stdout().flush().unwrap(); - let mut s = String::new(); - stdin().read_line(&mut s).unwrap(); - let chars = &mut s.chars(); - - let source = match Square::from_notation(chars) { - Ok(s) => s, - Err(e) => return Err(e), - }; - let target = match Square::from_notation(chars) { - Ok(s) => s, - Err(e) => return Err(e), - }; - - let moves = self.generate_pseudolegal_moves(); - - let mov = match moves.iter().find(|m| m.source == source && m.target == target) { - Some(m) => *m, - None => return Err(String::from("Move is not valid")), - }; - - Ok(mov) + todo!(); + // print!("\nEnter a move: "); + // stdout().flush().unwrap(); + // let mut s = String::new(); + // stdin().read_line(&mut s).unwrap(); + // let chars = &mut s.chars(); + // + // let source = match Square::from_notation(chars) { + // Ok(s) => s, + // Err(e) => return Err(e), + // }; + // let target = match Square::from_notation(chars) { + // Ok(s) => s, + // Err(e) => return Err(e), + // }; + // + // let moves = self.generate_pseudolegal_moves(); + + // let mov = match moves.iter().find(|m| m.source == source && m.target == target) { + // Some(m) => *m, + // None => return Err(String::from("Move is not valid")), + // }; + + // Ok(mov) } } |