Created
August 20, 2024 15:28
-
-
Save JaiSuryaPrabu/d0a5e95cb6dc3b05076ad689b1c595e2 to your computer and use it in GitHub Desktop.
Tic Tac Toe function for plotting player mark in the board
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn plot_player(player : &String, board : &mut Vec<String>, index : &usize) -> (bool,bool) { | |
let mut is_won = false; | |
let mut is_valid = true; | |
if board[index-1] != String::from("X") && board[index-1] != String::from("O") && !is_won { | |
board[index-1] = player.to_string(); | |
is_won = check_win(player.to_string(),board.to_vec()); | |
} else { | |
is_valid = false; | |
} | |
return (is_valid,is_won); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment