improve player management

This commit is contained in:
2025-01-28 14:16:16 -05:00
parent 17e774ae57
commit 565f638b1b
5 changed files with 42 additions and 43 deletions

View File

@@ -1,4 +1,4 @@
use crate::{agent::Agent, repr::Board};
use crate::{agent::Agent, board::Board};
use std::time::Duration;
pub struct Game {
@@ -43,17 +43,17 @@ impl Game {
// TODO! make this loop good
pub fn game_loop(&mut self) {
let mut i = 0;
loop {
self.step(i);
// alternate which player plays
i += 1;
i %= self.players.len();
println!("{}", self);
std::thread::sleep(Duration::from_millis(500));
self.step(0);
println!("{}", self);
std::thread::sleep(Duration::from_millis(500));
self.step(1);
println!("{}", self);
}
}
}