]> git.seodisparate.com - EN605.607.81.SP22_ASDM_Project/commitdiff
Symlink/adapt shared code from frontend to backend
authorStephen Seo <seo.disparate@gmail.com>
Tue, 29 Mar 2022 05:45:49 +0000 (14:45 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Tue, 29 Mar 2022 05:45:49 +0000 (14:45 +0900)
back_end/Cargo.lock
back_end/Cargo.toml
back_end/src/ai.rs [new symlink]
back_end/src/constants.rs [new symlink]
back_end/src/game_logic.rs [new symlink]
back_end/src/main.rs
back_end/src/random_helper.rs [new file with mode: 0644]
back_end/src/state.rs [new symlink]

index debb9b5da2d8024c53488f94c542f0d89c13b6d8..829423c70521d6af468fab128d2e2fb3a6a01f0b 100644 (file)
@@ -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"
index c2804db2472162804a7fad6f324288ddcd947767..0c7f4cc45b336e160c68e8bf87c44e1b67bc5cb5 100644 (file)
@@ -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 (symlink)
index 0000000..6d9f5b4
--- /dev/null
@@ -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 (symlink)
index 0000000..7330b68
--- /dev/null
@@ -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 (symlink)
index 0000000..f8d5167
--- /dev/null
@@ -0,0 +1 @@
+../../front_end/src/game_logic.rs
\ No newline at end of file
index 454bc7580708f41b9c3a77bad65a84ce33f8bfa2..c8a52aa160f741de7ff2e2c60055368d8ec2eb3f 100644 (file)
@@ -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 (file)
index 0000000..208589e
--- /dev/null
@@ -0,0 +1,6 @@
+use oorandom::Rand32;
+use rand::prelude::*;
+
+pub fn get_seeded_random() -> Result<Rand32, String> {
+    Ok(Rand32::new(thread_rng().gen()))
+}
diff --git a/back_end/src/state.rs b/back_end/src/state.rs
new file mode 120000 (symlink)
index 0000000..1f438a9
--- /dev/null
@@ -0,0 +1 @@
+../../front_end/src/state.rs
\ No newline at end of file