// main.rs mod bitboard; mod types; mod position; mod movegen; mod search; mod evaluate; mod uci; mod tt; mod zobrist; mod timeman; mod movepick; mod perft; use std::io::{self, BufRead}; fn main() { let stdin = io::stdin(); let mut stdin_lock = stdin.lock(); let mut buffer = String::new(); // Store the moves played in the game so far let mut current_moves: Vec = Vec::new(); loop { buffer.clear(); let bytes_read = stdin_lock.read_line(&mut buffer).unwrap_or(0); if bytes_read == 0 { break; } let command = buffer.trim(); if command.is_empty() { continue; } if command == "uci" { println!("id name VeloCT_Base"); println!("id author Taperx"); println!("uciok"); } else if command == "isready" { println!("readyok"); } else if command == "ucinewgame" { current_moves.clear(); } else if command.starts_with("position") { // Example Lichess input: "position startpos moves e2e4 e7e5 g1f3" // Clear old moves current_moves.clear(); // Split the command into words to find the moves let parts: Vec<&str> = command.split_whitespace().collect(); if let Some(moves_index) = parts.iter().position(|&x| x == "moves") { // Save all the moves played in the game into our vector for move_str in &parts[moves_index + 1..] { current_moves.push(move_str.to_string()); } } // TODO: Feed `current_moves` into your engine's internal board state! } else if command.starts_with("go") { // TODO: Generate a list of legal moves for the CURRENT board state // TODO: Evaluate the position and pick the best legal move // For now, this is pseudocode. You must replace this with your engine's logic! // let best_move = my_engine.find_best_move(); // println!("bestmove {}", best_move); // WARNING: If you hardcode this, Lichess will abort the game if it's illegal. println!("bestmove d7d5"); } else if command == "quit" { break; } } }