a
This commit is contained in:
10
src/game.rs
10
src/game.rs
@@ -25,7 +25,7 @@ impl Game {
|
||||
pub const fn new(player1: Box<dyn Agent>, player2: Box<dyn Agent>) -> Self {
|
||||
Self {
|
||||
players: [player1, player2],
|
||||
board: Board::new(),
|
||||
board: Board::new().starting_pos(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,15 +45,17 @@ impl Game {
|
||||
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(100));
|
||||
// return;
|
||||
|
||||
self.step(i);
|
||||
|
||||
std::thread::sleep(Duration::from_millis(200));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user