init
This commit is contained in:
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/target
|
||||||
|
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
#
|
||||||
|
# already existing elements were commented out
|
||||||
|
|
||||||
|
#/target
|
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
@@ -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"
|
10
Cargo.toml
Normal file
10
Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "rttt"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "rttt"
|
||||||
|
path = "main.rs"
|
2
game/mod.rs
Normal file
2
game/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
mod ttt;
|
||||||
|
pub use ttt::{Board, Cell};
|
29
game/ttt.rs
Normal file
29
game/ttt.rs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user