diff --git a/gui/src/commands.rs b/gui/src/commands.rs index 51bfd04..948f77f 100644 --- a/gui/src/commands.rs +++ b/gui/src/commands.rs @@ -110,23 +110,6 @@ pub fn undo(steps: u32, state: State) -> Result<(), String> { Ok(()) } -#[tauri::command] -pub fn get_board(state: State) -> Result>, String> { - let board_opt = state.board.lock().map_err(|e| e.to_string())?; - let board = board_opt.as_ref().ok_or("游戏未开始")?; - - let mut result = vec![vec![0i32; board.size]; board.size]; - for x in 0..board.size { - for y in 0..board.size { - result[x][y] = match board.get(Position::new(x, y)) { - CellState::Empty => 0, - CellState::Occupied(Color::Black) => 1, - CellState::Occupied(Color::White) => 2, - }; - } - } - Ok(result) -} #[tauri::command] pub fn ai_move(state: State) -> Result, String> { diff --git a/gui/src/lib.rs b/gui/src/lib.rs index 7e857a6..ff0308f 100644 --- a/gui/src/lib.rs +++ b/gui/src/lib.rs @@ -11,7 +11,7 @@ pub fn run() { commands::new_game, commands::place_piece, commands::undo, - commands::get_board, + commands::ai_move, commands::get_game_state, ])