commit aae44cd587772abb7fd4cc4dbcbc2bd9e4c2add2 Author: Dmitry Fedotov Date: Sat Jan 11 02:55:05 2025 +0300 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a5ff07f --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +/target + + +# Added by cargo +# +# already existing elements were commented out + +#/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..132e950 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "rttt" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..375413f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "rttt" +version = "0.1.0" +edition = "2021" + +[dependencies] + +[[bin]] +name = "rttt" +path = "main.rs" diff --git a/game/mod.rs b/game/mod.rs new file mode 100644 index 0000000..08d847e --- /dev/null +++ b/game/mod.rs @@ -0,0 +1,2 @@ +mod ttt; +pub use ttt::{Board, Cell}; diff --git a/game/ttt.rs b/game/ttt.rs new file mode 100644 index 0000000..1b7b915 --- /dev/null +++ b/game/ttt.rs @@ -0,0 +1,29 @@ +use std::io::Empty; + +pub enum Cell { + Empty, + X, + O, +} + +pub struct Board { + cells: Vec, + 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; + } +} diff --git a/main.rs b/main.rs new file mode 100644 index 0000000..0ca312d --- /dev/null +++ b/main.rs @@ -0,0 +1,6 @@ +mod game; + +fn main() { + let b = game::Board::new(); + let c = game::Cell::X; +}