From 8c3289e6311d943ca10c84cd6ff6ab8a797b18e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E8=88=AA=E5=AE=87?= <3364451258@qq.com> Date: Sun, 31 May 2026 13:36:42 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=20get=5Fboard=20IPC=20=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=20clippy=20needless=5Frange=5Floop?= =?UTF-8?q?=20=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 --- gui/src/commands.rs | 17 ----------------- gui/src/lib.rs | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) 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, ])