refactor, add lobby

This commit is contained in:
2026-01-04 17:45:57 +03:00
parent c3bcf44048
commit 5426da7d07
7 changed files with 153 additions and 137 deletions

23
lobby/lobby.rs Normal file
View File

@@ -0,0 +1,23 @@
use crate::engine::Engine;
use crate::player::PlayerConsole;
pub struct Lobby {}
impl Lobby {
pub fn new() -> Lobby {
Lobby {}
}
pub fn run(self) -> Result<(), Box<dyn std::error::Error>> {
loop {
let p1 = Box::new(PlayerConsole::new("Gopher"));
let p2 = Box::new(PlayerConsole::new("Rustacean"));
let mut engine = Engine::new(p1, p2);
match engine.run() {
Ok(_) => continue,
Err(e) => return Err(e),
};
}
}
}

2
lobby/mod.rs Normal file
View File

@@ -0,0 +1,2 @@
mod lobby;
pub use lobby::Lobby;