diff --git a/.gitignore b/.gitignore
index ab951f8..8b7ab77 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,9 @@ Cargo.lock
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
+
+
+# Added by cargo
+
+/target
+/local-deploy
diff --git a/Cargo.toml b/Cargo.toml
new file mode 100644
index 0000000..a48aab3
--- /dev/null
+++ b/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "blr_city_name"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+macroquad = "0.4.14"
diff --git a/build/build-web.sh b/build/build-web.sh
new file mode 100755
index 0000000..50aaa58
--- /dev/null
+++ b/build/build-web.sh
@@ -0,0 +1,15 @@
+cargo build --target wasm32-unknown-unknown --release
+
+if [ $? -ne 0 ]; then
+ echo "Wasm build failed"
+ exit 1
+fi
+
+rm -rf ./dist && mkdir -p ./dist && mv ./target/wasm32-unknown-unknown/release/blr_city_name.wasm ./dist/blr_city_name.wasm && cp ./build/index.html ./dist/index.html
+
+if [ $? -ne 0 ]; then
+ echo "Failed to create create dist directory"
+ exit 1
+fi
+
+tar -czvf ./sol_chess.tar.gz -C ./dist . && rm -rf ./dist && echo "Web build complete"
diff --git a/build/deploy-ltpd.sh b/build/deploy-ltpd.sh
new file mode 100755
index 0000000..939cf4e
--- /dev/null
+++ b/build/deploy-ltpd.sh
@@ -0,0 +1,10 @@
+./build-web.sh
+
+serve_root=$1
+
+sudo mv ./blr_city_name.tar.gz $serve_root/blr_city_name.tar.gz && \
+sudo tar -xzvf $serve_root/blr_city_name.tar.gz -C $serve_root && \
+sudo rm $serve_root/blr_city_name.tar.gz
+
+echo "Deployment complete"
+
diff --git a/build/index.html b/build/index.html
new file mode 100644
index 0000000..c41b824
--- /dev/null
+++ b/build/index.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+ Solitaire Chess
+
+
+
+
+
+
+
+
diff --git a/build/local-deploy/index.html b/build/local-deploy/index.html
new file mode 100644
index 0000000..c41b824
--- /dev/null
+++ b/build/local-deploy/index.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+ Solitaire Chess
+
+
+
+
+
+
+
+
diff --git a/build/run-local.sh b/build/run-local.sh
new file mode 100755
index 0000000..a099baf
--- /dev/null
+++ b/build/run-local.sh
@@ -0,0 +1,11 @@
+cargo build --target wasm32-unknown-unknown --release
+
+if [ $? -ne 0 ]; then
+ echo "Wasm build failed"
+ exit 1
+fi
+
+mkdir -p ./local-deploy && \
+cp ./build/index.html ./local-deploy/index.html && \
+cp ./target/wasm32-unknown-unknown/release/blr_city_name.wasm ./local-deploy/blr_city_name.wasm && \
+basic-http-server ./local-deploy
diff --git a/src/data/mid.txt b/src/data/mid.txt
new file mode 100644
index 0000000..f06700d
--- /dev/null
+++ b/src/data/mid.txt
@@ -0,0 +1,22 @@
+gup
+appan
+gana
+shank
+a
+gup
+ara
+kalla
+gunte
+
+
+
+
+
+
+
+na
+natha
+ana
+ghatta
+jara
+chena
diff --git a/src/data/prefix.txt b/src/data/prefix.txt
new file mode 100644
index 0000000..0ee530f
--- /dev/null
+++ b/src/data/prefix.txt
@@ -0,0 +1,20 @@
+Atti
+Baiya
+Benni
+Bana
+Challa
+Chikka
+Garuda
+Hala
+Jala
+Kadu
+Kunda
+Mada
+Maha
+Manju
+Nallur
+Pantha
+Seetha
+Singha
+Thala
+Yela
diff --git a/src/data/suffix.txt b/src/data/suffix.txt
new file mode 100644
index 0000000..cc48dc0
--- /dev/null
+++ b/src/data/suffix.txt
@@ -0,0 +1,19 @@
+guppe
+halli
+kari
+ghatta
+pete
+kallu
+sandra
+palya
+nagar
+bharathi
+eri
+ara
+ Road
+hara
+nya
+ Nagar
+pura
+pur
+
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..f2e3a06
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,57 @@
+use macroquad::prelude::*;
+use macroquad::rand;
+
+#[macroquad::main("MyGame")]
+async fn main() {
+ let mut rand_name = String::from("Random bangalore area names");
+ let mut last_update = 0.0;
+ loop {
+ clear_background(WHITE);
+ write_name(&rand_name);
+ let t = get_time();
+ if t - last_update > 1.75 {
+ rand_name = random_name();
+ last_update = get_time();
+ }
+ next_frame().await
+ }
+}
+
+fn write_name(random_name: &str) {
+ let font_size = 40.0;
+ let width = screen_width();
+ let height = screen_height();
+ let text_dimensions = measure_text(random_name, None, font_size as u16, 1.0);
+ draw_text(
+ &random_name,
+ (width - text_dimensions.width) / 2.,
+ (height - text_dimensions.height) / 2.,
+ font_size,
+ DARKGRAY,
+ );
+}
+
+fn random_name() -> String {
+ let prefix = read_segments(include_str!("./data/prefix.txt"));
+ let mid = read_segments(include_str!("./data/mid.txt"));
+ let suffix = read_segments(include_str!("./data/suffix.txt"));
+
+ format!(
+ "{}{}{}",
+ choose_random(&prefix),
+ choose_random(&mid),
+ choose_random(&suffix)
+ )
+}
+
+fn choose_random(prefix: &[&str]) -> String {
+ let idx = rand::gen_range(0, prefix.len());
+ match prefix.get(idx) {
+ Some(&name) => name.to_string(),
+ None => String::new(),
+ }
+}
+
+fn read_segments(file_contents: &str) -> Vec<&str> {
+ file_contents.lines().collect::>()
+}