diff --git a/Test/.idea/compiler.xml b/Test/.idea/compiler.xml
new file mode 100644
index 0000000..3397fb5
--- /dev/null
+++ b/Test/.idea/compiler.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__com_github_ben_manes_caffeine_caffeine_2_5_4.xml b/Test/.idea/libraries/Maven__com_github_ben_manes_caffeine_caffeine_2_5_4.xml
new file mode 100644
index 0000000..27679fd
--- /dev/null
+++ b/Test/.idea/libraries/Maven__com_github_ben_manes_caffeine_caffeine_2_5_4.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__com_google_guava_guava_19_0.xml b/Test/.idea/libraries/Maven__com_google_guava_guava_19_0.xml
new file mode 100644
index 0000000..68e23cc
--- /dev/null
+++ b/Test/.idea/libraries/Maven__com_google_guava_guava_19_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__com_jakewharton_disklrucache_2_0_2.xml b/Test/.idea/libraries/Maven__com_jakewharton_disklrucache_2_0_2.xml
new file mode 100644
index 0000000..4c9c65a
--- /dev/null
+++ b/Test/.idea/libraries/Maven__com_jakewharton_disklrucache_2_0_2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__net_jcip_jcip_annotations_1_0.xml b/Test/.idea/libraries/Maven__net_jcip_jcip_annotations_1_0.xml
new file mode 100644
index 0000000..d29c82f
--- /dev/null
+++ b/Test/.idea/libraries/Maven__net_jcip_jcip_annotations_1_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__net_jpountz_lz4_lz4_1_3_0.xml b/Test/.idea/libraries/Maven__net_jpountz_lz4_lz4_1_3_0.xml
new file mode 100644
index 0000000..7e9fceb
--- /dev/null
+++ b/Test/.idea/libraries/Maven__net_jpountz_lz4_lz4_1_3_0.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__org_eclipse_collections_eclipse_collections_7_1_1.xml b/Test/.idea/libraries/Maven__org_eclipse_collections_eclipse_collections_7_1_1.xml
new file mode 100644
index 0000000..90ce9f6
--- /dev/null
+++ b/Test/.idea/libraries/Maven__org_eclipse_collections_eclipse_collections_7_1_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__org_eclipse_collections_eclipse_collections_api_7_1_1.xml b/Test/.idea/libraries/Maven__org_eclipse_collections_eclipse_collections_api_7_1_1.xml
new file mode 100644
index 0000000..42bf864
--- /dev/null
+++ b/Test/.idea/libraries/Maven__org_eclipse_collections_eclipse_collections_api_7_1_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__org_eclipse_collections_eclipse_collections_forkjoin_7_1_1.xml b/Test/.idea/libraries/Maven__org_eclipse_collections_eclipse_collections_forkjoin_7_1_1.xml
new file mode 100644
index 0000000..73f6f2f
--- /dev/null
+++ b/Test/.idea/libraries/Maven__org_eclipse_collections_eclipse_collections_forkjoin_7_1_1.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__org_eclipse_paho_org_eclipse_paho_client_mqttv3_1_0_2.xml b/Test/.idea/libraries/Maven__org_eclipse_paho_org_eclipse_paho_client_mqttv3_1_0_2.xml
new file mode 100644
index 0000000..dc617d7
--- /dev/null
+++ b/Test/.idea/libraries/Maven__org_eclipse_paho_org_eclipse_paho_client_mqttv3_1_0_2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_runtime_1_0_7.xml b/Test/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_runtime_1_0_7.xml
new file mode 100644
index 0000000..e82e922
--- /dev/null
+++ b/Test/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_runtime_1_0_7.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_stdlib_1_0_7.xml b/Test/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_stdlib_1_0_7.xml
new file mode 100644
index 0000000..b8dd791
--- /dev/null
+++ b/Test/.idea/libraries/Maven__org_jetbrains_kotlin_kotlin_stdlib_1_0_7.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__org_joml_joml_1_9_9.xml b/Test/.idea/libraries/Maven__org_joml_joml_1_9_9.xml
new file mode 100644
index 0000000..892f829
--- /dev/null
+++ b/Test/.idea/libraries/Maven__org_joml_joml_1_9_9.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__org_mapdb_elsa_3_0_0_M5.xml b/Test/.idea/libraries/Maven__org_mapdb_elsa_3_0_0_M5.xml
new file mode 100644
index 0000000..f22e4e1
--- /dev/null
+++ b/Test/.idea/libraries/Maven__org_mapdb_elsa_3_0_0_M5.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/libraries/Maven__org_mapdb_mapdb_3_0_5.xml b/Test/.idea/libraries/Maven__org_mapdb_mapdb_3_0_5.xml
new file mode 100644
index 0000000..b54735d
--- /dev/null
+++ b/Test/.idea/libraries/Maven__org_mapdb_mapdb_3_0_5.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/misc.xml b/Test/.idea/misc.xml
new file mode 100644
index 0000000..b2d3cbb
--- /dev/null
+++ b/Test/.idea/misc.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/modules.xml b/Test/.idea/modules.xml
new file mode 100644
index 0000000..1a0e57f
--- /dev/null
+++ b/Test/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/.idea/workspace.xml b/Test/.idea/workspace.xml
new file mode 100644
index 0000000..4cad943
--- /dev/null
+++ b/Test/.idea/workspace.xml
@@ -0,0 +1,430 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Room
+ room
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1524355953894
+
+
+ 1524355953894
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No facets are configured
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+ Test
+
+
+
+
+
+
+
+
+
+
+
+ 9.0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/Test.iml b/Test/Test.iml
new file mode 100644
index 0000000..3420c6a
--- /dev/null
+++ b/Test/Test.iml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Test/src/LD41Map.java b/Test/src/LD41Map.java
index ee2c635..eba9b8f 100644
--- a/Test/src/LD41Map.java
+++ b/Test/src/LD41Map.java
@@ -17,9 +17,9 @@ import org.joml.Vector2i;
import javafx.util.Pair;
public class LD41Map {
-
public static class Vertex {
+
public final Room r;
public float value;
public Vertex parent;
@@ -30,9 +30,9 @@ public class LD41Map {
parent = null;
}
}
-
public static class Edge {
+
public final Vertex r1, r2;
public double dist;
@@ -42,13 +42,13 @@ public class LD41Map {
dist = r1.r.distance(r2.r);
}
}
-
public static class Room {
+
Rectangle bounds = new Rectangle();
// int width = 0, height = 0;
- // Vector2i pos = new Vector2i();
Map tiles;
+ // Vector2i pos = new Vector2i();
public float distance(Room r) {
// Vector2i center1 = new Vector2i(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
@@ -57,9 +57,9 @@ public class LD41Map {
return (float) Point.distance(bounds.x, bounds.y, r.bounds.x, r.bounds.y);
}
}
-
public static enum TileType {
GROUND, WALL, DOOR;
+
}
public static void main(String[] args) {
@@ -187,6 +187,115 @@ public class LD41Map {
start.r1.value = (float) (start.r2.value + start.dist);
}
}
+
+ // G list of edges
+ // rooms list of rooms
+
+ for(Edge ed : G)
+ {
+ // horizontal
+ float diff1 = ed.r1.r.bounds.y - ed.r2.r.bounds.y - ed.r2.r.bounds.height + constants.tunnelThickness;
+ float diff2 = ed.r2.r.bounds.y - ed.r1.r.bounds.y - ed.r1.r.bounds.height + constants.tunnelThickness;
+
+ // vertical
+ float diff3 = ed.r1.r.bounds.x - ed.r2.r.bounds.x - ed.r2.r.bounds.width + constants.tunnelThickness;
+ float diff4 = ed.r2.r.bounds.x - ed.r1.r.bounds.x - ed.r1.r.bounds.width + constants.tunnelThickness;
+
+ if(diff1 < 0 && diff2 < 0)
+ {
+ addStraightHorizontal(rooms,ed);
+ }
+ else if(diff3 < 0 && diff4 < 0)
+ {
+ addStraightVertical(rooms,ed);
+ }
+ else
+ addCurve(rooms,ed);
+
+ }
+
return new Pair<>(rooms, new Pair<>(root, G));
}
+
+ public static void addStraightHorizontal(Set rooms, Edge ed)
+ {
+ Room tunnel = new Room();
+ boolean multiBitX = (ed.r1.r.bounds.x < ed.r2.r.bounds.x);
+ boolean multiBitY = (ed.r1.r.bounds.y < ed.r2.r.bounds.y);
+
+ tunnel.bounds.x = (multiBitX)? ed.r1.r.bounds.x + ed.r1.r.bounds.width : ed.r2.r.bounds.x + ed.r2.r.bounds.width;
+ tunnel.bounds.y = (multiBitY)? ed.r2.r.bounds.y : ed.r1.r.bounds.y;
+
+ tunnel.bounds.width = Math.abs(ed.r1.r.bounds.x - ed.r2.r.bounds.x) - ((multiBitX)? ed.r1.r.bounds.width : ed.r2.r.bounds.width);
+ tunnel.bounds.height = constants.tunnelThickness;
+
+ rooms.add(tunnel);
+ }
+
+ public static void addStraightVertical(Set rooms, Edge ed)
+ {
+ Room tunnel = new Room();
+ boolean multiBitX = (ed.r1.r.bounds.x < ed.r2.r.bounds.x);
+ boolean multiBitY = (ed.r1.r.bounds.y < ed.r2.r.bounds.y);
+
+ tunnel.bounds.x = (multiBitX)? ed.r2.r.bounds.x : ed.r1.r.bounds.x;
+ tunnel.bounds.y = (multiBitY)? ed.r1.r.bounds.y + ed.r1.r.bounds.height : ed.r2.r.bounds.y + ed.r2.r.bounds.height;
+
+ tunnel.bounds.width = constants.tunnelThickness;
+ tunnel.bounds.height = Math.abs(ed.r1.r.bounds.y - ed.r2.r.bounds.y) - ((multiBitY)? ed.r1.r.bounds.height: ed.r2.r.bounds.height);
+
+ rooms.add(tunnel);
+ }
+
+ public static void addCurve(Set rooms, Edge ed)
+ {
+ Vector2i directionVec = new Vector2i(ed.r2.r.bounds.x - ed.r1.r.bounds.x, ed.r2.r.bounds.y - ed.r1.r.bounds.y);
+ boolean bigAngle = directionVec.x < 0;
+ double angle = Math.acos((directionVec.x + directionVec.y) / (directionVec.length()) + ((bigAngle)? 180 : 0));
+
+ if(angle < 90)
+ {
+ Room tunnel = new Room();
+ tunnel.bounds.x = ed.r1.r.bounds.x + ed.r1.r.bounds.width - constants.tunnelThickness;
+ tunnel.bounds.y = ed.r2.r.bounds.y;
+
+ tunnel.bounds.width = ed.r1.r.bounds.x - ed.r2.r.bounds.x;
+ tunnel.bounds.height = ed.r2.r.bounds.y - ed.r1.r.bounds.y;
+
+ // add tiles to room
+ }
+ else if(angle < 180)
+ {
+ Room tunnel = new Room();
+ tunnel.bounds.x = ed.r1.r.bounds.x + ed.r1.r.bounds.width - constants.tunnelThickness;
+ tunnel.bounds.y = ed.r1.r.bounds.y + ed.r1.r.bounds.height;
+
+ tunnel.bounds.width = ed.r1.r.bounds.x - ed.r2.r.bounds.x;
+ tunnel.bounds.height = ed.r1.r.bounds.y - ed.r2.r.bounds.y;
+
+ // add tiles to room
+ }
+ else if(angle < 270)
+ {
+ Room tunnel = new Room();
+ tunnel.bounds.x = ed.r2.r.bounds.x + ed.r2.r.bounds.width;
+ tunnel.bounds.y = ed.r1.r.bounds.y + ed.r1.r.bounds.height;
+
+ tunnel.bounds.width = ed.r1.r.bounds.x - ed.r2.r.bounds.x + constants.tunnelThickness;
+ tunnel.bounds.height = ed.r1.r.bounds.y - ed.r2.r.bounds.y + constants.tunnelThickness;
+
+ // add tiles to room
+ }
+ else //(angle < 360)
+ {
+ Room tunnel = new Room();
+ tunnel.bounds.x = ed.r2.r.bounds.x + ed.r2.r.bounds.width;
+ tunnel.bounds.y = ed.r2.r.bounds.y - ed.r2.r.bounds.height;
+
+ tunnel.bounds.width = ed.r1.r.bounds.x - ed.r2.r.bounds.x + constants.tunnelThickness;
+ tunnel.bounds.height = ed.r2.r.bounds.y - ed.r2.r.bounds.height - ed.r1.r.bounds.y + constants.tunnelThickness;
+
+ // add tiles to room
+ }
+ }
}
\ No newline at end of file
diff --git a/Test/src/constants.java b/Test/src/constants.java
new file mode 100644
index 0000000..a60b5fd
--- /dev/null
+++ b/Test/src/constants.java
@@ -0,0 +1,4 @@
+public enum constants
+{;
+ static final int tunnelThickness = 3;
+}
diff --git a/Test/target/classes/LD41Map$1.class b/Test/target/classes/LD41Map$1.class
new file mode 100644
index 0000000..ed0acbd
Binary files /dev/null and b/Test/target/classes/LD41Map$1.class differ
diff --git a/Test/target/classes/LD41Map$2.class b/Test/target/classes/LD41Map$2.class
new file mode 100644
index 0000000..7159404
Binary files /dev/null and b/Test/target/classes/LD41Map$2.class differ
diff --git a/Test/target/classes/LD41Map$Edge.class b/Test/target/classes/LD41Map$Edge.class
new file mode 100644
index 0000000..ad954fb
Binary files /dev/null and b/Test/target/classes/LD41Map$Edge.class differ
diff --git a/Test/target/classes/LD41Map$Room.class b/Test/target/classes/LD41Map$Room.class
new file mode 100644
index 0000000..f08618a
Binary files /dev/null and b/Test/target/classes/LD41Map$Room.class differ
diff --git a/Test/target/classes/LD41Map$TileType.class b/Test/target/classes/LD41Map$TileType.class
new file mode 100644
index 0000000..5d2310f
Binary files /dev/null and b/Test/target/classes/LD41Map$TileType.class differ
diff --git a/Test/target/classes/LD41Map$Vertex.class b/Test/target/classes/LD41Map$Vertex.class
new file mode 100644
index 0000000..f10c578
Binary files /dev/null and b/Test/target/classes/LD41Map$Vertex.class differ
diff --git a/Test/target/classes/LD41Map.class b/Test/target/classes/LD41Map.class
new file mode 100644
index 0000000..60a175e
Binary files /dev/null and b/Test/target/classes/LD41Map.class differ
diff --git a/Test/target/classes/constants.class b/Test/target/classes/constants.class
new file mode 100644
index 0000000..7ab61e1
Binary files /dev/null and b/Test/target/classes/constants.class differ