Symlink/adapt shared code from frontend to backend

This commit is contained in:
Stephen Seo 2022-03-29 14:45:49 +09:00
parent e4d4d6e153
commit ec7f664c81
8 changed files with 23 additions and 0 deletions

7
back_end/Cargo.lock generated
View file

@ -158,6 +158,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures", "futures",
"oorandom",
"rand", "rand",
"rusqlite", "rusqlite",
"serde_json", "serde_json",
@ -574,6 +575,12 @@ version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
[[package]]
name = "oorandom"
version = "11.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
[[package]] [[package]]
name = "opaque-debug" name = "opaque-debug"
version = "0.3.0" version = "0.3.0"

View file

@ -13,3 +13,4 @@ bytes = "1.1"
rusqlite = "0.27.0" rusqlite = "0.27.0"
rand = "0.8.4" rand = "0.8.4"
futures = "0.3" futures = "0.3"
oorandom = "11.1.3"

1
back_end/src/ai.rs Symbolic link
View file

@ -0,0 +1 @@
../../front_end/src/ai.rs

1
back_end/src/constants.rs Symbolic link
View file

@ -0,0 +1 @@
../../front_end/src/constants.rs

1
back_end/src/game_logic.rs Symbolic link
View file

@ -0,0 +1 @@
../../front_end/src/game_logic.rs

View file

@ -1,5 +1,10 @@
mod ai;
mod constants;
mod db_handler; mod db_handler;
mod game_logic;
mod json_handlers; mod json_handlers;
mod random_helper;
mod state;
const SQLITE_DB_PATH: &str = "./fourLineDropper.db"; const SQLITE_DB_PATH: &str = "./fourLineDropper.db";

View file

@ -0,0 +1,6 @@
use oorandom::Rand32;
use rand::prelude::*;
pub fn get_seeded_random() -> Result<Rand32, String> {
Ok(Rand32::new(thread_rng().gen()))
}

1
back_end/src/state.rs Symbolic link
View file

@ -0,0 +1 @@
../../front_end/src/state.rs