This commit is contained in:
Dmitry Fedotov
2025-01-11 02:55:05 +03:00
commit aae44cd587
6 changed files with 62 additions and 0 deletions

2
game/mod.rs Normal file
View File

@@ -0,0 +1,2 @@
mod ttt;
pub use ttt::{Board, Cell};

29
game/ttt.rs Normal file
View File

@@ -0,0 +1,29 @@
use std::io::Empty;
pub enum Cell {
Empty,
X,
O,
}
pub struct Board {
cells: Vec<Cell>,
next: Cell,
}
impl Board {
pub fn new() -> Board {
return Board {
cells: Vec::new(),
next: Cell::X,
};
}
pub fn put(&self, x: usize, y: usize, _: Cell) -> bool {
return false;
}
pub fn winner(self) -> Cell {
return Cell::Empty;
}
}