Johann Woelper hace 5 años
padre
commit
885d251104
Se han modificado 4 ficheros con 281 adiciones y 157 borrados
  1. 106 0
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. 158 0
      src/gridmath.rs
  4. 16 156
      src/main.rs

+ 106 - 0
Cargo.lock

@@ -1,5 +1,24 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
+[[package]]
+name = "alga"
+version = "0.9.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "approx"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "arrayref"
 version = "0.3.5"
@@ -162,6 +181,14 @@ name = "fuchsia-cprng"
 version = "0.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
+[[package]]
+name = "generic-array"
+version = "0.13.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "getrandom"
 version = "0.1.13"
@@ -187,6 +214,11 @@ name = "libc"
 version = "0.2.65"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
+[[package]]
+name = "libm"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
 [[package]]
 name = "log"
 version = "0.4.8"
@@ -195,11 +227,45 @@ dependencies = [
  "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "matrixmultiply"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "nalgebra"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "alga 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "matrixmultiply 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand_distr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "nodrop"
 version = "0.1.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
+[[package]]
+name = "num-complex"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "num-integer"
 version = "0.1.41"
@@ -209,6 +275,16 @@ dependencies = [
  "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "num-rational"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "num-traits"
 version = "0.2.8"
@@ -280,6 +356,14 @@ dependencies = [
  "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "rand_distr"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "rand_hc"
 version = "0.2.0"
@@ -301,6 +385,11 @@ dependencies = [
  "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "rawpointer"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
 [[package]]
 name = "rdrand"
 version = "0.4.0"
@@ -420,6 +509,11 @@ dependencies = [
  "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "typenum"
+version = "1.11.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
 [[package]]
 name = "unicode-xid"
 version = "0.2.0"
@@ -435,6 +529,7 @@ name = "wfc"
 version = "0.1.0"
 dependencies = [
  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "nalgebra 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
  "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -462,6 +557,8 @@ version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [metadata]
+"checksum alga 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "658f9468113d34781f6ca9d014d174c74b73de870f1e0e3ad32079bbab253b19"
+"checksum approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3"
 "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee"
 "checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
 "checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
@@ -483,13 +580,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9"
 "checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08"
 "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
+"checksum generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0ed1e761351b56f54eb9dcd0cfaca9fd0daecf93918e1cfc01c8a3d26ee7adcd"
 "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407"
 "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
 "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 "checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8"
+"checksum libm 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
 "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
+"checksum matrixmultiply 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f"
+"checksum nalgebra 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0abb021006c01b126a936a8dd1351e0720d83995f4fc942d0d426c654f990745"
 "checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
+"checksum num-complex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fcb0cf31fb3ff77e6d2a6ebd6800df7fdcd106f2ad89113c9130bcd07f93dffc"
 "checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
+"checksum num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2885278d5fe2adc2f75ced642d52d879bffaceb5a2e0b1d4309ffdfb239b454"
 "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
 "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
 "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
@@ -499,8 +602,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
 "checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
 "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
+"checksum rand_distr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96977acbdd3a6576fb1d27391900035bf3863d4a16422973a409b488cf29ffb2"
 "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
 "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
+"checksum rawpointer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
 "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
 "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
 "checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d"
@@ -515,6 +620,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203"
 "checksum term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5"
 "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
+"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
 "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
 "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d"
 "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"

+ 1 - 1
Cargo.toml

@@ -7,7 +7,7 @@ edition = "2018"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]
-# nalgebra = "*"
+nalgebra = "*"
 serde = "1.0"
 serde_derive = "1.0"
 serde_json = "1.0"

+ 158 - 0
src/gridmath.rs

@@ -0,0 +1,158 @@
+use std::ops::{Add, Mul, Neg};
+use std::fmt;
+use nalgebra::{Rotation3, Vector3};
+
+#[derive(Clone, Serialize, Deserialize, Copy, Eq, PartialEq, Hash)]
+pub struct V3 {
+    pub x: i32,
+    pub y: i32,
+    pub z: i32,
+}
+
+impl V3 {
+    pub fn new(x: i32, y: i32, z: i32) -> V3 {
+        V3 { x, y, z }
+    }
+
+    pub fn neighbors(self) -> [V3; 6] {
+        let o = self.offsets();
+        [
+            self + o[0],
+            self + o[1],
+            self + o[2],
+            self + o[3],
+            self + o[4],
+            self + o[5],
+        ]
+    }
+
+    pub fn rotate_x_90(self) -> V3 {
+        self.rotate_90(Vector3::x_axis())
+    }
+
+    pub fn rotate_y_90(self) -> V3 {
+        self.rotate_90(Vector3::y_axis())
+    }
+
+    pub fn rotate_z_90(self) -> V3 {
+        self.rotate_90(Vector3::z_axis())
+    }
+
+    pub fn rotate_90(self, axis: nalgebra::Unit<nalgebra::Matrix<f64, nalgebra::base::dimension::U3, nalgebra::base::dimension::U1, nalgebra::ArrayStorage<f64, nalgebra::base::dimension::U3, nalgebra::base::dimension::U1>>>) -> V3 {
+        let axis = Vector3::z_axis();
+        let rot = Rotation3::from_axis_angle(&axis, std::f64::consts::FRAC_PI_2);
+        let self_as_v = Vector3::new(self.x as f64, self.y as f64, self.z as f64);
+        let tv = rot*self_as_v;
+        V3::new(tv.x as i32, tv.y as i32, tv.z as i32)
+    }
+
+    pub fn rotated_neighbors(self, axis: u8,) -> [V3; 6] {
+
+    //      [2]
+    //   [1][S][0]
+    //      [3]
+
+
+        [
+            self,
+            self,
+            self,
+            self,
+            self,
+            self,
+        ]
+    }
+
+
+    pub fn offsets(self) -> [V3; 6] {
+        [
+            V3::new(1, 0, 0),
+            V3::new(-1, 0, 0),
+            V3::new(0, 1, 0),
+            V3::new(0, -1, 0),
+            V3::new(0, 0, 1),
+            V3::new(0, 0, -1),
+        ]
+    }
+}
+
+impl fmt::Debug for V3 {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        // // // write!(f, "V[{},{},{}]", self.x*8, self.y*8, self.z*8)
+        write!(f, "V[{},{},{}]", self.x, self.y, self.z)
+    }
+}
+impl Add<V3> for V3 {
+    type Output = V3;
+    fn add(self, other: V3) -> V3 {
+        V3 {
+            x: self.x + other.x,
+            y: self.y + other.y,
+            z: self.z + other.z,
+        }
+    }
+}
+impl Add<i32> for V3 {
+    type Output = V3;
+    fn add(self, other: i32) -> V3 {
+        V3 {
+            x: self.x + other,
+            y: self.y + other,
+            z: self.z + other,
+        }
+    }
+}
+impl Mul<i32> for V3 {
+    type Output = V3;
+    fn mul(self, other: i32) -> V3 {
+        V3 {
+            x: self.x * other,
+            y: self.y * other,
+            z: self.z * other,
+        }
+    }
+}
+impl Neg<> for V3 {
+    type Output = V3;
+    fn neg(self) -> V3 {
+        V3 {
+            x: -self.x,
+            y: -self.y,
+            z: -self.z,
+        }
+    }
+}
+impl<'a, 'b> Add<&'b V3> for &'a V3 {
+    type Output = V3;
+
+    fn add(self, other: &'b V3) -> V3 {
+        V3 {
+            x: self.x + other.x,
+            y: self.y + other.y,
+            z: self.z + other.z,
+        }
+    }
+}
+impl<'a> Mul<i32> for &'a V3 {
+    type Output = V3;
+
+    fn mul(self, other: i32) -> V3 {
+        V3 {
+            x: self.x * other,
+            y: self.y * other,
+            z: self.z * other,
+        }
+    }
+}
+impl<'a> Neg<> for &'a V3 {
+    type Output = V3;
+
+    fn neg(self) -> V3 {
+        V3 {
+            x: -self.x,
+            y: -self.y,
+            z: -self.z,
+        }
+    }
+}
+

+ 16 - 156
src/main.rs

@@ -2,150 +2,17 @@
 extern crate serde_derive;
 extern crate serde;
 extern crate serde_json;
+mod gridmath;
 use std::fs::File;
 use std::io::BufReader;
 use std::io::BufWriter;
 // use std::ops::{Add, Sub, Div};
 use std::collections::HashMap;
-use std::ops::{Add, Mul, Neg};
-#[macro_use]
-extern crate log;
+#[macro_use] extern crate log;
 extern crate simplelog;
 use rand::seq::SliceRandom;
 use simplelog::*;
-use std::fmt;
-
-#[derive(Clone, Serialize, Deserialize, Copy, Eq, PartialEq, Hash)]
-struct V3 {
-    x: i32,
-    y: i32,
-    z: i32,
-}
-
-impl V3 {
-    fn new(x: i32, y: i32, z: i32) -> V3 {
-        V3 { x: x, y: y, z: z }
-    }
-
-    fn neighbors(self) -> [V3; 6] {
-        let o = self.offsets();
-        [
-            self + o[0],
-            self + o[1],
-            self + o[2],
-            self + o[3],
-            self + o[4],
-            self + o[5],
-        ]
-    }
-
-    fn rotated_neighbors(self, axis: u8,) -> [V3; 6] {
-
-    //      [2]
-    //   [1][S][0]
-    //      [3]
-
-        [
-            self,
-            self,
-            self,
-            self,
-            self,
-            self,
-        ]
-    }
-
-
-    fn offsets(self) -> [V3; 6] {
-        [
-            V3::new(1, 0, 0),
-            V3::new(-1, 0, 0),
-            V3::new(0, 1, 0),
-            V3::new(0, -1, 0),
-            V3::new(0, 0, 1),
-            V3::new(0, 0, -1),
-        ]
-    }
-}
-
-impl fmt::Debug for V3 {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        write!(f, "V[{},{},{}]", self.x*8, self.y*8, self.z*8)
-    }
-}
-impl Add<V3> for V3 {
-    type Output = V3;
-    fn add(self, other: V3) -> V3 {
-        V3 {
-            x: self.x + other.x,
-            y: self.y + other.y,
-            z: self.z + other.z,
-        }
-    }
-}
-impl Add<i32> for V3 {
-    type Output = V3;
-    fn add(self, other: i32) -> V3 {
-        V3 {
-            x: self.x + other,
-            y: self.y + other,
-            z: self.z + other,
-        }
-    }
-}
-impl Mul<i32> for V3 {
-    type Output = V3;
-    fn mul(self, other: i32) -> V3 {
-        V3 {
-            x: self.x * other,
-            y: self.y * other,
-            z: self.z * other,
-        }
-    }
-}
-impl Neg<> for V3 {
-    type Output = V3;
-    fn neg(self) -> V3 {
-        V3 {
-            x: -self.x,
-            y: -self.y,
-            z: -self.z,
-        }
-    }
-}
-impl<'a, 'b> Add<&'b V3> for &'a V3 {
-    type Output = V3;
-
-    fn add(self, other: &'b V3) -> V3 {
-        V3 {
-            x: self.x + other.x,
-            y: self.y + other.y,
-            z: self.z + other.z,
-        }
-    }
-}
-impl<'a> Mul<i32> for &'a V3 {
-    type Output = V3;
-
-    fn mul(self, other: i32) -> V3 {
-        V3 {
-            x: self.x * other,
-            y: self.y * other,
-            z: self.z * other,
-        }
-    }
-}
-impl<'a> Neg<> for &'a V3 {
-    type Output = V3;
-
-    fn neg(self) -> V3 {
-        V3 {
-            x: -self.x,
-            y: -self.y,
-            z: -self.z,
-        }
-    }
-}
+use gridmath::*;
 
 
 /// A graphics tile as ex- or imported from a 3d program
@@ -299,7 +166,7 @@ fn wfc_solver(
     base_map: HashMap<V3, String>,
 ) -> HashMap<V3, String> {
     let mut new_grid = base_map;
-    // let gridsize = 8;
+
 
     for (pos, _name) in new_grid.clone() {
         for unsolved_neighbor in get_unsolved_neighbors(&pos, &new_grid) {
@@ -320,29 +187,12 @@ fn wfc_solver(
             debug!("\tSolving {} contraints in {:?}", contraint_map.len(), contraint_map );
 
 
-
             match solve(&contraint_map, &training_data) {
                 Some(tile) => {
-                    if tile == "BACKTRACK" {
-                        for n in unsolved_neighbor.neighbors().iter(){
-                               new_grid.remove(&n);
-                        }
-                    } else {
-                        new_grid.insert(unsolved_neighbor, tile);
-                    }
+                    new_grid.insert(unsolved_neighbor, tile);
                 },
-                None => {
-                    // for n in unsolved_neighbor.neighbors().iter(){
-                    //     new_grid.remove(&n);
-                    // }
-                }
-
+                None => info!("Unsolved tile")
             };
-
-
-
-
-            
            
         }
     }
@@ -353,6 +203,16 @@ fn wfc_solver(
 }
 
 fn main() {
+
+
+    let myvec = V3::new(1, 0, 0);
+    dbg!(&myvec);
+    dbg!(myvec.rotate_z_90());
+
+
+    // return;
+
+
     let _ = simplelog::SimpleLogger::init(LevelFilter::Info, Config::default());
 
     let mut import_volume: HashMap<V3, String> = HashMap::new();