diff --git a/back_end/Cargo.lock b/back_end/Cargo.lock index debb9b5..829423c 100644 --- a/back_end/Cargo.lock +++ b/back_end/Cargo.lock @@ -158,6 +158,7 @@ version = "0.1.0" dependencies = [ "bytes", "futures", + "oorandom", "rand", "rusqlite", "serde_json", @@ -574,6 +575,12 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "opaque-debug" version = "0.3.0" diff --git a/back_end/Cargo.toml b/back_end/Cargo.toml index c2804db..0c7f4cc 100644 --- a/back_end/Cargo.toml +++ b/back_end/Cargo.toml @@ -13,3 +13,4 @@ bytes = "1.1" rusqlite = "0.27.0" rand = "0.8.4" futures = "0.3" +oorandom = "11.1.3" diff --git a/back_end/src/ai.rs b/back_end/src/ai.rs new file mode 120000 index 0000000..6d9f5b4 --- /dev/null +++ b/back_end/src/ai.rs @@ -0,0 +1 @@ +../../front_end/src/ai.rs \ No newline at end of file diff --git a/back_end/src/constants.rs b/back_end/src/constants.rs new file mode 120000 index 0000000..7330b68 --- /dev/null +++ b/back_end/src/constants.rs @@ -0,0 +1 @@ +../../front_end/src/constants.rs \ No newline at end of file diff --git a/back_end/src/game_logic.rs b/back_end/src/game_logic.rs new file mode 120000 index 0000000..f8d5167 --- /dev/null +++ b/back_end/src/game_logic.rs @@ -0,0 +1 @@ +../../front_end/src/game_logic.rs \ No newline at end of file diff --git a/back_end/src/main.rs b/back_end/src/main.rs index 454bc75..c8a52aa 100644 --- a/back_end/src/main.rs +++ b/back_end/src/main.rs @@ -1,5 +1,10 @@ +mod ai; +mod constants; mod db_handler; +mod game_logic; mod json_handlers; +mod random_helper; +mod state; const SQLITE_DB_PATH: &str = "./fourLineDropper.db"; diff --git a/back_end/src/random_helper.rs b/back_end/src/random_helper.rs new file mode 100644 index 0000000..208589e --- /dev/null +++ b/back_end/src/random_helper.rs @@ -0,0 +1,6 @@ +use oorandom::Rand32; +use rand::prelude::*; + +pub fn get_seeded_random() -> Result { + Ok(Rand32::new(thread_rng().gen())) +} diff --git a/back_end/src/state.rs b/back_end/src/state.rs new file mode 120000 index 0000000..1f438a9 --- /dev/null +++ b/back_end/src/state.rs @@ -0,0 +1 @@ +../../front_end/src/state.rs \ No newline at end of file