feat: demo mode for testing AIs
This commit is contained in:
11
src/random_ai.rs
Normal file
11
src/random_ai.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
use rand::Rng;
|
||||
use crate::types::{Client, Color};
|
||||
|
||||
pub fn random_move(board: &[Vec<Color>]) -> usize {
|
||||
let mut random = rand::rng().random_range(0..6);
|
||||
while board[random][4] != Color::None {
|
||||
random = rand::rng().random_range(0..6);
|
||||
}
|
||||
|
||||
random
|
||||
}
|
||||
Reference in New Issue
Block a user