diff --git a/back_end/src/db_handler.rs b/back_end/src/db_handler.rs index fcb4324..16cc79d 100644 --- a/back_end/src/db_handler.rs +++ b/back_end/src/db_handler.rs @@ -857,7 +857,7 @@ impl DBHandler { } // board back to string - let (board_string, ended_state_opt) = string_from_board(board, final_pos); + let (board_string, ended_state_opt) = string_from_board(&board, final_pos); // update DB let update_result = if ended_state_opt.is_none() { @@ -1004,7 +1004,7 @@ impl DBHandler { }); // get board string from board while checking if game has ended - let (board_string, end_state_opt) = string_from_board(board, ai_choice_pos); + let (board_string, end_state_opt) = string_from_board(&board, ai_choice_pos); let state; if let Some(board_state) = end_state_opt { diff --git a/front_end/src/state.rs b/front_end/src/state.rs index 7554477..242e5e8 100644 --- a/front_end/src/state.rs +++ b/front_end/src/state.rs @@ -456,12 +456,12 @@ pub fn board_from_string(board_string: String) -> BoardType { /// Returns the board as a String, and None if game has not ended, Empty if game /// ended in a draw, or a player if that player has won -pub fn string_from_board(board: BoardType, placed: usize) -> (String, Option) { +pub fn string_from_board(board: &BoardType, placed: usize) -> (String, Option) { let mut board_string = String::with_capacity(56); // check for winning pieces let mut win_set: HashSet = HashSet::new(); - let win_opt = check_win_draw(&board); + let win_opt = check_win_draw(board); if let Some((_board_state, win_type)) = win_opt { match win_type { WinType::Horizontal(pos) => {