diff --git a/.gitignore b/.gitignore
index bafea84a3..baee37e51 100644
--- a/.gitignore
+++ b/.gitignore
@@ -92,5 +92,4 @@ gradle-app.setting
gradle/wrapper/gradle-wrapper.properties
# Visual Studio Code configs
-.vscode/*
-src/test/java/legup/TestRunner.java
+.vscode/*
\ No newline at end of file
diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs
deleted file mode 100644
index ea640e792..000000000
--- a/.settings/org.eclipse.buildship.core.prefs
+++ /dev/null
@@ -1,13 +0,0 @@
-arguments=--init-script /home/gamma/.cache/jdtls/config/org.eclipse.osgi/55/0/.cp/gradle/init/init.gradle
-auto.sync=false
-build.scans.enabled=false
-connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
-connection.project.dir=
-eclipse.preferences.version=1
-gradle.user.home=
-java.home=/usr/lib/jvm/java-21-openjdk-amd64
-jvm.arguments=
-offline.mode=false
-override.workspace.settings=true
-show.console.view=true
-show.executions.view=true
diff --git a/output_path/test/src/resources/puzzles/sudoku/rules/LastCellForNumberDirectRule/TestBoard b/output_path/test/src/resources/puzzles/sudoku/rules/LastCellForNumberDirectRule/TestBoard
deleted file mode 100644
index a41ad749c..000000000
--- a/output_path/test/src/resources/puzzles/sudoku/rules/LastCellForNumberDirectRule/TestBoard
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
-
diff --git a/output_path/test/src/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRegion b/output_path/test/src/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRegion
deleted file mode 100644
index 49dae4aa6..000000000
--- a/output_path/test/src/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRegion
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
-
diff --git a/output_path/test/src/resources/puzzles/sudoku/rules/RepeatedNumberContradictionRule/a b/output_path/test/src/resources/puzzles/sudoku/rules/RepeatedNumberContradictionRule/a
deleted file mode 100644
index e69de29bb..000000000
diff --git a/puzzles files/binary/10x10 Binary Hard/10x10 Binary Hard 1 b/puzzles files/binary/10x10 Binary Hard/10x10 Binary Hard 1
deleted file mode 100644
index 42ccf371b..000000000
--- a/puzzles files/binary/10x10 Binary Hard/10x10 Binary Hard 1
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/10x10 Binary Hard/10x10 Binary Hard 2 b/puzzles files/binary/10x10 Binary Hard/10x10 Binary Hard 2
deleted file mode 100644
index d73caa5d2..000000000
--- a/puzzles files/binary/10x10 Binary Hard/10x10 Binary Hard 2
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/10x10 Binary Hard/10x10 Binary Hard 3 b/puzzles files/binary/10x10 Binary Hard/10x10 Binary Hard 3
deleted file mode 100644
index 99ec9769b..000000000
--- a/puzzles files/binary/10x10 Binary Hard/10x10 Binary Hard 3
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/10x10 Binary Medium/10x10 Binary Medium 1 b/puzzles files/binary/10x10 Binary Medium/10x10 Binary Medium 1
deleted file mode 100644
index d203617c8..000000000
--- a/puzzles files/binary/10x10 Binary Medium/10x10 Binary Medium 1
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/10x10 Binary Medium/10x10 Binary Medium 2 b/puzzles files/binary/10x10 Binary Medium/10x10 Binary Medium 2
deleted file mode 100644
index db56f04f3..000000000
--- a/puzzles files/binary/10x10 Binary Medium/10x10 Binary Medium 2
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/10x10 Binary Medium/10x10 Binary Medium 3 b/puzzles files/binary/10x10 Binary Medium/10x10 Binary Medium 3
deleted file mode 100644
index 11940a6eb..000000000
--- a/puzzles files/binary/10x10 Binary Medium/10x10 Binary Medium 3
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/10x10 Binary Very Hard/10x10 Binary Very Hard 1 b/puzzles files/binary/10x10 Binary Very Hard/10x10 Binary Very Hard 1
deleted file mode 100644
index 828a450cf..000000000
--- a/puzzles files/binary/10x10 Binary Very Hard/10x10 Binary Very Hard 1
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 1 b/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 1
deleted file mode 100644
index 7b22ffc10..000000000
--- a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 1
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
\ No newline at end of file
diff --git a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 2 b/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 2
deleted file mode 100644
index ea8ef93b0..000000000
--- a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 2
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
-
\ No newline at end of file
diff --git a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 3 b/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 3
deleted file mode 100644
index 0f0ff745e..000000000
--- a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 3
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
-
\ No newline at end of file
diff --git a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 4 b/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 4
deleted file mode 100644
index da76d067b..000000000
--- a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 4
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
-
\ No newline at end of file
diff --git a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 5 b/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 5
deleted file mode 100644
index a1ea13988..000000000
--- a/puzzles files/binary/6x6 Binary Easy/6x6 Binary Easy 5
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Hard/6x6 Binary Hard 1 b/puzzles files/binary/6x6 Binary Hard/6x6 Binary Hard 1
deleted file mode 100644
index 5f7f72a8a..000000000
--- a/puzzles files/binary/6x6 Binary Hard/6x6 Binary Hard 1
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Hard/6x6 Binary Hard 2 b/puzzles files/binary/6x6 Binary Hard/6x6 Binary Hard 2
deleted file mode 100644
index a4ed30c31..000000000
--- a/puzzles files/binary/6x6 Binary Hard/6x6 Binary Hard 2
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Hard/6x6 Binary Hard 3 b/puzzles files/binary/6x6 Binary Hard/6x6 Binary Hard 3
deleted file mode 100644
index fc0e413c1..000000000
--- a/puzzles files/binary/6x6 Binary Hard/6x6 Binary Hard 3
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Medium/6x6 Binary Medium 1 b/puzzles files/binary/6x6 Binary Medium/6x6 Binary Medium 1
deleted file mode 100644
index a5ab8a2dc..000000000
--- a/puzzles files/binary/6x6 Binary Medium/6x6 Binary Medium 1
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Medium/6x6 Binary Medium 2 b/puzzles files/binary/6x6 Binary Medium/6x6 Binary Medium 2
deleted file mode 100644
index 4be5fdaad..000000000
--- a/puzzles files/binary/6x6 Binary Medium/6x6 Binary Medium 2
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Medium/6x6 Binary Medium 3 b/puzzles files/binary/6x6 Binary Medium/6x6 Binary Medium 3
deleted file mode 100644
index eba370cab..000000000
--- a/puzzles files/binary/6x6 Binary Medium/6x6 Binary Medium 3
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Very Hard/6x6 Binary Very Hard 1 b/puzzles files/binary/6x6 Binary Very Hard/6x6 Binary Very Hard 1
deleted file mode 100644
index faa68fa5e..000000000
--- a/puzzles files/binary/6x6 Binary Very Hard/6x6 Binary Very Hard 1
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Very Hard/6x6 Binary Very Hard 2 b/puzzles files/binary/6x6 Binary Very Hard/6x6 Binary Very Hard 2
deleted file mode 100644
index 3c707bdaa..000000000
--- a/puzzles files/binary/6x6 Binary Very Hard/6x6 Binary Very Hard 2
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/6x6 Binary Very Hard/6x6 Binary Very Hard 3 b/puzzles files/binary/6x6 Binary Very Hard/6x6 Binary Very Hard 3
deleted file mode 100644
index 217a032d8..000000000
--- a/puzzles files/binary/6x6 Binary Very Hard/6x6 Binary Very Hard 3
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Easy/8x8 Binary Easy 1 b/puzzles files/binary/8x8 Binary Easy/8x8 Binary Easy 1
deleted file mode 100644
index befd674f9..000000000
--- a/puzzles files/binary/8x8 Binary Easy/8x8 Binary Easy 1
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Easy/8x8 Binary Easy 2 b/puzzles files/binary/8x8 Binary Easy/8x8 Binary Easy 2
deleted file mode 100644
index 724426c26..000000000
--- a/puzzles files/binary/8x8 Binary Easy/8x8 Binary Easy 2
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Easy/8x8 Binary Easy 3 b/puzzles files/binary/8x8 Binary Easy/8x8 Binary Easy 3
deleted file mode 100644
index 92a96c72b..000000000
--- a/puzzles files/binary/8x8 Binary Easy/8x8 Binary Easy 3
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Hard/8x8 Binary Hard 1 b/puzzles files/binary/8x8 Binary Hard/8x8 Binary Hard 1
deleted file mode 100644
index 34eaf8388..000000000
--- a/puzzles files/binary/8x8 Binary Hard/8x8 Binary Hard 1
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Hard/8x8 Binary Hard 2 b/puzzles files/binary/8x8 Binary Hard/8x8 Binary Hard 2
deleted file mode 100644
index 9ef23277e..000000000
--- a/puzzles files/binary/8x8 Binary Hard/8x8 Binary Hard 2
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Hard/8x8 Binary Hard 3 b/puzzles files/binary/8x8 Binary Hard/8x8 Binary Hard 3
deleted file mode 100644
index 287ff6f68..000000000
--- a/puzzles files/binary/8x8 Binary Hard/8x8 Binary Hard 3
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Medium/8x8 Binary Medium 1 b/puzzles files/binary/8x8 Binary Medium/8x8 Binary Medium 1
deleted file mode 100644
index 47dae23dc..000000000
--- a/puzzles files/binary/8x8 Binary Medium/8x8 Binary Medium 1
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Medium/8x8 Binary Medium 2 b/puzzles files/binary/8x8 Binary Medium/8x8 Binary Medium 2
deleted file mode 100644
index ae4cb8bb0..000000000
--- a/puzzles files/binary/8x8 Binary Medium/8x8 Binary Medium 2
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Medium/8x8 Binary Medium 3 b/puzzles files/binary/8x8 Binary Medium/8x8 Binary Medium 3
deleted file mode 100644
index 2f951ecc4..000000000
--- a/puzzles files/binary/8x8 Binary Medium/8x8 Binary Medium 3
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Very Hard/8x8 Binary Very Hard 1 b/puzzles files/binary/8x8 Binary Very Hard/8x8 Binary Very Hard 1
deleted file mode 100644
index 9c875523b..000000000
--- a/puzzles files/binary/8x8 Binary Very Hard/8x8 Binary Very Hard 1
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Very Hard/8x8 Binary Very Hard 2 b/puzzles files/binary/8x8 Binary Very Hard/8x8 Binary Very Hard 2
deleted file mode 100644
index 14f2e4ad2..000000000
--- a/puzzles files/binary/8x8 Binary Very Hard/8x8 Binary Very Hard 2
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/binary/8x8 Binary Very Hard/8x8 Binary Very Hard 3 b/puzzles files/binary/8x8 Binary Very Hard/8x8 Binary Very Hard 3
deleted file mode 100644
index ad319a4b7..000000000
--- a/puzzles files/binary/8x8 Binary Very Hard/8x8 Binary Very Hard 3
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/puzzles files/light-color-theme.txt b/puzzles files/light-color-theme.txt
deleted file mode 100644
index 5c45bc71b..000000000
--- a/puzzles files/light-color-theme.txt
+++ /dev/null
@@ -1,99 +0,0 @@
-correct: BLUE
-incorrect: RED
-error: RED_700
-info: GRAY_900
-ui-movement: GRAY_300
-password-field-background: LIGHT_BLUE_400
-password-field-unfocused-background: GRAY_200
-progress-bar-background: GRAY_200
-progress-bar-foreground: LIGHT_BLUE_400
-text-field-background: LIGHT_BLUE_400
-text-field-unfocused-background: GRAY_200
-light-line-border: GRAY_200
-thick-line-border: GRAY_200
-data-selection-background: GRAY
-element-view: BLACK
-button-highlight: GRAY_300
-button-background: GRAY_200
-button-foreground: BLACK
-checkbox-background: WHITE
-checkbox-foreground: BLACK
-combobox-background: WHITE
-combobox-foreground: BLACK
-combobox-button-background: GRAY_300
-combobox-selection-background: WHITE
-combobox-selection-foreground: BLACK
-combobox-selected-in-drop-down-background: GRAY_200
-label-background: WHITE
-label-foreground: BLACK
-menu-background: LIGHT_BLUE_100
-menu-foreground: BLACK
-menu-selection-background: GRAY_200
-menu-selection-foreground: BLACK
-menu-disabled-foreground: #000
-menu-bar-background: WHITE
-menu-bar-foreground: BLACK
-menu-item-disabled-foreground: #000
-menu-item-selection-background: GRAY_200
-menu-item-selection-foreground: BLACK
-menu-item-background: WHITE
-menu-item-foreground: BLACK
-option-pane-background: WHITE
-panel-background-color: WHITE
-popup-menu-background: WHITE
-popup-menu-foreground: BLACK
-radio-button-background: WHITE
-radio-button-foreground: BLACK
-spinner-background: WHITE
-spinner-foreground: BLACK
-spinner-arrow-button-background: GRAY_200
-scroll-bar-track: GRAY_200
-scroll-bar-thumb: GRAY_300
-scroll-bar-thumb-dark-shadow: GRAY_300
-scroll-bar-thumb-highlight: GRAY_300
-scroll-bar-thumb-shadow: GRAY_300
-scroll-bar-arrow-button-background: GRAY_300
-scroll-pane-background: WHITE
-slider-background: WHITE
-slider-foreground: GRAY_700
-slider-track-color: BLACK
-split-pane-background: WHITE
-tabbed-pane-background: WHITE
-tabbed-pane-foreground: BLACK
-tabbed-pane-highlight: GRAY_200
-tabbed-pane-border-highlight: GRAY_300
-table-selection-background: GRAY_100
-table-selection-foreground: BLACK
-table-background: WHITE
-table-grid-color: GRAY_200
-table-header-background: GRAY_200
-text-area-background: GRAY_200
-text-area-foreground: BLACK
-toggle-button-background: WHITE
-toggle-button-foreground: BLACK
-tool-bar-background: WHITE
-tool-bar-foreground: BLACK
-tool-bar-docking-background: LIGHT_GREEN_A100
-tool-bar-floating-background: GRAY_200
-tree-selection-foreground: BLACK
-tree-foreground: BLACK
-tree-selection-background: GRAY_200
-tree-background: WHITE
-radio-button-menu-item-foreground: BLACK
-radio-button-menu-item-selection-foreground: BLACK
-radio-button-menu-item-selection-background: GRAY_200
-checkbox-menu-item-selection-background: GRAY_200
-checkbox-menu-item-foreground: BLACK
-checkbox-menu-item-selection-foreground: BLACK
-text-pane-background: GRAY_50
-text-pane-selection-background: LIGHT_BLUE_200
-text-pane-inactive-foreground: GRAY_500
-editor-pane-background: GRAY_50
-editor-pane-selection-background: LIGHT_BLUE_200
-editor-pane-inactive-foreground: GRAY_500
-separator-background: GRAY_300
-separator-foreground: GRAY_300
-tool-tip-background: GRAY_500
-tool-tip-foreground: GRAY_50
-color-chooser-background: WHITE
-color-chooser-foreground: BLACK
diff --git a/puzzles files/starbattle/5x5 Star Battle 1 star Normal/5x5 Star Battle 1 star Normal 1.xml b/puzzles files/starbattle/5x5 Star Battle 1 star Normal/5x5 Star Battle 1 star Normal 1.xml
new file mode 100644
index 000000000..b86e16ff2
--- /dev/null
+++ b/puzzles files/starbattle/5x5 Star Battle 1 star Normal/5x5 Star Battle 1 star Normal 1.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+
+
+
+
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 Star Battle 1star Normal1.xml b/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 Star Battle 1star Normal1.xml
new file mode 100644
index 000000000..110dd9abe
--- /dev/null
+++ b/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 Star Battle 1star Normal1.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 Star Battle 1star Normal2.xml b/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 Star Battle 1star Normal2.xml
new file mode 100644
index 000000000..49efeba59
--- /dev/null
+++ b/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 Star Battle 1star Normal2.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 StarBattle 1star Normal3.xml b/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 StarBattle 1star Normal3.xml
new file mode 100644
index 000000000..855943612
--- /dev/null
+++ b/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 StarBattle 1star Normal3.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/7x7 Star Battle 1 star Hard/7x7 Star Battle 1star Hard1.xml b/puzzles files/starbattle/7x7 Star Battle 1 star Hard/7x7 Star Battle 1star Hard1.xml
new file mode 100644
index 000000000..c1d7770f6
--- /dev/null
+++ b/puzzles files/starbattle/7x7 Star Battle 1 star Hard/7x7 Star Battle 1star Hard1.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/7x7 Star Battle 1 star Normal/7x7 Star Battle 1star Normal.xml b/puzzles files/starbattle/7x7 Star Battle 1 star Normal/7x7 Star Battle 1star Normal.xml
new file mode 100644
index 000000000..cab0a0a5e
--- /dev/null
+++ b/puzzles files/starbattle/7x7 Star Battle 1 star Normal/7x7 Star Battle 1star Normal.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/7x7 Star Battle 1 star Normal/7x7 Star Battle 1star Normal1.xml b/puzzles files/starbattle/7x7 Star Battle 1 star Normal/7x7 Star Battle 1star Normal1.xml
new file mode 100644
index 000000000..70b81e376
--- /dev/null
+++ b/puzzles files/starbattle/7x7 Star Battle 1 star Normal/7x7 Star Battle 1star Normal1.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/7x7 Star Battle 1 star Normal/7x7 Star Battle 1star Normal2.xml b/puzzles files/starbattle/7x7 Star Battle 1 star Normal/7x7 Star Battle 1star Normal2.xml
new file mode 100644
index 000000000..c541ece06
--- /dev/null
+++ b/puzzles files/starbattle/7x7 Star Battle 1 star Normal/7x7 Star Battle 1star Normal2.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/8x8 Star Battle 1 star Normal/8x8 Star Battle 1star Normal1.xml b/puzzles files/starbattle/8x8 Star Battle 1 star Normal/8x8 Star Battle 1star Normal1.xml
new file mode 100644
index 000000000..02dd5d6c0
--- /dev/null
+++ b/puzzles files/starbattle/8x8 Star Battle 1 star Normal/8x8 Star Battle 1star Normal1.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/8x8 Star Battle 1 star Normal/8x8 Star Battle 1star Normal2.xml b/puzzles files/starbattle/8x8 Star Battle 1 star Normal/8x8 Star Battle 1star Normal2.xml
new file mode 100644
index 000000000..0df84ef62
--- /dev/null
+++ b/puzzles files/starbattle/8x8 Star Battle 1 star Normal/8x8 Star Battle 1star Normal2.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/puzzles files/starbattle/8x8 Star Battle 1 star Normal/8x8 Star Battle 1star Normal3.xml b/puzzles files/starbattle/8x8 Star Battle 1 star Normal/8x8 Star Battle 1star Normal3.xml
new file mode 100644
index 000000000..725c91d7f
--- /dev/null
+++ b/puzzles files/starbattle/8x8 Star Battle 1 star Normal/8x8 Star Battle 1star Normal3.xml
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/app/Config.java b/src/main/java/edu/rpi/legup/app/Config.java
index b04ef9b88..3d212a597 100644
--- a/src/main/java/edu/rpi/legup/app/Config.java
+++ b/src/main/java/edu/rpi/legup/app/Config.java
@@ -96,11 +96,6 @@ public static String convertDisplayNameToClassName(String displayName) {
return className;
}
- /**
- * Gets a list of all available puzzle display names
- *
- * @return a List of puzzle display names as Strings
- */
public List getPuzzleNames() {
List names = new LinkedList();
for (String puzzle : this.getPuzzleClassNames()) {
diff --git a/src/main/java/edu/rpi/legup/app/GameBoardFacade.java b/src/main/java/edu/rpi/legup/app/GameBoardFacade.java
index c6f92e5b5..12f6b73d0 100644
--- a/src/main/java/edu/rpi/legup/app/GameBoardFacade.java
+++ b/src/main/java/edu/rpi/legup/app/GameBoardFacade.java
@@ -89,11 +89,6 @@ public void initializeUI() {
});
}
- /**
- * Sets the current puzzle in the game board
- *
- * @param puzzle the Puzzle to set
- */
public void setPuzzle(Puzzle puzzle) {
this.puzzle = puzzle;
this.puzzleSolver.setPuzzleView(puzzle);
@@ -118,21 +113,11 @@ public static void setupConfig() {
GameBoardFacade.getInstance().setConfig(config);
}
- /**
- * Sets the current puzzle editor with the given puzzle
- *
- * @param puzzle the Puzzle to set in the editor
- */
public void setPuzzleEditor(Puzzle puzzle) {
this.puzzle = puzzle;
this.puzzleEditor.setPuzzleView(puzzle);
}
- /**
- * Sets the configuration object for the GameBoardFacade
- *
- * @param config config the Config object to set
- */
public void setConfig(Config config) {
this.config = config;
}
@@ -191,7 +176,7 @@ public boolean validateTextInput(String game, String[] statements) throws Runtim
}
/**
- * Loads an empty puzzle with the specified dimensions
+ * Loads an empty puzzle
*
* @param game name of the puzzle
* @param rows the number of rows on the board
@@ -202,10 +187,10 @@ public void loadPuzzle(String game, int rows, int columns) throws RuntimeExcepti
String qualifiedClassName = config.getPuzzleClassForName(game);
LOGGER.debug("Loading " + qualifiedClassName);
- try {
- Class> c = Class.forName(qualifiedClassName);
- Constructor> cons = c.getConstructor();
- Puzzle puzzle = (Puzzle) cons.newInstance();
+ try {
+ Class> c = Class.forName(qualifiedClassName);
+ Constructor> cons = c.getConstructor();
+ Puzzle puzzle = (Puzzle) cons.newInstance();
PuzzleImporter importer = puzzle.getImporter();
if (importer == null) {
@@ -240,12 +225,6 @@ public void loadPuzzle(String game, int rows, int columns) throws RuntimeExcepti
}
}
- /**
- * Loads an empty puzzle with the specified input
- *
- * @param game name of the puzzle
- * @param statements an array of statements to load the puzzle with
- */
public void loadPuzzle(String game, String[] statements) {
String qualifiedClassName = config.getPuzzleClassForName(game);
LOGGER.debug("Loading " + qualifiedClassName);
@@ -288,7 +267,7 @@ public void loadPuzzle(String game, String[] statements) {
}
/**
- * Loads a puzzle file from the specified file
+ * Loads a puzzle file
*
* @param fileName file name of the board file
* @throws InvalidFileFormatException if the file format is invalid or if the file cannot be
diff --git a/src/main/java/edu/rpi/legup/app/InvalidConfigException.java b/src/main/java/edu/rpi/legup/app/InvalidConfigException.java
index cad80b5ce..2526b3776 100644
--- a/src/main/java/edu/rpi/legup/app/InvalidConfigException.java
+++ b/src/main/java/edu/rpi/legup/app/InvalidConfigException.java
@@ -5,11 +5,6 @@
* errors
*/
public class InvalidConfigException extends Exception {
- /**
- * Constructs a new InvalidConfigException with the specified detail message
- *
- * @param message the detail message
- */
public InvalidConfigException(String message) {
super(message);
}
diff --git a/src/main/java/edu/rpi/legup/app/LegupPreferences.java b/src/main/java/edu/rpi/legup/app/LegupPreferences.java
index 3d17233bd..0bca27b49 100644
--- a/src/main/java/edu/rpi/legup/app/LegupPreferences.java
+++ b/src/main/java/edu/rpi/legup/app/LegupPreferences.java
@@ -81,7 +81,7 @@ public class LegupPreferences {
* Gets the legup preferences singleton instance This method ensures that only one instance of
* LegupPreferences exists
*
- * @return the singleton instance of LegupPreferences
+ * @return legup preferences
*/
public static LegupPreferences getInstance() {
if (instance == null) {
@@ -100,30 +100,23 @@ private LegupPreferences() {}
* Gets the user preference by the string key
*
* @param key key name of the preference
- * @return value of the preference or {@code null} if the preference does not exist
+ * @return value of the preference
*/
public String getUserPref(String key) {
return preferencesMap.get(key);
}
/**
- * Sets the user preference for the specified key to the provided value
+ * Gets the user preference by the string key, value pair
*
- * @param key key to set for the preference
- * @param value value to set for the preference
+ * @param key key name of the preference
+ * @param value value of the preference
*/
public void setUserPref(String key, String value) {
preferences.put(key, value);
preferencesMap.put(key, value);
}
- /**
- * Retrieves the user preference associated with the specified key as a boolean
- *
- * @param key the key for the preference to retrieve
- * @return the boolean value of the preference
- * @throws RuntimeException if the preference value cannot be interpreted as a boolean
- */
public boolean getUserPrefAsBool(String key) {
if (preferencesMap.get(key).equalsIgnoreCase(Boolean.toString(true))) {
return true;
@@ -136,20 +129,10 @@ public boolean getUserPrefAsBool(String key) {
}
}
- /**
- * Gets the saved path
- *
- * @return the saved path as a String
- */
public String getSavedPath() {
return SAVED_PATH;
}
- /**
- * Sets the saved path to the specified value
- *
- * @param path the new saved path
- */
public void setSavedPath(String path) {
SAVED_PATH = path;
}
diff --git a/src/main/java/edu/rpi/legup/controller/Controller.java b/src/main/java/edu/rpi/legup/controller/Controller.java
index 823bac716..4910e24d9 100644
--- a/src/main/java/edu/rpi/legup/controller/Controller.java
+++ b/src/main/java/edu/rpi/legup/controller/Controller.java
@@ -24,11 +24,6 @@ public Controller() {
pan = false;
}
- /**
- * Sets the ScrollView instance that this controller manages
- *
- * @param viewer The ScrollView instance to be set
- */
public void setViewer(ScrollView viewer) {
this.viewer = viewer;
}
diff --git a/src/main/java/edu/rpi/legup/controller/EditorElementController.java b/src/main/java/edu/rpi/legup/controller/EditorElementController.java
index 050f5bd65..9922ccaed 100644
--- a/src/main/java/edu/rpi/legup/controller/EditorElementController.java
+++ b/src/main/java/edu/rpi/legup/controller/EditorElementController.java
@@ -25,33 +25,19 @@ public EditorElementController() {
prevButton = null;
}
- /**
- * Sets the ElementController instance for this controller
- *
- * @param elementController the ElementController instance to be set
- */
public void setElementController(ElementController elementController) {
this.elementController = elementController;
}
- /**
- * Handles the event when a button associated with an Element is pressed
- *
- * @param element the Element associated with the button that was pressed
- */
public void buttonPressed(Element element) {
// TODO: implement what happens when element is pressed
+ System.out.printf("%s button pressed!\n", element.getElementName());
if (elementController != null) {
elementController.setSelectedElement(element);
}
}
- /**
- * Handles action events triggered by buttons
- *
- * @param e the event to be processed
- */
@Override
public void actionPerformed(ActionEvent e) {
lastSource = e.getSource();
diff --git a/src/main/java/edu/rpi/legup/controller/ElementController.java b/src/main/java/edu/rpi/legup/controller/ElementController.java
index 436b078b9..5840650e1 100644
--- a/src/main/java/edu/rpi/legup/controller/ElementController.java
+++ b/src/main/java/edu/rpi/legup/controller/ElementController.java
@@ -26,17 +26,13 @@
import java.awt.*;
import java.awt.event.*;
-/**
- * The ElementController class manages UI interactions related to elements in a {@link BoardView}.
- * It handles mouse events, key events, and actions related to element selection and manipulation
- */
public class ElementController
implements MouseListener, MouseMotionListener, ActionListener, KeyListener {
protected BoardView boardView;
private Element selectedElement;
/**
- * ElementController Constructor controller to handle ui events associated interacting with a
+ * ElementController Constructor controller to handles ui events associated interacting with a
* {@link BoardView}
*/
public ElementController() {
@@ -90,7 +86,6 @@ public void mouseReleased(MouseEvent e) {
if (boardView == null) {
boardView = getInstance().getLegupUI().getEditorBoardView();
}
-
Board board = boardView.getBoard();
ElementView elementView = boardView.getElement(e.getPoint());
TreeViewSelection selection = null;
@@ -142,8 +137,17 @@ public void mouseReleased(MouseEvent e) {
if (this.boardView.getBoard() instanceof TreeTentBoard) {
scaledPoint.setLocation(scaledPoint.getX() - 1, scaledPoint.getY() - 1);
}
-
+ System.out.printf(
+ "selected Element is NOT null, attempting to change board at (%d, %d)\n",
+ scaledPoint.x, scaledPoint.y);
+ // System.out.println("Before: " + b.getCell(scaledPoint.x,
+ // scaledPoint.y).getData());
b.setCell(scaledPoint.x, scaledPoint.y, this.selectedElement, e);
+ // System.out.println("After: " + b.getCell(scaledPoint.x,
+ // scaledPoint.y).getData());
+ // } else {
+ // System.out.println("selected Element is null!");
+ // }
boardView.repaint();
}
diff --git a/src/main/java/edu/rpi/legup/history/CommandError.java b/src/main/java/edu/rpi/legup/history/CommandError.java
index 78027f6ab..f848485eb 100644
--- a/src/main/java/edu/rpi/legup/history/CommandError.java
+++ b/src/main/java/edu/rpi/legup/history/CommandError.java
@@ -25,20 +25,10 @@ public enum CommandError {
private String value;
- /**
- * Constructs a CommandError with the specified error message
- *
- * @param value The error message associated with the command error
- */
CommandError(String value) {
this.value = value;
}
- /**
- * Returns the error message associated with this CommandError
- *
- * @return The error message
- */
@Override
public String toString() {
return value;
diff --git a/src/main/java/edu/rpi/legup/history/CommandState.java b/src/main/java/edu/rpi/legup/history/CommandState.java
index b72f15480..90e44b70c 100644
--- a/src/main/java/edu/rpi/legup/history/CommandState.java
+++ b/src/main/java/edu/rpi/legup/history/CommandState.java
@@ -12,20 +12,10 @@ public enum CommandState {
private String value;
- /**
- * Constructs a CommandState with the specified state name
- *
- * @param value The name associated with the command state
- */
CommandState(String value) {
this.value = value;
}
- /**
- * Returns the name associated with this CommandState
- *
- * @return The state name
- */
@Override
public String toString() {
return value;
diff --git a/src/main/java/edu/rpi/legup/history/DeleteTreeElementCommand.java b/src/main/java/edu/rpi/legup/history/DeleteTreeElementCommand.java
index bfd9cd7f5..f56437400 100644
--- a/src/main/java/edu/rpi/legup/history/DeleteTreeElementCommand.java
+++ b/src/main/java/edu/rpi/legup/history/DeleteTreeElementCommand.java
@@ -32,9 +32,6 @@ public void executeCommand() {
Puzzle puzzle = GameBoardFacade.getInstance().getPuzzleModule();
List selectedViews = selection.getSelectedViews();
- if (selectedViews.isEmpty()) {
- return;
- }
TreeElementView firstSelectedView = selectedViews.get(0);
TreeElementView newSelectedView;
@@ -51,7 +48,6 @@ public void executeCommand() {
}
for (TreeElementView selectedView : selectedViews) {
- System.out.println("DELETED");
TreeElement element = selectedView.getTreeElement();
tree.removeTreeElement(element);
puzzle.notifyTreeListeners(listener -> listener.onTreeElementRemoved(element));
diff --git a/src/main/java/edu/rpi/legup/history/EditDataCommand.java b/src/main/java/edu/rpi/legup/history/EditDataCommand.java
index 0d51cc717..a06a26854 100644
--- a/src/main/java/edu/rpi/legup/history/EditDataCommand.java
+++ b/src/main/java/edu/rpi/legup/history/EditDataCommand.java
@@ -9,7 +9,6 @@
import edu.rpi.legup.model.tree.*;
import edu.rpi.legup.ui.boardview.BoardView;
import edu.rpi.legup.ui.boardview.ElementView;
-import edu.rpi.legup.ui.lookandfeel.materialdesign.MaterialColors;
import edu.rpi.legup.ui.proofeditorui.treeview.*;
import java.awt.*;
import java.awt.event.MouseEvent;
@@ -34,7 +33,7 @@ public class EditDataCommand extends PuzzleCommand {
* EditDataCommand Constructor create a puzzle command for editing a board
*
* @param elementView currently selected puzzle puzzleElement view that is being edited
- * @param selection currently selected tree puzzleElement views that are being edited
+ * @param selection currently selected tree puzzleElement views that is being edited
* @param event mouse event
*/
public EditDataCommand(ElementView elementView, TreeViewSelection selection, MouseEvent event) {
@@ -62,13 +61,16 @@ public void executeCommand() {
if (treeElement.getType() == TreeElementType.NODE) {
TreeNode treeNode = (TreeNode) treeElement;
+
if (treeNode.getChildren().isEmpty()) {
if (transition == null) {
transition = tree.addNewTransition(treeNode);
}
puzzle.notifyTreeListeners(listener -> listener.onTreeElementAdded(transition));
}
+
board = transition.getBoard();
+
puzzleElement = board.getPuzzleElement(selectedPuzzleElement);
savePuzzleElement = puzzleElement.copy();
} else {
@@ -78,6 +80,7 @@ public void executeCommand() {
}
Board prevBoard = transition.getParents().get(0).getBoard();
+
boardView.getElementController().changeCell(event, puzzleElement);
if (prevBoard.getPuzzleElement(selectedPuzzleElement).equalsData(puzzleElement)) {
@@ -106,33 +109,28 @@ public void executeCommand() {
public String getErrorString() {
List selectedViews = selection.getSelectedViews();
if (selectedViews.size() != 1) {
- flashTreeViewRed();
return CommandError.ONE_SELECTED_VIEW.toString();
}
TreeElementView selectedView = selection.getFirstSelection();
Board board = selectedView.getTreeElement().getBoard();
PuzzleElement selectedPuzzleElement = elementView.getPuzzleElement();
if (selectedView.getType() == TreeElementType.NODE) {
+
TreeNodeView nodeView = (TreeNodeView) selectedView;
if (!nodeView.getChildrenViews().isEmpty()) {
- flashTreeViewRed();
return CommandError.UNMODIFIABLE_BOARD.toString();
- } else if (!board.getPuzzleElement(selectedPuzzleElement).isModifiable()) {
- flashTreeViewRed();
- return CommandError.UNMODIFIABLE_DATA.toString();
+ } else {
+ if (!board.getPuzzleElement(selectedPuzzleElement).isModifiable()) {
+ return CommandError.UNMODIFIABLE_DATA.toString();
+ }
}
} else {
TreeTransitionView transitionView = (TreeTransitionView) selectedView;
if (!transitionView.getTreeElement().getBoard().isModifiable()) {
- flashTreeViewRed();
return CommandError.UNMODIFIABLE_BOARD.toString();
} else {
if (!board.getPuzzleElement(selectedPuzzleElement).isModifiable()) {
- flashTreeViewRed();
return CommandError.UNMODIFIABLE_DATA.toString();
- } else if (!board.getPuzzleElement(selectedPuzzleElement).isModifiableCaseRule()) {
- flashTreeViewRed();
- return CommandError.UNMODIFIABLE_DATA_CASE_RULE.toString();
}
}
}
diff --git a/src/main/java/edu/rpi/legup/history/History.java b/src/main/java/edu/rpi/legup/history/History.java
index 9eaeb3e75..091d381ac 100644
--- a/src/main/java/edu/rpi/legup/history/History.java
+++ b/src/main/java/edu/rpi/legup/history/History.java
@@ -48,10 +48,7 @@ public void pushChange(ICommand command) {
}
}
- /**
- * Undoes the last action by calling the undo method of the command at the current index.
- * Updates the current index and notifies listeners.
- */
+ /** Undoes an action */
public void undo() {
synchronized (lock) {
if (curIndex > -1) {
@@ -66,10 +63,7 @@ public void undo() {
}
}
- /**
- * Redoes the next action by calling the redo method of the command at the current index.
- * Updates the current index and notifies listeners.
- */
+ /** Redoes an action */
public void redo() {
synchronized (lock) {
if (curIndex < history.size() - 1) {
diff --git a/src/main/java/edu/rpi/legup/history/IHistoryListener.java b/src/main/java/edu/rpi/legup/history/IHistoryListener.java
index a752cd53a..344d8ede7 100644
--- a/src/main/java/edu/rpi/legup/history/IHistoryListener.java
+++ b/src/main/java/edu/rpi/legup/history/IHistoryListener.java
@@ -6,16 +6,15 @@
* as pushing, undoing, redoing commands, and clearing the history.
*/
public interface IHistoryListener {
-
/**
- * Called when a command is pushed onto the history stack.
+ * Called when a action is pushed onto the edu.rpi.legup.history stack
*
- * @param command the command that was pushed onto the stack
+ * @param command action to push onto the stack
*/
void onPushChange(ICommand command);
/**
- * Called when a command is undone.
+ * Called when an action is undone
*
* @param isBottom true if there are no more actions to undo, false otherwise
* @param isTop true if there are no more changes to redo, false otherwise
@@ -23,7 +22,7 @@ public interface IHistoryListener {
void onUndo(boolean isBottom, boolean isTop);
/**
- * Called when a command is redone.
+ * Called when an action is redone
*
* @param isBottom true if there are no more actions to undo, false otherwise
* @param isTop true if there are no more changes to redo, false otherwise
diff --git a/src/main/java/edu/rpi/legup/history/IHistorySubject.java b/src/main/java/edu/rpi/legup/history/IHistorySubject.java
index b526c7cf3..5c10e9b25 100644
--- a/src/main/java/edu/rpi/legup/history/IHistorySubject.java
+++ b/src/main/java/edu/rpi/legup/history/IHistorySubject.java
@@ -8,11 +8,10 @@
* listeners.
*/
public interface IHistorySubject {
-
/**
- * Adds a history listener to receive updates about changes in the command history.
+ * Adds a history listener
*
- * @param listener the listener to add
+ * @param listener listener to add
*/
void addHistoryListener(IHistoryListener listener);
@@ -20,12 +19,12 @@ public interface IHistorySubject {
* Removes a history listener, so it no longer receives updates about changes in the command
* history.
*
- * @param listener the listener to remove
+ * @param listener listener to remove
*/
void removeHistoryListener(IHistoryListener listener);
/**
- * Notifies all registered listeners about a change in the command history.
+ * Notifies listeners
*
* @param algorithm a Consumer function that takes an IHistoryListener and performs some action
* with it
diff --git a/src/main/java/edu/rpi/legup/history/InvalidCommandStateTransition.java b/src/main/java/edu/rpi/legup/history/InvalidCommandStateTransition.java
index 0e1ba1b0d..692c572d7 100644
--- a/src/main/java/edu/rpi/legup/history/InvalidCommandStateTransition.java
+++ b/src/main/java/edu/rpi/legup/history/InvalidCommandStateTransition.java
@@ -6,13 +6,6 @@
*/
public class InvalidCommandStateTransition extends RuntimeException {
- /**
- * Constructs a new InvalidCommandStateTransition exception with a detailed message
- *
- * @param puzzleCommand the PuzzleCommand involved in the invalid transition
- * @param from the state from which the transition was attempted
- * @param to the state to which the transition was attempted
- */
public InvalidCommandStateTransition(
PuzzleCommand puzzleCommand, CommandState from, CommandState to) {
super(
diff --git a/src/main/java/edu/rpi/legup/history/ValidateDirectRuleCommand.java b/src/main/java/edu/rpi/legup/history/ValidateDirectRuleCommand.java
index 49bf378ee..b0daee986 100644
--- a/src/main/java/edu/rpi/legup/history/ValidateDirectRuleCommand.java
+++ b/src/main/java/edu/rpi/legup/history/ValidateDirectRuleCommand.java
@@ -18,7 +18,6 @@
* ICommand interface.
*/
public class ValidateDirectRuleCommand extends PuzzleCommand {
- private static final Logger LOGGER = LogManager.getLogger(History.class.getName());
private TreeViewSelection selection;
private Map oldRules;
@@ -50,15 +49,14 @@ public void executeCommand() {
for (TreeElementView selectedView : selectedViews) {
TreeElement element = selectedView.getTreeElement();
TreeTransitionView transitionView;
-
if (element.getType() == TreeElementType.NODE) {
TreeNodeView nodeView = (TreeNodeView) selectedView;
transitionView = nodeView.getChildrenViews().get(0);
} else {
transitionView = (TreeTransitionView) selectedView;
}
-
TreeTransition transition = transitionView.getTreeElement();
+
oldRules.put(transition, transition.getRule());
transition.setRule(newRule);
@@ -75,41 +73,17 @@ public void executeCommand() {
final TreeNode finalNode = childNode;
puzzle.notifyTreeListeners(listener -> listener.onTreeElementAdded(finalNode));
}
-
- TreeElementView childView = treeView.getElementView(childNode);
- if (childView == null) {
- LOGGER.error("Child view is null for child node: " + childNode);
- continue;
- }
- newSelection.addToSelection(childView);
+ newSelection.addToSelection(treeView.getElementView(childNode));
}
-
TreeElementView firstSelectedView = selection.getFirstSelection();
-
final TreeElement finalTreeElement;
if (firstSelectedView.getType() == TreeElementType.NODE) {
TreeNodeView nodeView = (TreeNodeView) firstSelectedView;
- if (nodeView.getChildrenViews().isEmpty()) {
- LOGGER.error("NodeView has no children views");
- return;
- }
finalTreeElement = nodeView.getChildrenViews().get(0).getTreeElement();
} else {
TreeTransitionView transitionView = (TreeTransitionView) firstSelectedView;
- TreeNodeView childView = transitionView.getChildView();
- if (childView == null) {
- LOGGER.error("Child view is null for transition view: " + transitionView);
- TreeNode childNode = transitionView.getTreeElement().getChildNode();
- childView = (TreeNodeView) treeView.getElementView(childNode);
- transitionView.setChildView(childView);
- }
- TreeTransition transition = transitionView.getTreeElement();
- if (transition.getParents().get(0).getChildren().isEmpty()) {
- transition.getParents().get(0).addChild(transition);
- }
finalTreeElement = transitionView.getChildView().getTreeElement();
}
-
puzzle.notifyBoardListeners(listener -> listener.onTreeElementChanged(finalTreeElement));
puzzle.notifyTreeListeners(listener -> listener.onTreeSelectionChanged(newSelection));
}
@@ -159,7 +133,6 @@ public void undoCommand() {
transitionView = (TreeTransitionView) selectedView;
}
TreeTransition transition = transitionView.getTreeElement();
-
transition.setRule(oldRules.get(transition));
if (addNode.get(transition) != null) {
diff --git a/src/main/java/edu/rpi/legup/model/Puzzle.java b/src/main/java/edu/rpi/legup/model/Puzzle.java
index da8f76ddd..1e3d0b3fe 100644
--- a/src/main/java/edu/rpi/legup/model/Puzzle.java
+++ b/src/main/java/edu/rpi/legup/model/Puzzle.java
@@ -58,6 +58,7 @@ public abstract class Puzzle implements IBoardSubject, ITreeSubject {
protected List contradictionRules;
protected List caseRules;
protected List placeableElements;
+ protected List nonPlaceableElements;
/** Puzzle Constructor - creates a new Puzzle */
public Puzzle() {
@@ -69,6 +70,7 @@ public Puzzle() {
this.caseRules = new ArrayList<>();
this.placeableElements = new ArrayList<>();
+ this.nonPlaceableElements = new ArrayList<>();
registerRules();
registerPuzzleElements();
@@ -107,6 +109,9 @@ private void registerPuzzleElements() {
case PLACEABLE:
this.addPlaceableElement((PlaceableElement) element);
break;
+ case NONPLACEABLE:
+ this.addNonPlaceableElement((NonPlaceableElement) element);
+ break;
default:
break;
}
@@ -117,6 +122,14 @@ private void registerPuzzleElements() {
}
}
}
+
+ // } catch (IOException | ClassNotFoundException | NoSuchMethodException |
+ // InstantiationException | IllegalAccessException |
+ // InvocationTargetException
+ // e) {
+ // LOGGER.error("Unable to find rules for " +
+ // this.getClass().getSimpleName(), e);
+ // }
} catch (Exception e) {
LOGGER.error("Unable to find elements for " + this.getClass().getSimpleName(), e);
}
@@ -172,6 +185,14 @@ private void registerRules() {
}
}
}
+
+ // } catch (IOException | ClassNotFoundException | NoSuchMethodException |
+ // InstantiationException | IllegalAccessException |
+ // InvocationTargetException
+ // e) {
+ // LOGGER.error("Unable to find rules for " +
+ // this.getClass().getSimpleName(), e);
+ // }
} catch (Exception e) {
LOGGER.error("Unable to find rules for " + this.getClass().getSimpleName(), e);
}
@@ -200,10 +221,10 @@ public boolean isValidDimensions(int rows, int columns) {
}
/**
- * Checks if the provided text input is valid for the puzzle.
+ * Checks if the given array of statements is valid text input for the given puzzle
*
- * @param statements array of statements to check
- * @return true if input is valid, false otherwise
+ * @param statements
+ * @return
*/
public boolean isValidTextInput(String[] statements) {
return statements.length > 0;
@@ -335,15 +356,14 @@ public List getDirectRules() {
return directRules;
}
- /**
- * Gets the list of placeable elements.
- *
- * @return list of PlaceableElement instances
- */
public List getPlaceableElements() {
return placeableElements;
}
+ public List getNonPlaceableElements() {
+ return nonPlaceableElements;
+ }
+
/**
* Sets the list of direct rules
*
@@ -362,15 +382,14 @@ public void addDirectRule(DirectRule rule) {
directRules.add(rule);
}
- /**
- * Adds a placeable element to this puzzle.
- *
- * @param element PlaceableElement to add
- */
public void addPlaceableElement(PlaceableElement element) {
placeableElements.add(element);
}
+ public void addNonPlaceableElement(NonPlaceableElement element) {
+ nonPlaceableElements.add(element);
+ }
+
/**
* Remove a basic rule from this Puzzle
*
@@ -586,7 +605,7 @@ public void setFactory(ElementFactory factory) {
* Adds a board listener to the list of listeners. This allows the puzzle to notify the listener
* about changes to the board.
*
- * @param listener The IBoardListener to be added to the list of listeners.
+ * @param listener listener to add
*/
@Override
public void addBoardListener(IBoardListener listener) {
@@ -597,7 +616,7 @@ public void addBoardListener(IBoardListener listener) {
* Removes a board listener from the list of listeners. This prevents the puzzle from notifying
* the listener about future changes to the board.
*
- * @param listener The IBoardListener to be removed from the list of listeners.
+ * @param listener listener to remove
*/
@Override
public void removeBoardListener(IBoardListener listener) {
@@ -620,7 +639,7 @@ public void notifyBoardListeners(Consumer super IBoardListener> algorithm) {
* Adds a tree listener to the list of listeners. This allows the puzzle to notify the listener
* about changes to the tree.
*
- * @param listener The ITreeListener to be added to the list of listeners.
+ * @param listener listener to add
*/
@Override
public void addTreeListener(ITreeListener listener) {
@@ -631,7 +650,7 @@ public void addTreeListener(ITreeListener listener) {
* Removes a tree listener from the list of listeners. This prevents the puzzle from notifying
* the listener about future changes to the tree.
*
- * @param listener The ITreeListener to be removed from the list of listeners.
+ * @param listener listener to remove
*/
@Override
public void removeTreeListener(ITreeListener listener) {
@@ -654,7 +673,7 @@ public void notifyTreeListeners(Consumer super ITreeListener> algorithm) {
* Checks if the puzzle is valid. The implementation of this method can vary based on the
* specific criteria for puzzle validity.
*
- * @return true if the puzzle is valid, false otherwise.
+ * @return if the puzzle is valid
*/
public boolean checkValidity() {
return true;
diff --git a/src/main/java/edu/rpi/legup/model/PuzzleImporter.java b/src/main/java/edu/rpi/legup/model/PuzzleImporter.java
index 9d16d94e9..848e3169a 100644
--- a/src/main/java/edu/rpi/legup/model/PuzzleImporter.java
+++ b/src/main/java/edu/rpi/legup/model/PuzzleImporter.java
@@ -69,10 +69,10 @@ public void initializePuzzle(String[] statements)
}
/**
- * Initializes the puzzle attributes from the XML document node
+ * Initializes the puzzle attributes
*
- * @param node the XML document node representing the puzzle
- * @throws InvalidFileFormatException if the file format is invalid
+ * @param node xml document node
+ * @throws InvalidFileFormatException if file is invalid
*/
public void initializePuzzle(Node node) throws InvalidFileFormatException {
if (node.getNodeName().equalsIgnoreCase("puzzle")) {
@@ -125,19 +125,19 @@ public void initializePuzzle(Node node) throws InvalidFileFormatException {
}
/**
- * Initializes the board with the specified number of rows and columns.
+ * Creates the board for building
*
- * @param rows the number of rows on the puzzle
- * @param columns the number of columns on the puzzle
- * @throws RuntimeException if the board cannot be created with the provided dimensions
+ * @param rows number of rows on the puzzle
+ * @param columns number of columns on the puzzle
+ * @throws RuntimeException if board can not be created
*/
public abstract void initializeBoard(int rows, int columns);
/**
- * Initializes the board from the XML document node.
+ * Creates an empty board for building
*
- * @param node the XML document node representing the board
- * @throws InvalidFileFormatException if the file format is invalid
+ * @param node xml document node
+ * @throws InvalidFileFormatException if file is invalid
*/
public abstract void initializeBoard(Node node) throws InvalidFileFormatException;
@@ -454,7 +454,7 @@ protected void createDefaultTree() {
}
/**
- * Gets the result of building the Puzzle object.
+ * Gets the result of building the Puzzle
*
* @return puzzle
*/
diff --git a/src/main/java/edu/rpi/legup/model/elements/Element.java b/src/main/java/edu/rpi/legup/model/elements/Element.java
index ed47f6523..6f100c27d 100644
--- a/src/main/java/edu/rpi/legup/model/elements/Element.java
+++ b/src/main/java/edu/rpi/legup/model/elements/Element.java
@@ -21,14 +21,6 @@ public abstract class Element {
private final String INVALID_USE_MESSAGE;
- /**
- * Constructs an Element with the specified ID, name, description, and image name
- *
- * @param elementID Unique identifier for the element
- * @param elementName Name of the element
- * @param description Description of the element
- * @param imageName File name of the image associated with the element
- */
public Element(String elementID, String elementName, String description, String imageName) {
this.elementID = elementID;
this.elementName = elementName;
@@ -63,65 +55,30 @@ private void loadImage() {
}
}
- /**
- * Gets the name of the element
- *
- * @return The name of the element
- */
public String getElementName() {
return elementName;
}
- /**
- * Sets the name of the element
- *
- * @param elementName The new name for the element
- */
public void setElementName(String elementName) {
this.elementName = elementName;
}
- /**
- * Gets the unique identifier of the element
- *
- * @return The ID of the element
- */
public String getElementID() {
return elementID;
}
- /**
- * Gets the description of the element
- *
- * @return The description of the element
- */
public String getDescription() {
return description;
}
- /**
- * Gets the image icon associated with the element
- *
- * @return The ImageIcon for the element
- */
public ImageIcon getImageIcon() {
return image;
}
- /**
- * Gets the type of the element
- *
- * @return The ElementType of the element
- */
public ElementType getElementType() {
return elementType;
}
- /**
- * Gets the message for invalid use of the rule
- *
- * @return The invalid use message
- */
public String getInvalidUseOfRuleMessage() {
return this.INVALID_USE_MESSAGE;
}
diff --git a/src/main/java/edu/rpi/legup/model/gameboard/Board.java b/src/main/java/edu/rpi/legup/model/gameboard/Board.java
index 9e7d93441..f1fd27ad2 100644
--- a/src/main/java/edu/rpi/legup/model/gameboard/Board.java
+++ b/src/main/java/edu/rpi/legup/model/gameboard/Board.java
@@ -35,24 +35,21 @@ public Board(int size) {
}
/**
- * Gets a specific {@link PuzzleElement} from the board.
+ * Gets a specific {@link PuzzleElement} on this board.
*
- * @param puzzleElement the puzzle element to retrieve
- * @return the puzzle element at the corresponding index, or null if not found
+ * @param puzzleElement equivalent puzzleElement
+ * @return equivalent puzzleElement on this board
*/
public PuzzleElement getPuzzleElement(PuzzleElement puzzleElement) {
- if (puzzleElement == null) {
- return null;
- }
int index = puzzleElement.getIndex();
return index < puzzleElements.size() ? puzzleElements.get(index) : null;
}
/**
- * Sets a specific {@link PuzzleElement} on the board
+ * Sets a specific {@link PuzzleElement} on the board.
*
* @param index index of the puzzleElement
- * @param puzzleElement the puzzleElement to set at the index
+ * @param puzzleElement new puzzleElement at the index
*/
public void setPuzzleElement(int index, PuzzleElement puzzleElement) {
if (index < puzzleElements.size()) {
@@ -61,7 +58,7 @@ public void setPuzzleElement(int index, PuzzleElement puzzleElement) {
}
/**
- * Gets the number of elements on the board
+ * Gets the number of elements on the board.
*
* @return number of elements on the board
*/
diff --git a/src/main/java/edu/rpi/legup/model/gameboard/CaseBoard.java b/src/main/java/edu/rpi/legup/model/gameboard/CaseBoard.java
index 07cc2947d..55484a2fc 100644
--- a/src/main/java/edu/rpi/legup/model/gameboard/CaseBoard.java
+++ b/src/main/java/edu/rpi/legup/model/gameboard/CaseBoard.java
@@ -14,88 +14,40 @@ public class CaseBoard extends Board {
protected CaseRule caseRule;
protected Set pickablePuzzleElements;
- /**
- * Constructs a CaseBoard with a base board and a case rule.
- *
- * @param baseBoard the base board to use for this CaseBoard
- * @param caseRule the case rule applied to this CaseBoard
- */
public CaseBoard(Board baseBoard, CaseRule caseRule) {
this.baseBoard = baseBoard;
this.caseRule = caseRule;
this.pickablePuzzleElements = new HashSet<>();
}
- /**
- * Adds a puzzle element to the set of pickable elements.
- *
- * @param puzzleElement the puzzle element to add
- */
public void addPickableElement(PuzzleElement puzzleElement) {
pickablePuzzleElements.add(puzzleElement);
}
- /**
- * Removes a puzzle element from the set of pickable elements.
- *
- * @param puzzleElement the puzzle element to remove
- */
public void removePickableElement(PuzzleElement puzzleElement) {
pickablePuzzleElements.remove(puzzleElement);
}
- /**
- * Checks if a puzzle element is pickable based on the mouse event.
- *
- * @param puzzleElement the puzzle element to check
- * @param e the mouse event
- * @return true if the puzzle element is pickable, false otherwise
- */
public boolean isPickable(PuzzleElement puzzleElement, MouseEvent e) {
return pickablePuzzleElements.contains(baseBoard.getPuzzleElement(puzzleElement));
}
- /**
- * Retrieves the base board for this CaseBoard.
- *
- * @return the base board
- */
public Board getBaseBoard() {
return baseBoard;
}
- /**
- * Sets the base board for this CaseBoard.
- *
- * @param baseBoard the new base board
- */
public void setBaseBoard(Board baseBoard) {
this.baseBoard = baseBoard;
}
- /**
- * Retrieves the case rule for this CaseBoard.
- *
- * @return the case rule
- */
public CaseRule getCaseRule() {
return caseRule;
}
- /**
- * Sets the case rule for this CaseBoard.
- *
- * @param caseRule the new case rule
- */
public void setCaseRule(CaseRule caseRule) {
this.caseRule = caseRule;
}
- /**
- * Gets the count of pickable puzzle elements.
- *
- * @return the number of pickable elements
- */
public int getCount() {
return pickablePuzzleElements.size();
}
diff --git a/src/main/java/edu/rpi/legup/model/gameboard/ElementFactory.java b/src/main/java/edu/rpi/legup/model/gameboard/ElementFactory.java
index 131feb122..bfc785bdd 100644
--- a/src/main/java/edu/rpi/legup/model/gameboard/ElementFactory.java
+++ b/src/main/java/edu/rpi/legup/model/gameboard/ElementFactory.java
@@ -5,9 +5,6 @@
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-/**
- * ElementFactory is an abstract class for importing and exporting {@link PuzzleElement} instances.
- */
public abstract class ElementFactory {
/**
diff --git a/src/main/java/edu/rpi/legup/model/gameboard/GridBoard.java b/src/main/java/edu/rpi/legup/model/gameboard/GridBoard.java
index 7338132f8..9593690ce 100644
--- a/src/main/java/edu/rpi/legup/model/gameboard/GridBoard.java
+++ b/src/main/java/edu/rpi/legup/model/gameboard/GridBoard.java
@@ -6,11 +6,6 @@
import java.awt.*;
import java.awt.event.MouseEvent;
-/**
- * GridBoard represents a grid-based board where each cell can be manipulated based on its
- * coordinates. The board supports operations such as getting and setting cells, and provides
- * dimensions of the grid. It also supports deep copying of the board.
- */
public class GridBoard extends Board {
protected Dimension dimension;
diff --git a/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java b/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java
index 79027d9d1..a4e2343b2 100644
--- a/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java
+++ b/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java
@@ -30,7 +30,7 @@ public void addCell(T cell) {
/**
* Removes the cell from the region
*
- * @param cell cell to be removed from the region
+ * @param cell cell to be remove from the region
*/
public void removeCell(T cell) {
regionCells.remove(cell);
@@ -53,4 +53,9 @@ public List getCells() {
public int getSize() {
return regionCells.size();
}
+
+ /*
+ public void colorRegion(){}
+ */
+
}
diff --git a/src/main/java/edu/rpi/legup/model/gameboard/PuzzleElement.java b/src/main/java/edu/rpi/legup/model/gameboard/PuzzleElement.java
index eca6f3be4..7664c7aa0 100644
--- a/src/main/java/edu/rpi/legup/model/gameboard/PuzzleElement.java
+++ b/src/main/java/edu/rpi/legup/model/gameboard/PuzzleElement.java
@@ -15,7 +15,6 @@ public abstract class PuzzleElement {
protected T data;
protected boolean isModifiable;
protected boolean isModified;
- protected boolean isModifiableCaseRule;
protected boolean isGiven;
protected boolean isValid;
protected int casesDepended;
@@ -25,7 +24,6 @@ public PuzzleElement() {
this.index = -1;
this.data = null;
this.isModifiable = true;
- this.isModifiableCaseRule = true;
this.isModified = false;
this.isGiven = false;
this.isValid = true;
@@ -82,24 +80,6 @@ public void setModifiable(boolean isModifiable) {
this.isModifiable = isModifiable;
}
- /**
- * Gets whether this puzzle element is modifiable as a result of a case rule.
- *
- * @return true if this puzzle element is modifiable, false otherwise
- */
- public boolean isModifiableCaseRule() {
- return isModifiableCaseRule;
- }
-
- /**
- * Sets whether this puzzle element is modifiable as a result of a case rule.
- *
- * @param isModifiableCaseRule true if this puzzle element is modifiable, false otherwise
- */
- public void setModifiableCaseRule(boolean isModifiableCaseRule) {
- this.isModifiableCaseRule = isModifiableCaseRule;
- }
-
/**
* Gets whether the puzzle element has been modified.
*
diff --git a/src/main/java/edu/rpi/legup/model/observer/IBoardListener.java b/src/main/java/edu/rpi/legup/model/observer/IBoardListener.java
index 7ba886fd4..7f5122a3d 100644
--- a/src/main/java/edu/rpi/legup/model/observer/IBoardListener.java
+++ b/src/main/java/edu/rpi/legup/model/observer/IBoardListener.java
@@ -17,7 +17,7 @@ public interface IBoardListener {
void onTreeElementChanged(TreeElement treeElement);
/**
- * Called when a case board has been added to the view.
+ * Called when the a case board has been added to the view.
*
* @param caseBoard case board to be added
*/
diff --git a/src/main/java/edu/rpi/legup/model/observer/IBoardSubject.java b/src/main/java/edu/rpi/legup/model/observer/IBoardSubject.java
index 6cdcd7dc2..2f9a3ff9b 100644
--- a/src/main/java/edu/rpi/legup/model/observer/IBoardSubject.java
+++ b/src/main/java/edu/rpi/legup/model/observer/IBoardSubject.java
@@ -22,7 +22,7 @@ public interface IBoardSubject {
void removeBoardListener(IBoardListener listener);
/**
- * Notifies all the listeners using the specified algorithm.
+ * Notifies all of the listeners using the specified algorithm.
*
* @param algorithm algorithm used to notify the listeners
*/
diff --git a/src/main/java/edu/rpi/legup/model/observer/ITreeSubject.java b/src/main/java/edu/rpi/legup/model/observer/ITreeSubject.java
index f7c033529..6bb44296f 100644
--- a/src/main/java/edu/rpi/legup/model/observer/ITreeSubject.java
+++ b/src/main/java/edu/rpi/legup/model/observer/ITreeSubject.java
@@ -8,7 +8,7 @@
*/
public interface ITreeSubject {
/**
- * Adds a tree listener.
+ * Adds a board listener.
*
* @param listener listener to add
*/
@@ -22,7 +22,7 @@ public interface ITreeSubject {
void removeTreeListener(ITreeListener listener);
/**
- * Notifies all the tree listeners using the specified algorithm.
+ * Notifies all of the listeners using the specified algorithm.
*
* @param algorithm algorithm used to notify the listeners
*/
diff --git a/src/main/java/edu/rpi/legup/model/rules/MergeRule.java b/src/main/java/edu/rpi/legup/model/rules/MergeRule.java
index 86c63fb7c..e7e3fd277 100644
--- a/src/main/java/edu/rpi/legup/model/rules/MergeRule.java
+++ b/src/main/java/edu/rpi/legup/model/rules/MergeRule.java
@@ -27,7 +27,7 @@ public MergeRule() {
/**
* Checks whether the transition logically follows from the parent node using this rule. This
- * method is the one that should have overridden in child classes
+ * method is the one that should overridden in child classes
*
* @param transition transition to check
* @return null if the child node logically follow from the parent node, otherwise error message
diff --git a/src/main/java/edu/rpi/legup/model/rules/Rule.java b/src/main/java/edu/rpi/legup/model/rules/Rule.java
index edcab550b..6f5b1fd5c 100644
--- a/src/main/java/edu/rpi/legup/model/rules/Rule.java
+++ b/src/main/java/edu/rpi/legup/model/rules/Rule.java
@@ -164,11 +164,6 @@ public RuleType getRuleType() {
return ruleType;
}
- /**
- * Gets the message indicating an invalid use of the rule.
- *
- * @return the invalid use message
- */
public String getInvalidUseOfRuleMessage() {
return this.INVALID_USE_MESSAGE;
}
diff --git a/src/main/java/edu/rpi/legup/model/tree/Tree.java b/src/main/java/edu/rpi/legup/model/tree/Tree.java
index 545976fd1..2f74ca3af 100644
--- a/src/main/java/edu/rpi/legup/model/tree/Tree.java
+++ b/src/main/java/edu/rpi/legup/model/tree/Tree.java
@@ -1,6 +1,5 @@
package edu.rpi.legup.model.tree;
-import edu.rpi.legup.controller.TreeController;
import edu.rpi.legup.model.gameboard.Board;
import edu.rpi.legup.ui.proofeditorui.treeview.TreeView;
import java.util.ArrayList;
@@ -30,12 +29,6 @@ public Tree() {
this.rootNode = null;
}
- /**
- * Adds a new transition to the specified node.
- *
- * @param treeNode the node to add a transition to
- * @return the created transition
- */
public TreeTransition addNewTransition(TreeNode treeNode) {
TreeTransition transition = new TreeTransition(treeNode, treeNode.getBoard().copy());
treeNode.addChild(transition);
@@ -43,12 +36,13 @@ public TreeTransition addNewTransition(TreeNode treeNode) {
return transition;
}
- /**
- * Adds a tree element (node or transition) to the tree.
- *
- * @param element the tree element to add
- * @return the added tree element
- */
+ public TreeNode addNode(TreeTransition transition) {
+ TreeNode treeNode = new TreeNode(transition.getBoard().copy());
+ transition.setChildNode(treeNode);
+ treeNode.setParent(transition);
+ return treeNode;
+ }
+
public TreeElement addTreeElement(TreeElement element) {
if (element.getType() == TreeElementType.NODE) {
TreeNode treeNode = (TreeNode) element;
@@ -57,55 +51,30 @@ public TreeElement addTreeElement(TreeElement element) {
} else {
TreeTransition transition = (TreeTransition) element;
Board copyBoard = transition.board.copy();
- copyBoard.setModifiable(true);
+ copyBoard.setModifiable(false);
return addTreeElement(transition, new TreeNode(copyBoard));
}
}
- /**
- * Adds a tree node and its associated transition to the tree.
- *
- * @param treeNode the tree node to add
- * @param transition the transition to associate with the node
- * @return the added transition
- */
public TreeElement addTreeElement(TreeNode treeNode, TreeTransition transition) {
treeNode.addChild(transition);
treeNode.getChildren().forEach(TreeTransition::reverify);
return transition;
}
- /**
- * Adds a transition and its associated tree node to the tree.
- *
- * @param transition the transition to add
- * @param treeNode the tree node to associate with the transition
- * @return the added tree node
- */
public TreeElement addTreeElement(TreeTransition transition, TreeNode treeNode) {
transition.setChildNode(treeNode);
treeNode.setParent(transition);
return treeNode;
}
- /**
- * Removes a tree element (node or transition) from the tree.
- *
- * @param element the tree element to remove
- */
public void removeTreeElement(TreeElement element) {
if (element.getType() == TreeElementType.NODE) {
TreeNode node = (TreeNode) element;
-
- node.getParent().removeChild(node);
node.getParent().setChildNode(null);
} else {
TreeTransition transition = (TreeTransition) element;
-
transition.getParents().forEach(n -> n.removeChild(transition));
- TreeController treeController = new TreeController();
- TreeView treeView = new TreeView(treeController);
- treeView.removeTreeTransition(transition);
transition.getParents().get(0).getChildren().forEach(TreeTransition::reverify);
}
}
@@ -132,10 +101,10 @@ public Set getLeafTreeElements() {
}
/**
- * Gets a Set of TreeNodes that are leaf nodes from the subtree rooted at the specified node
+ * Gets a Set of TreeNodes that are leaf nodes from the sub tree rooted at the specified node
*
* @param node node that is input
- * @return Set of TreeNodes that are leaf nodes from the subtree
+ * @return Set of TreeNodes that are leaf nodes from the sub tree
*/
public Set getLeafTreeElements(TreeNode node) {
Set leafs = new HashSet<>();
diff --git a/src/main/java/edu/rpi/legup/model/tree/TreeElement.java b/src/main/java/edu/rpi/legup/model/tree/TreeElement.java
index 8c865b89b..e668a5c8f 100644
--- a/src/main/java/edu/rpi/legup/model/tree/TreeElement.java
+++ b/src/main/java/edu/rpi/legup/model/tree/TreeElement.java
@@ -28,7 +28,7 @@ public TreeElement(TreeElementType type) {
public abstract boolean isContradictoryBranch();
/**
- * Recursively determines if the subtree rooted at this tree puzzleElement is valid by checking
+ * Recursively determines if the sub-tree rooted at this tree puzzleElement is valid by checking
* whether this tree puzzleElement and all descendants of this tree puzzleElement is justified
* and justified correctly
*
diff --git a/src/main/java/edu/rpi/legup/model/tree/TreeNode.java b/src/main/java/edu/rpi/legup/model/tree/TreeNode.java
index d4095afa5..2fe5ffcd2 100644
--- a/src/main/java/edu/rpi/legup/model/tree/TreeNode.java
+++ b/src/main/java/edu/rpi/legup/model/tree/TreeNode.java
@@ -61,9 +61,9 @@ public boolean isValidBranch() {
}
/**
- * Gets a list of the ancestors of this node
+ * Gets all of the ancestors of this node
*
- * @return list of all the ancestors for this node
+ * @return list of all of the ancestors for this node
*/
public List getAncestors() {
List ancestors = new ArrayList<>();
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/Binary.java b/src/main/java/edu/rpi/legup/puzzle/binary/Binary.java
index 7b70a43a1..d304dbb24 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/Binary.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/Binary.java
@@ -36,12 +36,18 @@ public Board generatePuzzle(int difficulty) {
return null;
}
- /**
- * Determines if the current board is a valid state
- *
- * @param board board to check for validity
- * @return true if board is valid, false otherwise
- */
+ // /**
+ // * Determines if the given dimensions are valid for Binary
+ // *
+ // * @param rows the number of rows
+ // * @param columns the number of columns
+ // * @return true if the given dimensions are valid for Binary, false otherwise
+ // */
+ // @Override
+ // public boolean isValidDimensions(int rows, int columns){
+ // return rows >= 2 && rows % 2 == 0 && columns >= 2 && columns % 2 == 0;
+ // }
+
@Override
public boolean isBoardComplete(Board board) {
BinaryBoard binaryBoard = (BinaryBoard) board;
@@ -60,11 +66,6 @@ public boolean isBoardComplete(Board board) {
return true;
}
- /**
- * Callback for when the board puzzleElement changes
- *
- * @param board the board that has changed
- */
@Override
public void onBoardChange(Board board) {}
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryBoard.java b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryBoard.java
index d5d65ed26..9a3d0f083 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryBoard.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryBoard.java
@@ -19,13 +19,6 @@ public BinaryBoard(int size) {
this.size = size;
}
- /**
- * Gets the cell at the (x,y) position
- *
- * @param x x-coordinate
- * @param y y-coordinate
- * @return BinaryCell cell at (x,y)
- */
@Override
public BinaryCell getCell(int x, int y) {
if (y * dimension.width + x >= puzzleElements.size()
@@ -38,12 +31,6 @@ public BinaryCell getCell(int x, int y) {
return (BinaryCell) super.getCell(x, y);
}
- /**
- * Get all the binary cells in a row
- *
- * @param rowNum row number
- * @return set of all binary cells in specified rowNum
- */
public Set getRowCells(int rowNum) {
Set row = new HashSet<>();
for (int i = 0; i < size; i++) {
@@ -104,6 +91,7 @@ public ArrayList getColTypes(int colNum) {
*/
@Override
public BinaryBoard copy() {
+ System.out.println("BinaryBoard copy()");
BinaryBoard copy = new BinaryBoard(dimension.width, dimension.height);
for (int x = 0; x < this.dimension.width; x++) {
for (int y = 0; y < this.dimension.height; y++) {
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryCell.java b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryCell.java
index 0edb8444e..e7be09b8d 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryCell.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryCell.java
@@ -1,26 +1,14 @@
package edu.rpi.legup.puzzle.binary;
-import edu.rpi.legup.model.elements.Element;
import edu.rpi.legup.model.gameboard.GridCell;
import java.awt.Point;
import java.awt.event.MouseEvent;
public class BinaryCell extends GridCell {
- /**
- * BinaryCell Constructor - creates a BinaryCell from the specified value and location
- *
- * @param value value of the BinaryCell
- * @param location position of the BinaryCell
- */
- public BinaryCell(int value, Point location) {
- super(value, location);
+ public BinaryCell(int valueInt, Point location) {
+ super(valueInt, location);
}
- /**
- * Gets the type of this BinaryCell
- *
- * @return type of BinaryCell
- */
public BinaryType getType() {
switch (data) {
case 0:
@@ -37,11 +25,6 @@ public BinaryType getType() {
return null;
}
- /**
- * Performs a deep copy on the BinaryCell
- *
- * @return a new copy of the BinaryCell that is independent of this one
- */
@Override
public BinaryCell copy() {
BinaryCell copy = new BinaryCell(data, (Point) location.clone());
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryCellFactory.java b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryCellFactory.java
index a819177d6..890c26656 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryCellFactory.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryCellFactory.java
@@ -10,14 +10,7 @@
import org.w3c.dom.Node;
public class BinaryCellFactory extends ElementFactory {
- /**
- * Creates a puzzleElement based on the xml document Node and adds it to the board
- *
- * @param node node that represents the puzzleElement
- * @param board board to add the newly created cell
- * @return newly created cell from the xml document Node
- * @throws InvalidFileFormatException if file is invalid
- */
+
public BinaryCell importCell(Node node, Board board) throws InvalidFileFormatException {
try {
if (!node.getNodeName().equalsIgnoreCase("cell")) {
@@ -52,13 +45,6 @@ public BinaryCell importCell(Node node, Board board) throws InvalidFileFormatExc
}
}
- /**
- * Creates a xml document puzzleElement from a cell for exporting
- *
- * @param document xml document
- * @param puzzleElement PuzzleElement cell
- * @return xml PuzzleElement
- */
public org.w3c.dom.Element exportCell(Document document, PuzzleElement puzzleElement) {
org.w3c.dom.Element cellElement = document.createElement("cell");
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryController.java b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryController.java
index 5ec6669a0..f2a735c4d 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryController.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryController.java
@@ -39,13 +39,13 @@ public void changeCell(MouseEvent e, PuzzleElement data) {
}
} else {
if (e.getButton() == MouseEvent.BUTTON3) {
- if (cell.getData() == 2) {
+ if (cell.getData() == 0) {
data.setData(1);
} else {
if (cell.getData() == 1) {
- data.setData(0);
- } else {
data.setData(2);
+ } else {
+ data.setData(0);
}
}
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryElementView.java b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryElementView.java
index 74a761e89..b523a74a9 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryElementView.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryElementView.java
@@ -7,8 +7,6 @@ public class BinaryElementView extends GridElementView {
private static final Font FONT = new Font("TimesRoman", Font.BOLD, 17);
private static final Color FONT_COLOR = Color.BLACK;
- private static final Color GIVEN_COLOR = Color.LIGHT_GRAY;
- private static final Color ELEMENT_COLOR = Color.WHITE;
public BinaryElementView(BinaryCell cell) {
super(cell);
@@ -53,35 +51,95 @@ public void drawElement(Graphics2D graphics2D) {
private void drawCell(Graphics2D graphics2D, Color bgColor) {
BinaryCell cell = (BinaryCell) puzzleElement;
BinaryType type = cell.getType();
-
- if (type == BinaryType.ZERO || type == BinaryType.ONE) {
+ if (type == BinaryType.ZERO) {
graphics2D.setStroke(new BasicStroke(1));
- graphics2D.setColor(bgColor);
+ graphics2D.setColor(Color.LIGHT_GRAY);
graphics2D.fillRect(location.x, location.y, size.width, size.height);
graphics2D.setColor(Color.BLACK);
graphics2D.drawRect(location.x, location.y, size.width, size.height);
- drawCenteredText(graphics2D);
- } else if (type == BinaryType.UNKNOWN) {
- graphics2D.setStroke(new BasicStroke(0));
+ graphics2D.setColor(FONT_COLOR);
+ graphics2D.setFont(FONT);
+ FontMetrics metrics = graphics2D.getFontMetrics(FONT);
+ String value = String.valueOf(puzzleElement.getData());
+ int xText = location.x + (size.width - metrics.stringWidth(value)) / 2;
+ int yText =
+ location.y + ((size.height - metrics.getHeight()) / 2) + metrics.getAscent();
+ graphics2D.drawString(String.valueOf(puzzleElement.getData()), xText, yText);
+ } else {
+ if (type == BinaryType.ONE) {
+ graphics2D.setStroke(new BasicStroke(1));
+ graphics2D.setColor(Color.LIGHT_GRAY);
+ graphics2D.fillRect(location.x, location.y, size.width, size.height);
+ graphics2D.setColor(Color.BLACK);
+ graphics2D.drawRect(location.x, location.y, size.width, size.height);
+ graphics2D.setColor(FONT_COLOR);
+ graphics2D.setFont(FONT);
+ FontMetrics metrics = graphics2D.getFontMetrics(FONT);
+ String value = String.valueOf(puzzleElement.getData());
+ int xText = location.x + (size.width - metrics.stringWidth(value)) / 2;
+ int yText =
+ location.y
+ + ((size.height - metrics.getHeight()) / 2)
+ + metrics.getAscent();
+ graphics2D.drawString(String.valueOf(puzzleElement.getData()), xText, yText);
+
+ } else {
+ if (type == BinaryType.UNKNOWN) {
+ graphics2D.setStroke(new BasicStroke(0));
+ graphics2D.setColor(Color.WHITE);
+ graphics2D.fillRect(location.x, location.y, size.width, size.height);
+ graphics2D.setColor(Color.BLACK);
+ graphics2D.drawRect(location.x, location.y, size.width, size.height);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void drawElement(Graphics2D graphics2D) {
+ BinaryCell cell = (BinaryCell) puzzleElement;
+ BinaryType type = cell.getType();
+ if (type == BinaryType.ZERO) {
+ graphics2D.setStroke(new BasicStroke(1));
graphics2D.setColor(Color.WHITE);
graphics2D.fillRect(location.x, location.y, size.width, size.height);
graphics2D.setColor(Color.BLACK);
graphics2D.drawRect(location.x, location.y, size.width, size.height);
- }
- }
+ graphics2D.setColor(FONT_COLOR);
+ graphics2D.setFont(FONT);
+ FontMetrics metrics = graphics2D.getFontMetrics(FONT);
+ String value = String.valueOf(puzzleElement.getData());
+ int xText = location.x + (size.width - metrics.stringWidth(value)) / 2;
+ int yText =
+ location.y + ((size.height - metrics.getHeight()) / 2) + metrics.getAscent();
+ graphics2D.drawString(String.valueOf(puzzleElement.getData()), xText, yText);
+ } else {
+ if (type == BinaryType.ONE) {
+ graphics2D.setStroke(new BasicStroke(1));
+ graphics2D.setColor(Color.WHITE);
+ graphics2D.fillRect(location.x, location.y, size.width, size.height);
+ graphics2D.setColor(Color.BLACK);
+ graphics2D.drawRect(location.x, location.y, size.width, size.height);
+ graphics2D.setColor(FONT_COLOR);
+ graphics2D.setFont(FONT);
+ FontMetrics metrics = graphics2D.getFontMetrics(FONT);
+ String value = String.valueOf(puzzleElement.getData());
+ int xText = location.x + (size.width - metrics.stringWidth(value)) / 2;
+ int yText =
+ location.y
+ + ((size.height - metrics.getHeight()) / 2)
+ + metrics.getAscent();
+ graphics2D.drawString(String.valueOf(puzzleElement.getData()), xText, yText);
- /**
- * Helper method to draw the centered text within the cell
- *
- * @param graphics2D The graphics object to draw on
- */
- private void drawCenteredText(Graphics2D graphics2D) {
- graphics2D.setColor(FONT_COLOR);
- graphics2D.setFont(FONT);
- FontMetrics metrics = graphics2D.getFontMetrics(FONT);
- String value = String.valueOf(puzzleElement.getData());
- int xText = location.x + (size.width - metrics.stringWidth(value)) / 2;
- int yText = location.y + ((size.height - metrics.getHeight()) / 2) + metrics.getAscent();
- graphics2D.drawString(value, xText, yText);
+ } else {
+ if (type == BinaryType.UNKNOWN) {
+ graphics2D.setStroke(new BasicStroke(0));
+ graphics2D.setColor(Color.WHITE);
+ graphics2D.fillRect(location.x, location.y, size.width, size.height);
+ graphics2D.setColor(Color.BLACK);
+ graphics2D.drawRect(location.x, location.y, size.width, size.height);
+ }
+ }
+ }
}
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryExporter.java b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryExporter.java
index c032b63a9..43ea8caf4 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryExporter.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryExporter.java
@@ -33,7 +33,7 @@ protected org.w3c.dom.Element createBoardElement(Document newDocument) {
org.w3c.dom.Element cellsElement = newDocument.createElement("cells");
for (PuzzleElement puzzleElement : board.getPuzzleElements()) {
BinaryCell cell = (BinaryCell) puzzleElement;
- if (cell.getData() != BinaryType.UNKNOWN.toValue()) {
+ if (cell.getData() != -2) {
org.w3c.dom.Element cellElement =
puzzle.getFactory().exportCell(newDocument, puzzleElement);
cellsElement.appendChild(cellElement);
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryImporter.java b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryImporter.java
index 419789060..746d3b4b6 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/BinaryImporter.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/BinaryImporter.java
@@ -12,33 +12,16 @@ public BinaryImporter(Binary binary) {
super(binary);
}
- /**
- * Determines if puzzle uses row and column input
- *
- * @return true if row and column input is used, false otherwise
- */
@Override
public boolean acceptsRowsAndColumnsInput() {
return true;
}
- /**
- * Determines if puzzle uses text input
- *
- * @return true if text input is used, false otherwise
- */
@Override
public boolean acceptsTextInput() {
return false;
}
- /**
- * Creates an empty board for building
- *
- * @param rows the number of rows on the board
- * @param columns the number of columns on the board
- * @throws RuntimeException if board can not be created
- */
@Override
public void initializeBoard(int rows, int columns) {
BinaryBoard binaryBoard = new BinaryBoard(columns, rows);
@@ -65,12 +48,12 @@ public void initializeBoard(Node node) throws InvalidFileFormatException {
try {
if (!node.getNodeName().equalsIgnoreCase("board")) {
throw new InvalidFileFormatException(
- "Binary Importer: cannot find board puzzleElement");
+ "binary Importer: cannot find board puzzleElement");
}
Element boardElement = (Element) node;
if (boardElement.getElementsByTagName("cells").getLength() == 0) {
throw new InvalidFileFormatException(
- "Binary Importer: no puzzleElement found for board");
+ "binary Importer: no puzzleElement found for board");
}
Element dataElement = (Element) boardElement.getElementsByTagName("cells").item(0);
@@ -93,7 +76,7 @@ public void initializeBoard(Node node) throws InvalidFileFormatException {
int height = binaryBoard.getHeight();
if (binaryBoard == null || width % 2 != 0 || height % 2 != 0) {
- throw new InvalidFileFormatException("Binary Importer: invalid board dimensions");
+ throw new InvalidFileFormatException("binary Importer: invalid board dimensions");
}
for (int i = 0; i < elementDataList.getLength(); i++) {
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/elements/BlankTile.java b/src/main/java/edu/rpi/legup/puzzle/binary/elements/BlankTile.java
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/elements/BlankTile.java
@@ -0,0 +1 @@
+
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/elements/binary_elements_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/binary/elements/binary_elements_reference_sheet.txt
deleted file mode 100644
index 54db0ee0b..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/binary/elements/binary_elements_reference_sheet.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-BINA-ELEM-0001 : NumberTile
-BINA-ELEM-0002 : UnknownTile
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/rules/CompleteRowColumnDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/binary/rules/CompleteRowColumnDirectRule.java
index 6ced37a9c..09cca6dc5 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/rules/CompleteRowColumnDirectRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/rules/CompleteRowColumnDirectRule.java
@@ -32,27 +32,23 @@ public CompleteRowColumnDirectRule() {
@Override
public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) {
BinaryBoard origBoard = (BinaryBoard) transition.getParents().get(0).getBoard();
- ContradictionRule contraRule = new UnbalancedRowColumnContradictionRule();
+ ContradictionRule contraRule = new UnbalancedRowOrColumnContradictionRule();
BinaryCell binaryCell = (BinaryCell) puzzleElement;
BinaryBoard modified = origBoard.copy();
+ BinaryCell c = (BinaryCell) modified.getPuzzleElement(puzzleElement);
- // Flip the cell and check to see if there will be an unbalanced row/column contradiction,
- // if so the rule is applied correctly
- modified.getPuzzleElement(puzzleElement).setData(Math.abs(binaryCell.getData() - 1));
- if (contraRule.checkContradictionAt(modified, puzzleElement) == null) {
+ // System.out.println("ORIG" + binaryCell.getData());
+ // System.out.println("AFTER" + Math.abs(binaryCell.getData() - 1));
+ modified.getPuzzleElement(puzzleElement).setData(binaryCell.getData());
+ System.out.println(contraRule.checkContradictionAt(modified, puzzleElement));
+
+ if (contraRule.checkContradictionAt(modified, puzzleElement) != null) {
return null;
}
- return "Unbalanced row/column found";
+ return "Grouping of Three Ones or Zeros not found";
}
- /**
- * Creates a transition {@link Board} that has this rule applied to it using the {@link
- * TreeNode}.
- *
- * @param node tree node used to create default transition board
- * @return default board or null if this rule cannot be applied to this tree node
- */
@Override
public Board getDefaultBoard(TreeNode node) {
return null;
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/rules/RepeatedRowColumnContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/binary/rules/DuplicateRowsOrColumnsContradictionRule.java
similarity index 69%
rename from src/main/java/edu/rpi/legup/puzzle/binary/rules/RepeatedRowColumnContradictionRule.java
rename to src/main/java/edu/rpi/legup/puzzle/binary/rules/DuplicateRowsOrColumnsContradictionRule.java
index a7a4ced12..6e009f123 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/rules/RepeatedRowColumnContradictionRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/rules/DuplicateRowsOrColumnsContradictionRule.java
@@ -8,28 +8,19 @@
import edu.rpi.legup.puzzle.binary.BinaryType;
import java.util.ArrayList;
-public class RepeatedRowColumnContradictionRule extends ContradictionRule {
+public class DuplicateRowsOrColumnsContradictionRule extends ContradictionRule {
private final String NO_CONTRADICTION_MESSAGE =
"Does not contain a contradiction at this index";
private final String INVALID_USE_MESSAGE = "Row or column must have a value in each cell";
- public RepeatedRowColumnContradictionRule() {
+ public DuplicateRowsOrColumnsContradictionRule() {
super(
"BINA-CONT-0003",
- "Repeated Row/Column",
- "There must not be two of the same row or two of the same column in the puzzle",
- "edu/rpi/legup/images/binary/rules/RepeatedRowColumnContradictionRule.png");
+ "Duplicate Rows Or Columns",
+ "There must not be two rows or two columns that are duplicates",
+ "edu/rpi/legup/images/binary/rules/DuplicateRowOrColumnContradictionRule.png");
}
- /**
- * Checks whether the transition has a contradiction at the specific puzzleElement index using
- * this rule
- *
- * @param board board to check contradiction
- * @param puzzleElement equivalent puzzleElement
- * @return null if the transition contains a contradiction at the specified puzzleElement,
- * otherwise error message
- */
@Override
public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
BinaryBoard binaryBoard = (BinaryBoard) board;
@@ -38,9 +29,11 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
// Compare each row with row of current cell to see if they are equal, if so the rule is
// applied correctly
ArrayList row = binaryBoard.getRowTypes(cell.getLocation().y);
+
int size = row.size();
+
for (int i = 0; i < size; i++) {
- if (i != cell.getLocation().y) {
+ if (i > cell.getLocation().y) {
ArrayList currRow = binaryBoard.getRowTypes(i);
if (currRow.equals(row)) {
return null;
@@ -51,8 +44,9 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
// Compare each column with column of current cell to see if they are equal, if so the rule
// is applied correctly
ArrayList col = binaryBoard.getColTypes(cell.getLocation().x);
+
for (int i = 0; i < size; i++) {
- if (i != cell.getLocation().x) {
+ if (i > cell.getLocation().x) {
ArrayList currCol = binaryBoard.getColTypes(i);
if (currCol.equals(col)) {
return null;
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/rules/ZeroOrOneCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/binary/rules/OneOrZeroCaseRule.java
similarity index 64%
rename from src/main/java/edu/rpi/legup/puzzle/binary/rules/ZeroOrOneCaseRule.java
rename to src/main/java/edu/rpi/legup/puzzle/binary/rules/OneOrZeroCaseRule.java
index f47fe55b9..21ee0dd5b 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/rules/ZeroOrOneCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/rules/OneOrZeroCaseRule.java
@@ -11,23 +11,16 @@
import java.util.ArrayList;
import java.util.List;
-public class ZeroOrOneCaseRule extends CaseRule {
+public class OneOrZeroCaseRule extends CaseRule {
- public ZeroOrOneCaseRule() {
+ public OneOrZeroCaseRule() {
super(
"BINA-CASE-0001",
- "Zero Or One",
- "Each blank cell is either a zero or a one",
- "edu/rpi/legup/images/binary/rules/ZeroOrOneCaseRule.png");
+ "One or Zero",
+ "Each blank cell is either a one or a zero.",
+ "edu/rpi/legup/images/binary/rules/OneOrZeroCaseRule.png");
}
- /**
- * Checks whether the {@link TreeTransition} logically follows from the parent node using this
- * rule. This method is the one that should be overridden in child classes.
- *
- * @param transition transition to check
- * @return null if the child node logically follow from the parent node, otherwise error message
- */
@Override
public String checkRuleRaw(TreeTransition transition) {
List childTransitions = transition.getParents().get(0).getChildren();
@@ -59,13 +52,6 @@ public String checkRuleRaw(TreeTransition transition) {
return null;
}
- /**
- * Generates a {@link CaseBoard} that includes all blank cells from the given board that this
- * case rule can be applied to
- *
- * @param board The board to find locations where this case rule can be applied
- * @return A CaseBoard containing pickable elements where the case rule can be applied
- */
@Override
public CaseBoard getCaseBoard(Board board) {
BinaryBoard binaryBoard = (BinaryBoard) board.copy();
@@ -79,44 +65,24 @@ public CaseBoard getCaseBoard(Board board) {
return caseBoard;
}
- /**
- * Gets the possible cases at a specific location based on this case rule
- *
- * @param board the current board state
- * @param puzzleElement equivalent puzzleElement
- * @return a list of elements the specified could be
- */
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
-
Board case1 = board.copy();
PuzzleElement data1 = case1.getPuzzleElement(puzzleElement);
- data1.setData(BinaryType.ONE.toValue());
+ data1.setData(BinaryType.ZERO.toValue());
case1.addModifiedData(data1);
cases.add(case1);
Board case2 = board.copy();
PuzzleElement data2 = case2.getPuzzleElement(puzzleElement);
- data2.setData(BinaryType.ZERO.toValue());
+ data2.setData(BinaryType.ONE.toValue());
case2.addModifiedData(data2);
cases.add(case2);
return cases;
}
- /**
- * Checks whether the child node logically follows from the parent node at the specific
- * puzzleElement index using this rule
- *
- * @param transition transition to check
- * @param puzzleElement equivalent puzzleElement
- * @return null if the child node logically follow from the parent node at the specified
- * puzzleElement, otherwise error message
- */
@Override
public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) {
return null;
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/rules/OneTileGapDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/binary/rules/OneTileGapDirectRule.java
new file mode 100644
index 000000000..2e1e96fa5
--- /dev/null
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/rules/OneTileGapDirectRule.java
@@ -0,0 +1,64 @@
+package edu.rpi.legup.puzzle.binary.rules;
+
+import edu.rpi.legup.model.gameboard.Board;
+import edu.rpi.legup.model.gameboard.PuzzleElement;
+import edu.rpi.legup.model.rules.ContradictionRule;
+import edu.rpi.legup.model.rules.DirectRule;
+import edu.rpi.legup.model.tree.TreeNode;
+import edu.rpi.legup.model.tree.TreeTransition;
+import edu.rpi.legup.puzzle.binary.BinaryBoard;
+import edu.rpi.legup.puzzle.binary.BinaryCell;
+
+public class OneTileGapDirectRule extends DirectRule {
+ private final String INVALID_USE_MESSAGE = "Number at cell is incorrect";
+
+ public OneTileGapDirectRule() {
+ super(
+ "BINA-BASC-0002",
+ "One Tile Gap",
+ "If an empty tile is in between the same value, fill the gap with the other value.",
+ "edu/rpi/legup/images/binary/rules/OneTileGapDirectRule.png");
+ }
+
+ boolean checkLeftRight(BinaryCell c, BinaryBoard board) {
+ int x = c.getLocation().x;
+ int y = c.getLocation().y;
+ return board.getCell(x - 1, y).getType() != c.getType()
+ || board.getCell(x + 1, y).getType() != c.getType();
+ }
+
+ boolean checkUpDown(BinaryCell c, BinaryBoard board) {
+ int x = c.getLocation().x;
+ int y = c.getLocation().y;
+ return board.getCell(x, y - 1).getType() != c.getType()
+ || board.getCell(x, y + 1).getType() != c.getType();
+ }
+
+ @Override
+ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) {
+ BinaryBoard origBoard = (BinaryBoard) transition.getParents().get(0).getBoard();
+ ContradictionRule contraRule = new ThreeAdjacentContradictionRule();
+ BinaryCell binaryCell = (BinaryCell) puzzleElement;
+ BinaryBoard modified = origBoard.copy();
+
+ // System.out.println("ORIG" + binaryCell.getData());
+ // System.out.println("AFTER" + Math.abs(binaryCell.getData() - 1));
+ modified.getPuzzleElement(puzzleElement).setData(Math.abs(binaryCell.getData() - 1));
+
+ PuzzleElement newP = binaryCell;
+
+ System.out.println(contraRule.checkContradictionAt(modified, newP));
+
+ if (contraRule.checkContradictionAt(modified, newP) == null) {
+ return null;
+ }
+ modified.getPuzzleElement(puzzleElement).setData(Math.abs(binaryCell.getData() - 1));
+
+ return "Grouping of Three Ones or Zeros not found";
+ }
+
+ @Override
+ public Board getDefaultBoard(TreeNode node) {
+ return null;
+ }
+}
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/rules/SurroundPairDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/binary/rules/SurroundPairDirectRule.java
new file mode 100644
index 000000000..dc2f07c8b
--- /dev/null
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/rules/SurroundPairDirectRule.java
@@ -0,0 +1,48 @@
+package edu.rpi.legup.puzzle.binary.rules;
+
+import edu.rpi.legup.model.gameboard.Board;
+import edu.rpi.legup.model.gameboard.PuzzleElement;
+import edu.rpi.legup.model.rules.ContradictionRule;
+import edu.rpi.legup.model.rules.DirectRule;
+import edu.rpi.legup.model.tree.TreeNode;
+import edu.rpi.legup.model.tree.TreeTransition;
+import edu.rpi.legup.puzzle.binary.BinaryBoard;
+import edu.rpi.legup.puzzle.binary.BinaryCell;
+
+public class SurroundPairDirectRule extends DirectRule {
+
+ public SurroundPairDirectRule() {
+ super(
+ "BINA-BASC-0001",
+ "Surround Pair",
+ "If two adjacent tiles have the same value, surround the tiles with the other value.",
+ "edu/rpi/legup/images/binary/rules/SurroundPairDirectRule.png");
+ }
+
+ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) {
+ BinaryBoard origBoard = (BinaryBoard) transition.getParents().get(0).getBoard();
+ ContradictionRule contraRule = new ThreeAdjacentContradictionRule();
+ BinaryCell binaryCell = (BinaryCell) puzzleElement;
+ BinaryBoard modified = origBoard.copy();
+
+ // System.out.println("ORIG" + binaryCell.getData());
+ // System.out.println("AFTER" + Math.abs(binaryCell.getData() - 1));
+ modified.getPuzzleElement(puzzleElement).setData(Math.abs(binaryCell.getData() - 1));
+
+ PuzzleElement newP = binaryCell;
+
+ System.out.println(contraRule.checkContradictionAt(modified, newP));
+
+ if (contraRule.checkContradictionAt(modified, newP) == null) {
+ return null;
+ }
+ modified.getPuzzleElement(puzzleElement).setData(Math.abs(binaryCell.getData() - 1));
+
+ return "Grouping of Three Ones or Zeros not found";
+ }
+
+ @Override
+ public Board getDefaultBoard(TreeNode node) {
+ return null;
+ }
+}
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/rules/ThreeAdjacentContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/binary/rules/ThreeAdjacentContradictionRule.java
new file mode 100644
index 000000000..075642246
--- /dev/null
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/rules/ThreeAdjacentContradictionRule.java
@@ -0,0 +1,127 @@
+package edu.rpi.legup.puzzle.binary.rules;
+
+import edu.rpi.legup.model.gameboard.Board;
+import edu.rpi.legup.model.gameboard.PuzzleElement;
+import edu.rpi.legup.model.rules.ContradictionRule;
+import edu.rpi.legup.puzzle.binary.BinaryBoard;
+import edu.rpi.legup.puzzle.binary.BinaryCell;
+import edu.rpi.legup.puzzle.binary.BinaryType;
+
+public class ThreeAdjacentContradictionRule extends ContradictionRule {
+ private final String NO_CONTRADICTION_MESSAGE =
+ "Does not contain a contradiction at this index";
+ private final String INVALID_USE_MESSAGE = "Contradiction must be a zero or one";
+
+ public ThreeAdjacentContradictionRule() {
+ super(
+ "BINA-CONT-0001",
+ "Three Adjacent",
+ "There must not be three adjacent zeros or three adjacent ones in a row or column",
+ "edu/rpi/legup/images/binary/rules/ThreeAdjacentContradictionRule.png");
+ }
+
+ @Override
+ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
+ BinaryBoard binaryBoard = (BinaryBoard) board;
+ int height = binaryBoard.getHeight();
+ int width = binaryBoard.getWidth();
+
+ BinaryCell cell = (BinaryCell) binaryBoard.getPuzzleElement(puzzleElement);
+ System.out.println("THE CELL IS : " + cell.getType());
+ int cellX = cell.getLocation().x;
+ int cellY = cell.getLocation().y;
+ BinaryCell oneUp = null;
+ BinaryCell oneDown = null;
+ BinaryCell oneForward = null;
+ BinaryCell oneBackward = null;
+ BinaryCell twoUp = null;
+ BinaryCell twoDown = null;
+ BinaryCell twoForward = null;
+ BinaryCell twoBackward = null;
+ if (binaryBoard.getCell(cellX, cellY + 1) != null) {
+ oneUp = binaryBoard.getCell(cellX, cellY + 1);
+ }
+ if (binaryBoard.getCell(cellX, cellY - 1) != null) {
+ oneDown = binaryBoard.getCell(cellX, cellY - 1);
+ }
+ if (binaryBoard.getCell(cellX + 1, cellY) != null) {
+ oneForward = binaryBoard.getCell(cellX + 1, cellY);
+ }
+ if (binaryBoard.getCell(cellX - 1, cellY) != null) {
+ oneBackward = binaryBoard.getCell(cellX - 1, cellY);
+ }
+ if (binaryBoard.getCell(cellX, cellY + 2) != null) {
+ twoUp = binaryBoard.getCell(cellX, cellY + 2);
+ }
+ if (binaryBoard.getCell(cellX, cellY - 2) != null) {
+ twoDown = binaryBoard.getCell(cellX, cellY - 2);
+ }
+ if (binaryBoard.getCell(cellX + 2, cellY) != null) {
+ twoForward = binaryBoard.getCell(cellX + 2, cellY);
+ }
+ if (binaryBoard.getCell(cellX - 2, cellY) != null) {
+ twoBackward = binaryBoard.getCell(cellX - 2, cellY);
+ }
+
+ if (cell.getType() == BinaryType.ONE || cell.getType() == BinaryType.ZERO) {
+ if (twoBackward != null
+ && oneBackward != null
+ && twoBackward.getType() != BinaryType.UNKNOWN
+ && oneBackward.getType() != BinaryType.UNKNOWN) {
+ if (twoBackward.getType() == cell.getType()
+ && oneBackward.getType() == cell.getType()) {
+ System.out.println("1");
+ return null;
+ }
+ }
+ if (twoForward != null
+ && oneForward != null
+ && twoForward.getType() != BinaryType.UNKNOWN
+ && oneForward.getType() != BinaryType.UNKNOWN) {
+ if (twoForward.getType() == cell.getType()
+ && oneForward.getType() == cell.getType()) {
+ System.out.println("2");
+ return null;
+ }
+ }
+ if (twoDown != null
+ && oneDown != null
+ && twoDown.getType() != BinaryType.UNKNOWN
+ && oneDown.getType() != BinaryType.UNKNOWN) {
+ if (twoDown.getType() == cell.getType() && oneDown.getType() == cell.getType()) {
+ System.out.println("3");
+ return null;
+ }
+ }
+ if (twoUp != null
+ && oneUp != null
+ && twoUp.getType() != BinaryType.UNKNOWN
+ && oneUp.getType() != BinaryType.UNKNOWN) {
+ if (twoUp.getType() == cell.getType() && oneUp.getType() == cell.getType()) {
+ System.out.println("4");
+ return null;
+ }
+ }
+ if (oneBackward != null
+ && oneForward != null
+ && oneBackward.getType() != BinaryType.UNKNOWN
+ && oneForward.getType() != BinaryType.UNKNOWN) {
+ if (oneBackward.getType() == cell.getType()
+ && oneForward.getType() == cell.getType()) {
+ System.out.println("5");
+ return null;
+ }
+ }
+ if (oneUp != null
+ && oneDown != null
+ && oneUp.getType() != BinaryType.UNKNOWN
+ && oneDown.getType() != BinaryType.UNKNOWN) {
+ if (oneUp.getType() == cell.getType() && oneDown.getType() == cell.getType()) {
+ System.out.println("6");
+ return null;
+ }
+ }
+ }
+ return super.getNoContradictionMessage() + ": " + this.NO_CONTRADICTION_MESSAGE;
+ }
+}
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/rules/UnbalancedRowColumnContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/binary/rules/UnbalancedRowOrColumnContradictionRule.java
similarity index 66%
rename from src/main/java/edu/rpi/legup/puzzle/binary/rules/UnbalancedRowColumnContradictionRule.java
rename to src/main/java/edu/rpi/legup/puzzle/binary/rules/UnbalancedRowOrColumnContradictionRule.java
index 1d00f4da9..301cc6ec1 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/rules/UnbalancedRowColumnContradictionRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/rules/UnbalancedRowOrColumnContradictionRule.java
@@ -8,29 +8,20 @@
import edu.rpi.legup.puzzle.binary.BinaryType;
import java.util.Set;
-public class UnbalancedRowColumnContradictionRule extends ContradictionRule {
+public class UnbalancedRowOrColumnContradictionRule extends ContradictionRule {
private final String NO_CONTRADICTION_MESSAGE =
"Does not contain a contradiction at this index";
private final String INVALID_USE_MESSAGE = "Row or column must have a value in each cell";
- public UnbalancedRowColumnContradictionRule() {
+ public UnbalancedRowOrColumnContradictionRule() {
super(
"BINA-CONT-0002",
- "Unbalanced Row/Column",
+ "Unbalanced Row Or Column",
"Each row or column must contain an equal number of zeros and ones",
"edu/rpi/legup/images/binary/rules/UnbalancedRowColumnContradictionRule.png");
}
- /**
- * Checks whether the transition has a contradiction at the specific puzzleElement index using
- * this rule
- *
- * @param board board to check contradiction
- * @param puzzleElement equivalent puzzleElement
- * @return null if the transition contains a contradiction at the specified puzzleElement,
- * otherwise error message
- */
@Override
public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
BinaryBoard binaryBoard = (BinaryBoard) board;
@@ -50,9 +41,8 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
}
}
- // if there are too many zeros or ones in this row
- if (rowNumZeros > size / 2 || rowNumOnes > size / 2) {
- return null;
+ if (rowNumZeros == size / 2 && rowNumOnes == size / 2) {
+ return super.getNoContradictionMessage() + ": " + this.NO_CONTRADICTION_MESSAGE;
}
Set col = binaryBoard.getColCells(cell.getLocation().x);
@@ -69,11 +59,10 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
}
}
- // if there are too many zeros or ones in this column
- if (colNumZeros > size / 2 || colNumOnes > size / 2) {
- return null;
+ if (colNumZeros == size / 2 && colNumOnes == size / 2) {
+ return super.getNoContradictionMessage() + ": " + this.NO_CONTRADICTION_MESSAGE;
}
- return super.getNoContradictionMessage() + ": " + this.NO_CONTRADICTION_MESSAGE;
+ return null;
}
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/binary/rules/binary_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/binary/rules/binary_reference_sheet.txt
index 619d183a5..c8cb0d1b9 100644
--- a/src/main/java/edu/rpi/legup/puzzle/binary/rules/binary_reference_sheet.txt
+++ b/src/main/java/edu/rpi/legup/puzzle/binary/rules/binary_reference_sheet.txt
@@ -1,11 +1,9 @@
-BINA-BASC-0001 : PreventTrioContradictionRule
-BINA-BASC-0002 : CompleteRowColumnDirectRule
-BINA-BASC-0003 : SaveBlockerDirectRule
-BINA-BASC-0004 : UniqueRowColumnDirectRule
+BINA-BASC-0001 : SurroundPairDirectRule
+BINA-BASC-0002 : OneTileGapDirectRule
+BINA-BASC-0003 : CompleteRowColumnDirectRule
-BINA-CONT-0001 : TrioContradictionRule
-BINA-CONT-0002 : UnbalancedRowColumnContradictionRule
-BINA-CONT-0003 : RepeatedRowColumnContradictionRule
-BINA-CONT-0004 : WastedBlockerContradictionRule
+BINA-CONT-0001 : ThreeAdjacentContradictionRule
+BINA-CONT-0002 : UnbalancedRowOrColumnContradictionRule
+BINA-CONT-0003 : DuplicateRowsOrColumnsContradictionRule
-BINA-CASE-0001 : ZeroOrOneCaseRule
\ No newline at end of file
+BINA-CASE-0001 : OneOrZeroCaseRule
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixCell.java b/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixCell.java
index 40c5e4a54..a9e5aa2df 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixCell.java
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixCell.java
@@ -42,13 +42,13 @@ public void setCellType(FillapixCellType type) {
@Override
public void setType(Element e, MouseEvent m) {
switch (e.getElementID()) {
- case "FPIX-ELEM-0001":
+ case "FPIX-PLAC-0001":
this.setCellType(FillapixCellType.BLACK);
break;
- case "FPIX-ELEM-0004":
+ case "FPIX-PLAC-0002":
this.setCellType(FillapixCellType.WHITE);
break;
- case "FPIX-ELEM-0002":
+ case "FPIX-UNPL-0001":
int n = this.getNumber();
switch (m.getButton()) {
case MouseEvent.BUTTON1:
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/BlackTile.java b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/BlackTile.java
index a6993778d..1d7c038a3 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/BlackTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/BlackTile.java
@@ -5,7 +5,7 @@
public class BlackTile extends PlaceableElement {
public BlackTile() {
super(
- "FPIX-ELEM-0001",
+ "FPIX-PLAC-0001",
"Black Tile",
"The black tile",
"edu/rpi/legup/images/fillapix/tiles/BlackTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/NumberTile.java b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/NumberTile.java
index 5852c1ad7..e869aeaf9 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/NumberTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/NumberTile.java
@@ -1,13 +1,13 @@
package edu.rpi.legup.puzzle.fillapix.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class NumberTile extends PlaceableElement {
+public class NumberTile extends NonPlaceableElement {
private int object_num;
public NumberTile() {
super(
- "FPIX-ELEM-0002",
+ "FPIX-UNPL-0001",
"Number Tile",
"A numbered tile",
"edu/rpi/legup/images/fillapix/tiles/NumberTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/UnknownTile.java b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/UnknownTile.java
index 82d0dffb9..6778c1758 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/UnknownTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/UnknownTile.java
@@ -1,11 +1,11 @@
package edu.rpi.legup.puzzle.fillapix.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class UnknownTile extends PlaceableElement {
+public class UnknownTile extends NonPlaceableElement {
public UnknownTile() {
super(
- "FPIX-ELEM-0003",
+ "FPIX-UNPL-0002",
"Unknown Tile",
"A blank tile",
"edu/rpi/legup/images/fillapix/tiles/UnknownTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/WhiteTile.java b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/WhiteTile.java
index b2eedfc09..67065a7e9 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/WhiteTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/WhiteTile.java
@@ -5,7 +5,7 @@
public class WhiteTile extends PlaceableElement {
public WhiteTile() {
super(
- "FPIX-ELEM-0004",
+ "FPIX-PLAC-0002",
"White Tile",
"The white tile",
"edu/rpi/legup/images/fillapix/tiles/WhiteTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/fillapix_elements_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/fillapix_elements_reference_sheet.txt
index 1aece4b97..0409fa800 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/fillapix_elements_reference_sheet.txt
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/elements/fillapix_elements_reference_sheet.txt
@@ -1,4 +1,5 @@
-FPIX-ELEM-0001 : BlackTile
-FPIX-ELEM-0002 : NumberTile
-FPIX-ELEM-0003 : UnknownTile
-FPIX-ELEM-0004 : WhiteTile
\ No newline at end of file
+FPIX-PLAC-0001 : BlackTile
+FPIX-PLAC-0002 : WhiteTile
+
+FPIX-UNPL-0001 : NumberTile
+FPIX-UNPL-0002 : UnknownTile
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/rules/BlackOrWhiteCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/fillapix/rules/BlackOrWhiteCaseRule.java
index f0194bd39..860a6c011 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/rules/BlackOrWhiteCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/rules/BlackOrWhiteCaseRule.java
@@ -37,9 +37,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
Board case1 = board.copy();
FillapixCell cell1 = (FillapixCell) case1.getPuzzleElement(puzzleElement);
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/rules/SatisfyClueCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/fillapix/rules/SatisfyClueCaseRule.java
index f8bb2d4f5..7db833f76 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/rules/SatisfyClueCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/rules/SatisfyClueCaseRule.java
@@ -45,9 +45,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList();
- if (puzzleElement == null) {
- return cases;
- }
// get value of cell
FillapixBoard fillapixBoard = (FillapixBoard) board.copy();
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/LightUp.java b/src/main/java/edu/rpi/legup/puzzle/lightup/LightUp.java
index a73806cd7..ab95c4658 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/LightUp.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/LightUp.java
@@ -47,7 +47,7 @@ public Board generatePuzzle(int difficulty) {
* @return true if the given dimensions are valid for Light Up, false otherwise
*/
public boolean isValidDimensions(int rows, int columns) {
- return rows >= 0 && columns >= 0;
+ return rows > 0 && columns > 0;
}
/**
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/LightUpBoard.java b/src/main/java/edu/rpi/legup/puzzle/lightup/LightUpBoard.java
index 21084b8c7..217ef79a8 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/LightUpBoard.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/LightUpBoard.java
@@ -134,12 +134,12 @@ public int getNumAdjLite(LightUpCell cell) {
}
/**
- * Gets the number of adjacent cells that are placeable
+ * Gets the number of adjacent cells that are placable
*
* @param cell specified cell
- * @return number of adjacent cells that are placeable
+ * @return number of adjacent cells that are placable
*/
- public int getNumPlaceable(LightUpCell cell) {
+ public int getNumPlacble(LightUpCell cell) {
int num = 0;
Set adjCells = getAdj(cell);
for (LightUpCell c : adjCells) {
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/LightUpCell.java b/src/main/java/edu/rpi/legup/puzzle/lightup/LightUpCell.java
index 6d890e67b..8adf84cb4 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/LightUpCell.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/LightUpCell.java
@@ -16,16 +16,16 @@ public LightUpCell(int valueInt, Point location) {
@Override
public void setType(Element e, MouseEvent m) {
switch (e.getElementID()) {
- case "LTUP-ELEM-0002":
+ case "LTUP-PLAC-0001":
this.data = -4;
break;
- case "LTUP-ELEM-0001":
+ case "LTUP-UNPL-0002":
this.data = -1;
break;
- case "LTUP-ELEM-0004":
+ case "LTUP-UNPL-0003":
this.data = -2;
break;
- case "LTUP-ELEM-0003":
+ case "LTUP-UNPL-0001":
switch (m.getButton()) {
case MouseEvent.BUTTON1:
if (this.data < 0 || this.data > 3) {
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/BlackTile.java b/src/main/java/edu/rpi/legup/puzzle/lightup/elements/BlackTile.java
index eed3795d7..2ddb4f754 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/BlackTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/elements/BlackTile.java
@@ -1,11 +1,11 @@
package edu.rpi.legup.puzzle.lightup.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class BlackTile extends PlaceableElement {
+public class BlackTile extends NonPlaceableElement {
public BlackTile() {
super(
- "LTUP-ELEM-0001",
+ "LTUP-UNPL-0002",
"Black Tile",
"The black tile",
"edu/rpi/legup/images/lightup/black.gif");
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/BulbTile.java b/src/main/java/edu/rpi/legup/puzzle/lightup/elements/BulbTile.java
index 61ebac3d0..d238baa56 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/BulbTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/elements/BulbTile.java
@@ -5,7 +5,7 @@
public class BulbTile extends PlaceableElement {
public BulbTile() {
super(
- "LTUP-ELEM-0002",
+ "LTUP-PLAC-0001",
"Bulb Tile",
"The bulb tile",
"edu/rpi/legup/images/lightup/light.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/NumberTile.java b/src/main/java/edu/rpi/legup/puzzle/lightup/elements/NumberTile.java
index 26f9be46c..ae314a4cf 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/NumberTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/elements/NumberTile.java
@@ -1,15 +1,15 @@
package edu.rpi.legup.puzzle.lightup.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class NumberTile extends PlaceableElement {
+public class NumberTile extends NonPlaceableElement {
int object_number;
// Follow the default format and resolves the NoSuchMethod error
public NumberTile() {
super(
- "LTUP-ELEM-0003",
+ "LTUP-UNPL-0001",
"Number Tile",
"The number tile",
"edu/rpi/legup/images/lightup/1.gif");
@@ -17,7 +17,7 @@ public NumberTile() {
public NumberTile(int num) {
super(
- "LTUP-ELEM-0003",
+ "LTUP-UNPL-0001",
"Number Tile",
"The number tile",
"edu/rpi/legup/images/lightup/" + num + ".gif");
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/UnknownTile.java b/src/main/java/edu/rpi/legup/puzzle/lightup/elements/UnknownTile.java
index a724be600..24d420fe8 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/UnknownTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/elements/UnknownTile.java
@@ -1,11 +1,11 @@
package edu.rpi.legup.puzzle.lightup.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class UnknownTile extends PlaceableElement {
+public class UnknownTile extends NonPlaceableElement {
public UnknownTile() {
super(
- "LTUP-ELEM-0004",
+ "LTUP-UNPL-0003",
"Unknown Tile",
"A blank tile",
"edu/rpi/legup/images/lightup/UnknownTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/lightup_elements_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/lightup/elements/lightup_elements_reference_sheet.txt
deleted file mode 100644
index 93c97de1c..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/elements/lightup_elements_reference_sheet.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-LTUP-ELEM-0001 : BlackTile
-LTUP-ELEM-0002 : BulbTile
-LTUP-ELEM-0003 : NumberTile
-LTUP-ELEM-0004 : UnknownTile
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/LightOrEmptyCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/LightOrEmptyCaseRule.java
index 53efb6587..4ba754731 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/LightOrEmptyCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/LightOrEmptyCaseRule.java
@@ -44,10 +44,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
-
Board case1 = board.copy();
PuzzleElement data1 = case1.getPuzzleElement(puzzleElement);
data1.setData(-4);
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java
index f73a34b2d..490122874 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java
@@ -47,11 +47,6 @@ public CaseBoard getCaseBoard(Board board) {
*/
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
- ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
-
LightUpBoard lightUpBoard = (LightUpBoard) board;
LightUpCell cell = (LightUpCell) puzzleElement;
Point loc = cell.getLocation();
@@ -101,6 +96,7 @@ public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
}
}
+ ArrayList cases = new ArrayList<>();
if (numNeeded == 0) {
return cases;
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/TooFewBulbsContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/TooFewBulbsContradictionRule.java
index de1f85edc..8cf68e570 100644
--- a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/TooFewBulbsContradictionRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/TooFewBulbsContradictionRule.java
@@ -36,7 +36,7 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
}
int bulbs = lightUpBoard.getNumAdj(cell, LightUpCellType.BULB);
- int placeable = lightUpBoard.getNumPlaceable(cell);
+ int placeable = lightUpBoard.getNumPlacble(cell);
if (bulbs + placeable < cell.getData()) {
return null;
diff --git a/src/main/java/edu/rpi/legup/puzzle/minesweeper/elements/BombTile.java b/src/main/java/edu/rpi/legup/puzzle/minesweeper/elements/BombTile.java
index cd5577eeb..78a5d320c 100644
--- a/src/main/java/edu/rpi/legup/puzzle/minesweeper/elements/BombTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/minesweeper/elements/BombTile.java
@@ -1,8 +1,8 @@
package edu.rpi.legup.puzzle.minesweeper.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class BombTile extends PlaceableElement {
+public class BombTile extends NonPlaceableElement {
public BombTile() {
super(
"MINE-UNPL-0001",
diff --git a/src/main/java/edu/rpi/legup/puzzle/minesweeper/elements/UnsetTile.java b/src/main/java/edu/rpi/legup/puzzle/minesweeper/elements/UnsetTile.java
index 6cfc34c8d..447e2840c 100644
--- a/src/main/java/edu/rpi/legup/puzzle/minesweeper/elements/UnsetTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/minesweeper/elements/UnsetTile.java
@@ -1,8 +1,8 @@
package edu.rpi.legup.puzzle.minesweeper.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class UnsetTile extends PlaceableElement {
+public class UnsetTile extends NonPlaceableElement {
public UnsetTile() {
super(
diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeCell.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeCell.java
index 1e0e85ed8..c6cd2c64e 100644
--- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeCell.java
+++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeCell.java
@@ -46,13 +46,13 @@ public NurikabeType getType() {
@Override
public void setType(Element e, MouseEvent m) {
switch (e.getElementID()) {
- case "NURI-ELEM-0001":
+ case "NURI-PLAC-0001":
this.data = -1;
break;
- case "NURI-ELEM-0004":
+ case "NURI-PLAC-0002":
this.data = 0;
break;
- case "NURI-ELEM-0002":
+ case "NURI-UNPL-0001":
switch (m.getButton()) {
case MouseEvent.BUTTON1:
if (this.data <= 0 || this.data > 8) {
diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeExporter.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeExporter.java
index e01821639..23efd4724 100644
--- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeExporter.java
+++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/NurikabeExporter.java
@@ -10,13 +10,6 @@ public NurikabeExporter(Nurikabe nurikabe) {
super(nurikabe);
}
- /**
- * Generates an XML element for the nurikabe puzzle board, including its dimensions and the
- * state of each cell. Nurikabe cells that are not empty are included in the XML.
- *
- * @param newDocument The XML document to which the board element belongs.
- * @return The XML element representing the board.
- */
@Override
protected org.w3c.dom.Element createBoardElement(Document newDocument) {
NurikabeBoard board;
diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/BlackTile.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/BlackTile.java
index a7972b9b2..459a809e0 100644
--- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/BlackTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/BlackTile.java
@@ -5,7 +5,7 @@
public class BlackTile extends PlaceableElement {
public BlackTile() {
super(
- "NURI-ELEM-0001",
+ "NURI-PLAC-0001",
"Black Tile",
"The black tile",
"edu/rpi/legup/images/nurikabe/tiles/BlackTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/NumberTile.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/NumberTile.java
index 2015d990b..475b278da 100644
--- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/NumberTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/NumberTile.java
@@ -1,13 +1,13 @@
package edu.rpi.legup.puzzle.nurikabe.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class NumberTile extends PlaceableElement {
+public class NumberTile extends NonPlaceableElement {
private int object_num;
public NumberTile() {
super(
- "NURI-ELEM-0002",
+ "NURI-UNPL-0001",
"Number Tile",
"A numbered tile",
"edu/rpi/legup/images/nurikabe/tiles/NumberTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/UnknownTile.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/UnknownTile.java
index 8a18c80cc..85d47e208 100644
--- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/UnknownTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/UnknownTile.java
@@ -1,11 +1,11 @@
package edu.rpi.legup.puzzle.nurikabe.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class UnknownTile extends PlaceableElement {
+public class UnknownTile extends NonPlaceableElement {
public UnknownTile() {
super(
- "NURI-ELEM-0003",
+ "NURI-UNPL-0002",
"Unknown Tile",
"A blank tile",
"edu/rpi/legup/images/nurikabe/tiles/UnknownTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/WhiteTile.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/WhiteTile.java
index ae07c6d76..35eb63b81 100644
--- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/WhiteTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/WhiteTile.java
@@ -5,7 +5,7 @@
public class WhiteTile extends PlaceableElement {
public WhiteTile() {
super(
- "NURI-ELEM-0004",
+ "NURI-PLAC-0002",
"White Tile",
"The white tile",
"edu/rpi/legup/images/nurikabe/tiles/WhiteTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/nurikabe_elements_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/nurikabe_elements_reference_sheet.txt
deleted file mode 100644
index 667972fd6..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/elements/nurikabe_elements_reference_sheet.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-NURI-ELEM-0001 : BlackTile
-NURI-ELEM-0002 : NumberTile
-NURI-ELEM-0003 : UnknownTile
-NURI-ELEM-0004 : WhiteTile
diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/BlackOrWhiteCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/BlackOrWhiteCaseRule.java
index 1c87d5cfa..ac0ab6df6 100644
--- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/BlackOrWhiteCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/BlackOrWhiteCaseRule.java
@@ -24,7 +24,7 @@ public BlackOrWhiteCaseRule() {
/**
* Checks whether the {@link TreeTransition} logically follows from the parent node using this
- * rule. This method is the one that should be overridden in child classes.
+ * rule. This method is the one that should overridden in child classes.
*
* @param transition transition to check
* @return null if the child node logically follow from the parent node, otherwise error message
@@ -84,10 +84,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
-
Board case1 = board.copy();
PuzzleElement data1 = case1.getPuzzleElement(puzzleElement);
data1.setData(NurikabeType.WHITE.toValue());
diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java
index 025212d96..24a261ec9 100644
--- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java
@@ -27,16 +27,15 @@ public FinishRoomCaseRule() {
super(
"NURI-CASE-0002",
"Finish Room",
- "Room can be finished in up to nine ways",
+ "Room can be finished in up to five ways",
"edu/rpi/legup/images/nurikabe/cases/FinishRoom.png");
- this.MAX_CASES = 9;
- this.MIN_CASES = 1;
- this.uniqueCases = new HashSet<>();
+ this.MAX_CASES = 5;
+ this.MIN_CASES = 2;
}
/**
* Checks whether the {@link TreeTransition} logically follows from the parent node using this
- * rule. This method is the one that should have overridden in child classes.
+ * rule. This method is the one that should overridden in child classes.
*
* @param transition transition to check
* @return null if the child node logically follow from the parent node, otherwise error message
@@ -45,18 +44,18 @@ public FinishRoomCaseRule() {
public String checkRuleRaw(TreeTransition transition) {
NurikabeBoard destBoardState = (NurikabeBoard) transition.getBoard();
List childTransitions = transition.getParents().get(0).getChildren();
- if (childTransitions.size() > MAX_CASES) {
+ if (childTransitions.size() > 5) {
return super.getInvalidUseOfRuleMessage()
- + ": This case rule must have 9 or less children.";
+ + ": This case rule must have 5 or less children.";
}
- if (childTransitions.size() < MIN_CASES) {
+ if (childTransitions.size() < 2) {
return super.getInvalidUseOfRuleMessage()
- + ": This case rule must have 1 or more children.";
+ + ": This case rule must have 2 or more children.";
}
if (childTransitions.size() != legitCases) {
return super.getInvalidUseOfRuleMessage()
+ ": Cases can not be removed from the branch.";
- } // stops user from deleting 1 or more generated cases and still having path show as green
+ } // stops user from deleting 1 or mose generated cases and still having path show as green
Set locations = new HashSet<>();
for (TreeTransition t1 : childTransitions) {
locations.add(
@@ -101,8 +100,14 @@ public CaseBoard getCaseBoard(Board board) {
// if found another number tile and it's data is different from the element
// we're working with
if ((d.getType() == NurikabeType.NUMBER)
- && !(d.getData().equals(((NurikabeCell) element).getData()))) {
- only = false;
+ && !(d.getData()
+ .equals(
+ ((NurikabeCell) element)
+ .getData()))) { // if found another number tile
+ // and it's data is different
+ // than the element we're
+ // working with
+ only = false; // set only to false
}
}
// if size of region is 1 less than the number block and the number block is only
@@ -125,10 +130,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList<>(); // makes array list of cases
- if (puzzleElement == null) {
- return cases;
- }
-
NurikabeBoard nuriBoard = (NurikabeBoard) board.copy(); // nurikabe board to edit
NurikabeCell numberCell =
nuriBoard.getCell(
@@ -230,9 +231,23 @@ private void generateCases(
break;
}
}
- if (unique) {
- caseBoard.addModifiedData(newCell);
- cases.add(caseBoard);
+ if (!alreadyIn) { // if point wasn't already in
+ Board casey =
+ nuriBoard.copy(); // copy the current board with white tile
+ // changed
+ PuzzleElement datacasey =
+ curr; // gets changed white tile as a puzzle element
+ datacasey.setData(
+ NurikabeType.WHITE
+ .toValue()); // ensure set to white, probably redundant
+ casey.addModifiedData(datacasey); // ensure confirmed white change
+ regions =
+ NurikabeUtilities.getNurikabeRegions(
+ nuriBoard); // update regions
+ cases.add(casey); // add this case to list of cases
+ locations.add(
+ here); // add location of new white tile to list of locations so
+ // that we don't accidentally add it again later
}
} else if (newRoomSet.size() < filledRoomSize) {
generateCases(
@@ -286,10 +301,14 @@ private boolean touchesDifferentRoom(
|| (adjacentPoint.x != origPoint.x || adjacentPoint.y != origPoint.y)) {
return true;
}
+ curr.setData(NurikabeType.UNKNOWN.toValue()); // set cell type back to unknown
+ nuriBoard.addModifiedData(curr); // confirms change back to unknown
+ regions = NurikabeUtilities.getNurikabeRegions(nuriBoard); // updates regions
}
}
+ legitCases = cases.size();
}
- return false;
+ return cases;
}
/**
diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/ShortTruthTableCell.java b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/ShortTruthTableCell.java
index ffd7c491d..75bba369f 100644
--- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/ShortTruthTableCell.java
+++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/ShortTruthTableCell.java
@@ -135,22 +135,22 @@ public void setType(Element e, MouseEvent m) {
}
// Red Element
- if (e.getElementID().equals("STTT-ELEM-0004")) {
+ if (e.getElementID().equals("STTT-PLAC-0002")) {
this.data = ShortTruthTableCellType.FALSE;
}
// Green Element
else {
- if (e.getElementID().equals("STTT-ELEM-0002")) {
+ if (e.getElementID().equals("STTT-PLAC-0001")) {
this.data = ShortTruthTableCellType.TRUE;
}
// Unknown Element
else {
- if (e.getElementID().equals("STTT-ELEM-0005")) {
+ if (e.getElementID().equals("STTT-PLAC-0003")) {
this.data = ShortTruthTableCellType.UNKNOWN;
}
// Argument Element
else {
- if (e.getElementID().equals("STTT-ELEM-0001")) {
+ if (e.getElementID().equals("STTT-UNPL-0001")) {
// Prevents non-argument symbols from being changed
if (!(this.symbol >= 'A' && this.symbol <= 'Z')) {
return;
@@ -172,7 +172,7 @@ public void setType(Element e, MouseEvent m) {
}
// And/Or Element
else {
- if (e.getElementID().equals("STTT-ELEM-0003")) {
+ if (e.getElementID().equals("STTT-UNPL-0002")) {
if (m.getButton() == MouseEvent.BUTTON1) {
if (this.symbol == '^') {
this.symbol = '|';
diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/ArgumentElement.java b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/ArgumentElement.java
index 912fd2672..9294fba4e 100644
--- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/ArgumentElement.java
+++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/ArgumentElement.java
@@ -1,11 +1,11 @@
package edu.rpi.legup.puzzle.shorttruthtable.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class ArgumentElement extends PlaceableElement {
+public class ArgumentElement extends NonPlaceableElement {
public ArgumentElement() {
super(
- "STTT-ELEM-0001",
+ "STTT-UNPL-0001",
"Argument Element",
"Argument of logic statement element",
"edu/rpi/legup/images/shorttruthtable/tiles/LetterTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/GreenElement.java b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/GreenElement.java
index 56221fef3..783186baa 100644
--- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/GreenElement.java
+++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/GreenElement.java
@@ -5,7 +5,7 @@
public class GreenElement extends PlaceableElement {
public GreenElement() {
super(
- "STTT-ELEM-0002",
+ "STTT-PLAC-0001",
"Green Element",
"A green tile to set certain tiles to true",
"edu/rpi/legup/images/shorttruthtable/tiles/GreenTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/LogicSymbolElement.java b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/LogicSymbolElement.java
index b82ebc2cb..5fed4b1df 100644
--- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/LogicSymbolElement.java
+++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/LogicSymbolElement.java
@@ -1,11 +1,11 @@
package edu.rpi.legup.puzzle.shorttruthtable.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class LogicSymbolElement extends PlaceableElement {
+public class LogicSymbolElement extends NonPlaceableElement {
public LogicSymbolElement() {
super(
- "STTT-ELEM-0003",
+ "STTT-UNPL-0002",
"Logic Symbol Element",
"Logic symbol element",
"edu/rpi/legup/images/shorttruthtable/tiles/ConditionalBiconditionalTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/RedElement.java b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/RedElement.java
index 2114e62ec..e2a589b65 100644
--- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/RedElement.java
+++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/RedElement.java
@@ -5,7 +5,7 @@
public class RedElement extends PlaceableElement {
public RedElement() {
super(
- "STTT-ELEM-0004",
+ "STTT-PLAC-0002",
"Red Element",
"A red tile to set certain tiles to false",
"edu/rpi/legup/images/shorttruthtable/tiles/RedTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/UnknownElement.java b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/UnknownElement.java
index 52b54f202..d475bc05d 100644
--- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/UnknownElement.java
+++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/UnknownElement.java
@@ -5,7 +5,7 @@
public class UnknownElement extends PlaceableElement {
public UnknownElement() {
super(
- "STTT-ELEM-0005",
+ "STTT-PLAC-0003",
"Unknown Element",
"A blank tile",
"edu/rpi/legup/images/shorttruthtable/tiles/UnknownTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/shorttruthtable_elements_reference_sheet b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/shorttruthtable_elements_reference_sheet
index c5421169f..471631553 100644
--- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/shorttruthtable_elements_reference_sheet
+++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/elements/shorttruthtable_elements_reference_sheet
@@ -1,5 +1,6 @@
-STTT-ELEM-0001 : ArgumentElement
-STTT-ELEM-0002 : GreenElement
-STTT-ELEM-0003 : LogicSymbolElement
-STTT-ELEM-0004 : RedElement
-STTT-ELEM-0005 : UnknownElement
\ No newline at end of file
+STTT-UNPL-0001 : ArgumentElement
+STTT-UNPL-0002 : ConditionalBiconditionalElement
+
+STTT-PLAC-0001 : GreenElement
+STTT-PLAC-0002 : RedElement
+STTT-PLAC-0003 : UnknownElement
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRuleAtomic.java b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRuleAtomic.java
index 22b49fd77..58d2068b2 100644
--- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRuleAtomic.java
+++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRuleAtomic.java
@@ -44,9 +44,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
Board case1 = board.copy();
PuzzleElement data1 = case1.getPuzzleElement(puzzleElement);
diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRule_GenericStatement.java b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRule_GenericStatement.java
index 8aeb51a46..99f771246 100644
--- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRule_GenericStatement.java
+++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRule_GenericStatement.java
@@ -85,11 +85,6 @@ public CaseBoard getCaseBoard(Board board) {
@SuppressWarnings("unchecked")
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
-
- if (puzzleElement == null) {
- return new ArrayList();
- }
-
ShortTruthTableBoard sttBoard = ((ShortTruthTableBoard) board);
ShortTruthTableCell cell = sttBoard.getCellFromElement(puzzleElement);
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/Skyscrapers.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/Skyscrapers.java
index 44f416cef..df5ba78a3 100644
--- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/Skyscrapers.java
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/Skyscrapers.java
@@ -46,7 +46,7 @@ public Board generatePuzzle(int difficulty) {
* @return true if the given dimensions are valid for Skyscrapers, false otherwise
*/
public boolean isValidDimensions(int rows, int columns) {
- return rows >= 3 && rows == columns;
+ return rows >= 4 && rows == columns;
}
/**
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersBoard.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersBoard.java
index 0fc133786..4cd09b254 100644
--- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersBoard.java
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersBoard.java
@@ -209,7 +209,7 @@ public void setCell(int x, int y, Element e, MouseEvent m) {
SkyscrapersClue clue = this.getClue(x, y);
if (e == null) return;
if (clue != null) {
- if (!e.getElementID().equals("SKYS-ELEM-0001")) {
+ if (!e.getElementID().equals("SKYS-UNPL-0003")) {
return;
}
@@ -217,10 +217,10 @@ public void setCell(int x, int y, Element e, MouseEvent m) {
if (clue.getData() < dimension.height) {
clue.setData(clue.getData() + 1);
} else {
- clue.setData(1);
+ clue.setData(0);
}
} else {
- if (clue.getData() > 1) {
+ if (clue.getData() > 0) {
clue.setData(clue.getData() - 1);
} else {
clue.setData(dimension.height);
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCell.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCell.java
index 9e7283b20..1cf9a357b 100644
--- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCell.java
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersCell.java
@@ -27,10 +27,10 @@ public SkyscrapersType getType() {
@Override
public void setType(Element e, MouseEvent m) {
switch (e.getElementID()) {
- case "SKYS-ELEM-0002":
+ case "SKYS-UNPL-0001":
this.data = 0;
break;
- case "SKYS-ELEM-0001":
+ case "SKYS-UNPL-0002":
switch (m.getButton()) {
case MouseEvent.BUTTON1:
if (this.data <= 0 || this.data >= this.max) {
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersClueView.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersClueView.java
index cfb3388ff..4c75f0695 100644
--- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersClueView.java
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/SkyscrapersClueView.java
@@ -25,11 +25,11 @@ public SkyscrapersClue getPuzzleElement() {
@Override
public void draw(Graphics2D graphics2D) {
drawElement(graphics2D);
- if (this.isHover()) {
- drawHover(graphics2D);
- }
if (this.isShowCasePicker() && this.isCaseRulePickable()) {
drawCase(graphics2D);
+ if (this.isHover()) {
+ drawHover(graphics2D);
+ }
}
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/ClueTile.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/ClueTile.java
new file mode 100644
index 000000000..64c9033e6
--- /dev/null
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/ClueTile.java
@@ -0,0 +1,14 @@
+package edu.rpi.legup.puzzle.skyscrapers.elements;
+
+import edu.rpi.legup.model.elements.NonPlaceableElement;
+
+public class ClueTile extends NonPlaceableElement {
+
+ public ClueTile() {
+ super(
+ "SKYS-UNPL-0003",
+ "Clue Tile",
+ "Clue Updater",
+ "edu/rpi/legup/images/skyscrapers/tiles/ClueTile.png");
+ }
+}
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/NumberTile.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/NumberTile.java
index f60e5fe8b..4d6b37c9a 100644
--- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/NumberTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/NumberTile.java
@@ -1,11 +1,11 @@
package edu.rpi.legup.puzzle.skyscrapers.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class NumberTile extends PlaceableElement {
+public class NumberTile extends NonPlaceableElement {
public NumberTile() {
super(
- "SKYS-ELEM-0001",
+ "SKYS-UNPL-0002",
"Number Tile",
"A numbered tile",
"edu/rpi/legup/images/skyscrapers/tiles/ClueTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/UnknownTile.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/UnknownTile.java
index 07f6a1238..2fb21193a 100644
--- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/UnknownTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/UnknownTile.java
@@ -1,11 +1,11 @@
package edu.rpi.legup.puzzle.skyscrapers.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class UnknownTile extends PlaceableElement {
+public class UnknownTile extends NonPlaceableElement {
public UnknownTile() {
super(
- "SKYS-ELEM-0002",
+ "SKYS-UNPL-0001",
"Unknown",
"A blank tile",
"edu/rpi/legup/images/skyscrapers/tiles/UnknownTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/skyscrapers_elements_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/skyscrapers_elements_reference_sheet.txt
index 14e76a29d..604e1824e 100644
--- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/skyscrapers_elements_reference_sheet.txt
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/elements/skyscrapers_elements_reference_sheet.txt
@@ -1,2 +1,3 @@
-SKYS-ELEM-0001: NumberTile
-SKYS-ELEM-0002: UnknownTile
\ No newline at end of file
+SKYS-UNPL-0001: Unknown Tile
+SKYS-UNPL-0002: Number Tile
+SKYS-UNPL-0003: Clue "Tile"
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/CellForNumberCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/CellForNumberCaseRule.java
index b48962c41..45bdadea3 100644
--- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/CellForNumberCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/CellForNumberCaseRule.java
@@ -61,9 +61,6 @@ public CaseBoard getCaseBoard(Board board) {
public ArrayList getCasesFor(Board board, PuzzleElement puzzleElement, Integer number) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
SkyscrapersClue clue = (SkyscrapersClue) puzzleElement;
SkyscrapersBoard skyscrapersboard = (SkyscrapersBoard) board;
diff --git a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/NumberForCellCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/NumberForCellCaseRule.java
index 4f8e1df6b..145dd6ee2 100644
--- a/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/NumberForCellCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/skyscrapers/rules/NumberForCellCaseRule.java
@@ -47,9 +47,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
SkyscrapersCell cell = (SkyscrapersCell) puzzleElement;
SkyscrapersBoard skyscrapersboard = (SkyscrapersBoard) board;
diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/allfiles.txt b/src/main/java/edu/rpi/legup/puzzle/starbattle/allfiles.txt
new file mode 100644
index 000000000..5a9ec0f0a
--- /dev/null
+++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/allfiles.txt
@@ -0,0 +1,235 @@
+//StarBattle.java
+
+package edu.rpi.legup.puzzle.starbattle;
+
+import edu.rpi.legup.model.Puzzle;
+import edu.rpi.legup.model.gameboard.Board;
+
+public class StarBattle extends Puzzle {
+ public StarBattle() {
+ super();
+ this.name = "StarBattle";
+
+ this.importer = new StarBattleImporter(this);
+ this.exporter = new StarBattleExporter(this);
+
+ this.factory = new StarBattleCellFactory();
+ }
+
+ @Override
+ public void initializeView() {
+ }
+
+ @Override
+ public Board generatePuzzle(int difficulty) {
+ return null;
+ }
+
+ @Override
+ public boolean isBoardComplete(Board board) {
+ return true;
+ }
+
+ @Override
+ public void onBoardChange(Board board) {
+ }
+}
+
+//StarBattleBoard.java
+
+package edu.rpi.legup.puzzle.lightup;
+
+import edu.rpi.legup.model.gameboard.GridBoard;
+import edu.rpi.legup.model.gameboard.PuzzleElement;
+
+import java.awt.*;
+import java.util.HashSet;
+import java.util.Set;
+
+public class StarBattleBoard extends GridBoard {
+
+ private int size;
+ private vector group_sizes;
+
+ /**
+ * StarBattleBoard Constructor - create a new Star Battle board
+ *
+ * @param size size of one side of the star battle board
+ */
+
+ public StarBattleBoard(int size) {
+ super(size, size);
+ group_sizes = vector(size);
+ }
+
+ @Override
+ public StarBattleCell getCell(int x, int y) {
+ return (StarBattleCell) super.getCell(x, y);
+ }
+
+
+}
+
+//StarBattleCell.java
+
+package edu.rpi.legup.puzzle.starbattle;
+
+import edu.rpi.legup.model.gameboard.GridCell;
+
+import java.awt.*;
+import java.util.HashSet;
+import java.util.Set;
+
+public class StarBattleCell extends GridCell {
+ private int groupIndex;
+ private int max;
+
+ /**
+ * StarBattleCell Constructor - creates a new StarBattle cell to hold the puzzleElement
+ *
+ * @param valueInt value of the star battle cell denoting its state
+ * @param location location of the cell on the board
+ * @param size size of the star battle cell
+ */
+ public StarBattleCell(int value, Point location, int groupIndex, int size) {
+ super(value, location);
+ this.groupIndex = groupIndex;
+ this.max = size;
+ }
+
+ @Override
+ public void setType(Element e, MouseEvent m) {
+ switch (e.getElementID()) {
+ case "SBUP-PLAC-0001":
+ this.data = -3;
+ break;
+ case "SBUP-PLAC-0002":
+ this.data = -2;
+ break;
+ case "SBUP-PLAC-0003":
+ this.data = -1;
+ break;
+ case "SBUP-UNPL-0001"://Not sure how button events work
+ switch (m.getButton()){
+ case MouseEvent.BUTTON1:
+ if (this.data < 0 || this.data > 3) {
+ this.data = 0;
+ }
+ else {
+ this.data = this.data + 1;
+ }
+ break;
+ case MouseEvent.BUTTON3:
+ if (this.data > 0) {
+ this.data = this.data - 1;
+ }
+ else {
+ this.data = 3;//Unsure
+ }
+ break;
+ }
+ break;
+ }
+ }
+
+ public LightUpCellType getType() {
+ switch (data) {
+ case -3:
+ return LightUpCellType.UNKNOWN;
+ case -2:
+ return LightUpCellType.STAR;
+ case -1:
+ return LightUpCellType.BLACK;
+ default:
+ if (data >= 0) {
+ return StarBattleCellType.WHITE;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets the region index of the cell
+ *
+ * @return group index of the cell
+ */
+ public int getGroupIndex() {
+ return groupIndex;
+ }
+
+ /**
+ * Gets the size of the cell
+ *
+ * @return size of the cell
+ */
+
+ public int getMax() {
+ return max;
+ }
+
+}
+
+//StarBattleCellController.java
+
+package edu.rpi.legup.puzzle.starbattle;
+
+import edu.rpi.legup.controller.ElementController;
+import edu.rpi.legup.model.gameboard.PuzzleElement;
+
+import java.awt.event.MouseEvent;
+
+public class StarBattleCellController extends ElementController {
+ @Override
+ public void changeCell(MouseEvent e, PuzzleElement data) {
+ StarBattleCell cell = (StarBattleCell) data;
+ if (e.getButton() == MouseEvent.BUTTON1) {
+ if (e.isControlDown()) {
+ this.boardView.getSelectionPopupMenu().show(boardView, this.boardView.getCanvas().getX() + e.getX(), this.boardView.getCanvas().getY() + e.getY());
+ }
+ else {
+ if (cell.getData() == 0) {
+ data.setData(-3);
+ }
+ else {
+ data.setData(cell.getData() + 1);
+ }
+ }
+ }
+ else {
+ if (e.getButton() == MouseEvent.BUTTON3) {
+ if (cell.getData() == -3) {
+ data.setData(0);
+ }
+ else {
+ data.setData(cell.getData() - 1);
+ }
+ }
+ }
+ }
+}
+
+//StarBattleCellFactory.java
+
+
+
+//StarBattleCellType.java
+package edu.rpi.legup.puzzle.starbattle;
+
+public enum StarBattleType {
+ UNKNOWN(-3), STAR(-2), BLACK(-1), WHITE(0);
+
+ public int value;
+
+ StarBattleCell(int value) {
+ this.value = value;
+ }
+}
+
+//StarBattleExporter.java
+//StarBattleImporter.java
+//StarBattleView.java
+
+How to run Legup:
+
+./gradlew build
+Java -jar build/libs/Legup.jar
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/BlackTile.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/BlackTile.java
index c4bbf7297..99f42886e 100644
--- a/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/BlackTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/BlackTile.java
@@ -1,8 +1,8 @@
package edu.rpi.legup.puzzle.starbattle.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class BlackTile extends PlaceableElement {
+public class BlackTile extends NonPlaceableElement {
public BlackTile() {
super(
"STBL-PLAC-0002",
diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/StarTile.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/StarTile.java
index 793d4dbeb..13ada3f4d 100644
--- a/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/StarTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/StarTile.java
@@ -1,8 +1,8 @@
package edu.rpi.legup.puzzle.starbattle.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class StarTile extends PlaceableElement {
+public class StarTile extends NonPlaceableElement {
public StarTile() {
super(
"STBL-PLAC-0001",
diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/UnknownTile.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/UnknownTile.java
index 30921de8d..425fb5d5e 100644
--- a/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/UnknownTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/UnknownTile.java
@@ -1,8 +1,8 @@
package edu.rpi.legup.puzzle.starbattle.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class UnknownTile extends PlaceableElement {
+public class UnknownTile extends NonPlaceableElement {
public UnknownTile() {
super(
"STBL-UNPL-0001",
diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/starbattle_elements_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/starbattle_elements_reference_sheet.txt
deleted file mode 100644
index 82352bd04..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/starbattle/elements/starbattle_elements_reference_sheet.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-STBL-ELEM-0001 : BlackTile
-STBL-ELEM-0002 : StarTile
-STBL-ELEM-0003 : UnknownTile
-STBL-ELEM-0004 : WhiteTile
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/StarOrEmptyCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/StarOrEmptyCaseRule.java
index efd86bd7b..df900dcd5 100644
--- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/StarOrEmptyCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/StarOrEmptyCaseRule.java
@@ -84,10 +84,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
-
Board case1 = board.copy();
PuzzleElement data1 = case1.getPuzzleElement(puzzleElement);
data1.setData(StarBattleCellType.STAR.value);
diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/starbattle_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/starbattle_reference_sheet.txt
new file mode 100644
index 000000000..f18965fd6
--- /dev/null
+++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/starbattle_reference_sheet.txt
@@ -0,0 +1,19 @@
+Case Rules:
+Add Star: STBL-CASE-0001
+Star or Empty: STBL-CASE-0002
+
+Basic Rules:
+Blackout: STBL-BASC-0001
+Columns Within Regions: STBL-BASC-0002
+Columns Within Rows: STBL-BASC-0003
+Finish With Stars: STBL-BASC-0004
+Regions Within Columns: STBL-BASC-0005
+Regions Within Rows: STBL-BASC-0006
+Rows Within Columns: STBL-BASC-0007
+Rows Within Regions: STBL-BASC-0008
+Surround Star: STBL-BASC-0009
+
+Contradiction Rules:
+Too Many Stars: STBL-CONT-0001
+Too Few Stars: STBL-CONT-0002
+Clashing Orbit: STBL-CONT-0003
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/ModelSudokuBoard.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/ModelSudokuBoard.java
deleted file mode 100644
index f7893ca32..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/ModelSudokuBoard.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package edu.rpi.legup.puzzle.sudoku;
-
-public class ModelSudokuBoard {
- public int getModelRegionNumbers(int index) {
- int columnMod = index % 3 + 1;
- int rowMod = ((index / 9) % 3) * 3;
- return columnMod + rowMod;
- }
-
- public int getModelRowNumbers(int index) {
- return index % 9 + 1;
- }
-
- public int getModelColumnNumbers(int index) {
- return index / 9 + 1;
- }
-}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/PossibleNumberCaseBoard.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/PossibleNumberCaseBoard.java
index c5f9eec2a..0b6971235 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/PossibleNumberCaseBoard.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/PossibleNumberCaseBoard.java
@@ -2,7 +2,7 @@
import edu.rpi.legup.model.gameboard.CaseBoard;
import edu.rpi.legup.model.gameboard.PuzzleElement;
-import edu.rpi.legup.puzzle.sudoku.rules.PossibleCellsForNumberRegionCaseRule;
+import edu.rpi.legup.puzzle.sudoku.rules.PossibleNumberCaseRule;
import java.awt.event.MouseEvent;
import java.util.HashSet;
import java.util.Set;
@@ -15,7 +15,7 @@ public class PossibleNumberCaseBoard extends CaseBoard {
private Set pickableCols;
public PossibleNumberCaseBoard(
- SudokuBoard baseBoard, PossibleCellsForNumberRegionCaseRule caseRule, SudokuCell cell) {
+ SudokuBoard baseBoard, PossibleNumberCaseRule caseRule, SudokuCell cell) {
super(baseBoard, caseRule);
this.cell = cell;
this.pickableRegions = new HashSet<>();
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/Sudoku.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/Sudoku.java
index c27269536..877c92665 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/Sudoku.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/Sudoku.java
@@ -29,8 +29,6 @@ public BoardView getBoardView() {
@Override
public void initializeView() {
boardView = new SudokuView((SudokuBoard) currentBoard);
- boardView.setBoard(currentBoard);
- addBoardListener(boardView);
}
/**
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuCell.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuCell.java
index 75e5820a0..da009a255 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuCell.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuCell.java
@@ -1,9 +1,7 @@
package edu.rpi.legup.puzzle.sudoku;
-import edu.rpi.legup.model.elements.Element;
import edu.rpi.legup.model.gameboard.GridCell;
import java.awt.*;
-import java.awt.event.MouseEvent;
import java.util.HashSet;
import java.util.Set;
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuCellController.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuCellController.java
index bcad1a0ce..9b24f13da 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuCellController.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuCellController.java
@@ -8,7 +8,7 @@ public class SudokuCellController extends ElementController {
@Override
public void changeCell(MouseEvent e, PuzzleElement data) {
SudokuCell cell = (SudokuCell) data;
-
+ System.out.print(111);
if (e.getButton() == MouseEvent.BUTTON1) {
if (e.isControlDown()) {
this.boardView
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuImporter.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuImporter.java
index 5084279c3..68bf1e795 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuImporter.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuImporter.java
@@ -110,6 +110,16 @@ public void initializeBoard(Node node) throws InvalidFileFormatException {
}
}
}
+ //
+ // for(int y = 0; y < size; y++)
+ // {
+ // for(int x = 0; x < size; x++)
+ // {
+ // SudokuCell cell = sudokuBoard.getCell(x, y);
+ // System.err.println("(" + x + ", " + y + ") - " +
+ // cell.getGroupIndex());
+ // }
+ // }
puzzle.setCurrentBoard(sudokuBoard);
} catch (NumberFormatException e) {
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuView.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuView.java
index 474feb342..9e8dc82ff 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuView.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/SudokuView.java
@@ -30,7 +30,6 @@ public SudokuView(SudokuBoard board) {
// i * elementSize.height);
SudokuElementView element = new SudokuElementView(board.getCell(k, i));
element.setIndex(i * gridSize.width + k);
- element.setIndex(i * gridSize.width);
element.setSize(elementSize);
element.setLocation(location);
elementViews.add(element);
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/elements/NumberTile.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/elements/NumberTile.java
index a94d10e64..a75f32c5a 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/elements/NumberTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/elements/NumberTile.java
@@ -3,11 +3,10 @@
import edu.rpi.legup.model.elements.PlaceableElement;
public class NumberTile extends PlaceableElement {
+ private int object_num;
+
public NumberTile() {
- super(
- "SUDO-ELEM-0001",
- "Number Tile",
- "A number tile",
- "edu/rpi/legup/images/sudoku/tiles/NumberTile.png");
+ super("SUDO-PLAC-0001", "Number Tile", "A numbered tile", null);
+ object_num = 0;
}
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/elements/sudoku_elements_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/sudoku/elements/sudoku_elements_reference_sheet.txt
deleted file mode 100644
index b8df27eb6..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/elements/sudoku_elements_reference_sheet.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-SUDO-ELEM-0001 : NumberTile
-SUDO-ELEM-0002 : UnknownTile
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/AdvancedDeductionDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/AdvancedDeductionDirectRule.java
new file mode 100644
index 000000000..190679b41
--- /dev/null
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/AdvancedDeductionDirectRule.java
@@ -0,0 +1,99 @@
+package edu.rpi.legup.puzzle.sudoku.rules;
+
+import edu.rpi.legup.model.gameboard.Board;
+import edu.rpi.legup.model.gameboard.PuzzleElement;
+import edu.rpi.legup.model.rules.DirectRule;
+import edu.rpi.legup.model.tree.TreeNode;
+import edu.rpi.legup.model.tree.TreeTransition;
+import edu.rpi.legup.puzzle.sudoku.SudokuBoard;
+import edu.rpi.legup.puzzle.sudoku.SudokuCell;
+
+public class AdvancedDeductionDirectRule extends DirectRule {
+
+ public AdvancedDeductionDirectRule() {
+ super(
+ "SUDO-BASC-0001",
+ "Advanced Deduction",
+ "Use of group logic deduces more answers by means of forced by Location and forced"
+ + " by Deduction",
+ "edu/rpi/legup/images/sudoku/AdvancedDeduction.png");
+ }
+
+ /**
+ * Checks whether the child node logically follows from the parent node at the specific
+ * puzzleElement index using this rule
+ *
+ * @param transition transition to check
+ * @param puzzleElement equivalent puzzleElement
+ * @return null if the child node logically follow from the parent node at the specified
+ * puzzleElement, otherwise error message
+ */
+ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) {
+ SudokuBoard initialBoard = (SudokuBoard) transition.getParents().get(0).getBoard();
+ SudokuBoard finalBoard = (SudokuBoard) transition.getBoard();
+
+ SudokuCell cell = (SudokuCell) finalBoard.getPuzzleElement(puzzleElement);
+ int index = cell.getIndex();
+ int groupSize = initialBoard.getWidth();
+ int groupDim = (int) Math.sqrt(groupSize);
+ int rowIndex = index / groupSize;
+ int colIndex = index % groupSize;
+ int relX = rowIndex / groupDim;
+ int relY = colIndex % groupDim;
+ int groupNum = rowIndex / groupDim * groupDim + colIndex / groupDim;
+ boolean[][] possible = new boolean[groupDim][groupDim];
+ for (int y = 0; y < groupDim; y++) {
+ for (int x = 0; x < groupDim; x++) {
+ SudokuCell c = initialBoard.getCell(groupNum, x, y);
+ if (c.getData() == cell.getData() && x != relX && y != relY) {
+ return super.getRuleName() + ": Duplicate value in sub-region";
+ }
+ possible[y][x] = c.getData() == 0;
+ }
+ }
+ for (int y = 0; y < groupDim; y++) {
+ for (int x = 0; x < groupSize; x++) {
+ SudokuCell r = initialBoard.getCell(x, (groupNum / groupDim) * groupDim + y);
+ SudokuCell c = initialBoard.getCell((groupNum % groupDim) * groupDim + y, x);
+ if (r.getData() == cell.getData()) {
+ for (int i = 0; i < groupDim; i++) {
+ possible[y][i] = false;
+ }
+ }
+ if (c.getData() == cell.getData()) {
+ for (int i = 0; i < groupDim; i++) {
+ possible[i][y] = false;
+ }
+ }
+ }
+ }
+ boolean isForced = false;
+ for (int y = 0; y < groupDim; y++) {
+ for (int x = 0; x < groupDim; x++) {
+ if (possible[y][x] && !isForced) {
+ isForced = true;
+ } else {
+ if (possible[y][x]) {
+ return super.getInvalidUseOfRuleMessage() + ": Not forced";
+ }
+ }
+ }
+ }
+ if (!isForced) {
+ return super.getInvalidUseOfRuleMessage() + ": Not forced";
+ }
+ return null;
+ }
+
+ /**
+ * Creates a transition {@link Board} that has this rule applied to it using the {@link
+ * TreeNode}.
+ *
+ * @param node tree node used to create default transition board
+ * @return default board or null if this rule cannot be applied to this tree node
+ */
+ @Override
+ public Board getDefaultBoard(TreeNode node) {
+ return null;
+ }
+}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/LastCellForNumberDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/LastCellForNumberDirectRule.java
index 6544bf7c3..fd03ef36c 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/LastCellForNumberDirectRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/LastCellForNumberDirectRule.java
@@ -15,7 +15,7 @@ public LastCellForNumberDirectRule() {
"SUDO-BASC-0002",
"Last Cell for Number",
"This is the only cell open in its group for some number.",
- "edu/rpi/legup/images/sudoku/rules/forcedByElimination.png");
+ "edu/rpi/legup/images/sudoku/forcedByElimination.png");
}
/**
@@ -32,146 +32,52 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem
SudokuBoard finalBoard = (SudokuBoard) transition.getBoard();
SudokuCell cell = (SudokuCell) finalBoard.getPuzzleElement(puzzleElement);
-
- // Check if empty cell placed
if (cell.getData() == 0) {
return super.getInvalidUseOfRuleMessage() + ": Cell is not forced at this index";
}
- // Get defaults
+ int size = initialBoard.getSize();
+
Set region = initialBoard.getRegion(cell.getGroupIndex());
Set row = initialBoard.getRow(cell.getLocation().y);
Set col = initialBoard.getCol(cell.getLocation().x);
- // Check if new cell conflicts group
- for (SudokuCell c : region) {
- if (c.getData() == cell.getData()) {
- return super.getInvalidUseOfRuleMessage() + ": Cell is not forced at this index";
- }
- }
- for (SudokuCell c : row) {
- if (c.getData() == cell.getData()) {
- return super.getInvalidUseOfRuleMessage() + ": Cell is not forced at this index";
- }
- }
- for (SudokuCell c : col) {
- if (c.getData() == cell.getData()) {
- return super.getInvalidUseOfRuleMessage() + ": Cell is not forced at this index";
- }
- }
-
- // //
- // Loop to see if the number is constrained to the cell
- boolean restrained = true;
- for (SudokuCell c : region) {
- // Test if its not a valid testing cell
- if (c.getData() != 0) {
- continue;
- }
- if (c.getLocation().y == cell.getLocation().y
- && c.getLocation().x == cell.getLocation().x) {
- continue;
- }
- // Check if cell is eligible to hold number
- Set crow = initialBoard.getRow(c.getLocation().y);
- Set ccol = initialBoard.getCol(c.getLocation().x);
- boolean contains = false;
- for (SudokuCell rc : crow) {
- if (rc.getData() == cell.getData()) {
+ boolean contains = false;
+ if (region.size() == size - 1) {
+ for (SudokuCell c : region) {
+ if (cell.getData() == c.getData()) {
contains = true;
+ break;
}
}
- for (SudokuCell cc : ccol) {
- if (cc.getData() == cell.getData()) {
- contains = true;
- }
- }
- // Stop if another cell can hold number
if (!contains) {
- restrained = false;
- break;
+ return null;
}
}
- // Output if success
- if (restrained) {
- return null;
- }
-
- // //
- // Loop to see if the number is constrained to the cell
- restrained = true;
- for (SudokuCell c : row) {
- // Test if its not a valid testing cell
- if (c.getData() != 0) {
- continue;
- }
- if (c.getLocation().y == cell.getLocation().y
- && c.getLocation().x == cell.getLocation().x) {
- continue;
- }
- // Check if cell is eligible to hold number
- Set cregion = initialBoard.getRegion(c.getGroupIndex());
- Set ccol = initialBoard.getCol(c.getLocation().x);
- boolean contains = false;
- for (SudokuCell rc : cregion) {
- if (rc.getData() == cell.getData()) {
- contains = true;
- }
- }
- for (SudokuCell cc : ccol) {
- if (cc.getData() == cell.getData()) {
+ if (row.size() == size - 1) {
+ contains = false;
+ for (SudokuCell c : row) {
+ if (cell.getData() == c.getData()) {
contains = true;
+ break;
}
}
- // Stop if another cell can hold number
if (!contains) {
- restrained = false;
- break;
+ return null;
}
}
- // Output if success
- if (restrained) {
- return null;
- }
-
- // //
- // Loop to see if the number is constrained to the cell
- restrained = true;
- for (SudokuCell c : col) {
- // Test if its not a valid testing cell
- if (c.getData() != 0) {
- continue;
- }
- if (c.getLocation().y == cell.getLocation().y
- && c.getLocation().x == cell.getLocation().x) {
- continue;
- }
- // Check if cell is eligible to hold number
- Set cregion = initialBoard.getRegion(c.getGroupIndex());
- Set crow = initialBoard.getRow(c.getLocation().y);
- boolean contains = false;
- for (SudokuCell rc : cregion) {
- if (rc.getData() == cell.getData()) {
+ if (col.size() == size - 1) {
+ contains = false;
+ for (SudokuCell c : col) {
+ if (cell.getData() == c.getData()) {
contains = true;
+ break;
}
}
- for (SudokuCell cc : crow) {
- if (cc.getData() == cell.getData()) {
- contains = true;
- }
- }
- // Stop if another cell can hold number
if (!contains) {
- restrained = false;
- break;
+ return null;
}
}
- // Output if success
- if (restrained) {
- return null;
- }
-
- // Output fail
return super.getInvalidUseOfRuleMessage() + ": Cell is not forced at this index";
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/LastNumberForCellDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/LastNumberForCellDirectRule.java
index 333d91749..ca0ac3023 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/LastNumberForCellDirectRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/LastNumberForCellDirectRule.java
@@ -16,7 +16,7 @@ public LastNumberForCellDirectRule() {
"SUDO-BASC-0003",
"Last Number for Cell",
"This is the only number left that can fit in the cell of a group.",
- "edu/rpi/legup/images/sudoku/rules/forcedByDeduction.png");
+ "edu/rpi/legup/images/sudoku/forcedByDeduction.png");
}
/**
@@ -32,37 +32,28 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem
SudokuBoard initialBoard = (SudokuBoard) transition.getParents().get(0).getBoard();
SudokuBoard finalBoard = (SudokuBoard) transition.getBoard();
- // Assign basics
+ int index = puzzleElement.getIndex();
int groupSize = initialBoard.getWidth();
int groupDim = (int) Math.sqrt(groupSize);
-
- // Get position info
- int index = puzzleElement.getIndex();
int rowIndex = index / groupSize;
int colIndex = index % groupSize;
- int groupNum = (rowIndex / groupDim) * groupDim + (colIndex / groupDim);
-
- // Create hashset of all numbers
+ int groupNum = rowIndex / groupDim * groupDim + colIndex % groupDim;
HashSet numbers = new HashSet<>();
for (int i = 1; i <= groupSize; i++) {
numbers.add(i);
}
-
- // Run through region, row, col to see contradicitng numbers
for (int i = 0; i < groupSize; i++) {
SudokuCell cell = initialBoard.getCell(groupNum, i % groupDim, i / groupDim);
numbers.remove(cell.getData());
}
for (int i = 0; i < groupSize; i++) {
- SudokuCell cell = initialBoard.getCell(i, rowIndex);
+ SudokuCell cell = initialBoard.getCell(i, colIndex);
numbers.remove(cell.getData());
}
for (int i = 0; i < groupSize; i++) {
- SudokuCell cell = initialBoard.getCell(colIndex, i);
+ SudokuCell cell = initialBoard.getCell(rowIndex, i);
numbers.remove(cell.getData());
}
-
- // Check if plausible
if (numbers.size() > 1) {
return super.getInvalidUseOfRuleMessage() + ": The number at the index is not forced";
} else {
@@ -73,11 +64,7 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem
+ ": The number at the index is forced but not correct";
}
}
- if (numbers.toArray(new Integer[1])[0] == puzzleElement.getData()) {
- return null;
- }
- return super.getInvalidUseOfRuleMessage()
- + ": The number at the index is forced but not correct";
+ return null;
}
/**
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoCellForNumberColumnContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoCellForNumberColumnContradictionRule.java
deleted file mode 100644
index c8d627634..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoCellForNumberColumnContradictionRule.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package edu.rpi.legup.puzzle.sudoku.rules;
-
-import edu.rpi.legup.model.gameboard.Board;
-import edu.rpi.legup.model.gameboard.PuzzleElement;
-import edu.rpi.legup.model.rules.ContradictionRule;
-import edu.rpi.legup.puzzle.sudoku.SudokuBoard;
-import edu.rpi.legup.puzzle.sudoku.SudokuCell;
-import java.util.HashSet;
-import java.util.Set;
-
-public class NoCellForNumberColumnContradictionRule extends ContradictionRule {
-
- public NoCellForNumberColumnContradictionRule() {
- super(
- "SUDO-CONT-0003",
- "No Cell for Number (Column)",
- "Process of elimination yields no valid numbers for an empty cell in a column.",
- "edu/rpi/legup/images/sudoku/rules/NoCellForNumberColumn.png");
- }
-
- /**
- * Checks whether the transition has a contradiction at the specific puzzleElement index using
- * this rule
- *
- * @param board board to check contradiction
- * @param puzzleElement equivalent puzzleElement
- * @return null if the transition contains a contradiction at the specified puzzleElement,
- * otherwise error message
- */
- @Override
- public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
- SudokuBoard sudokuBoard = (SudokuBoard) board;
- SudokuCell cell = (SudokuCell) sudokuBoard.getPuzzleElement(puzzleElement);
- if (cell.getData() != 0) {
- return super.getNoContradictionMessage();
- }
-
- int groupSize = sudokuBoard.getSize();
-
- Set col = sudokuBoard.getCol(cell.getGroupIndex());
- Set numbersNotInColumn = new HashSet<>();
-
- for (int i = 1; i <= groupSize; i++) {
- numbersNotInColumn.add(i);
- }
- for (SudokuCell c : col) {
- if (c.getData() != 0) {
- numbersNotInColumn.remove(c.getData());
- }
- }
-
- for (Integer i : numbersNotInColumn) {
- // Check if number can be in cell
- boolean canFit = false;
- for (SudokuCell c : col) {
- if (c.getData() != 0) {
- continue;
- }
-
- // Get row and col groups
- Set region = sudokuBoard.getRow(c.getLocation().y);
- Set row = sudokuBoard.getCol(c.getLocation().x);
-
- // Check if it alr exists in row or col
- boolean duplicate = false;
- for (SudokuCell rc : region) {
- if (rc.getData() == i) {
- duplicate = true;
- }
- }
- for (SudokuCell cc : row) {
- if (cc.getData() == i) {
- duplicate = true;
- }
- }
-
- // If there is no duplicate it can exist in the region
- if (!duplicate) {
- canFit = true;
- break;
- }
- }
- // If the number can't fit anywhere in region then contradiction
- if (!canFit) {
- return null;
- }
- }
- return super.getNoContradictionMessage();
- }
-}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoCellForNumberRegionContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoCellForNumberRegionContradictionRule.java
deleted file mode 100644
index f5106b858..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoCellForNumberRegionContradictionRule.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package edu.rpi.legup.puzzle.sudoku.rules;
-
-import edu.rpi.legup.model.gameboard.Board;
-import edu.rpi.legup.model.gameboard.PuzzleElement;
-import edu.rpi.legup.model.rules.ContradictionRule;
-import edu.rpi.legup.puzzle.sudoku.SudokuBoard;
-import edu.rpi.legup.puzzle.sudoku.SudokuCell;
-import java.util.HashSet;
-import java.util.Set;
-
-public class NoCellForNumberRegionContradictionRule extends ContradictionRule {
-
- public NoCellForNumberRegionContradictionRule() {
- super(
- "SUDO-CONT-0001",
- "No Cell for Number (Region)",
- "Process of elimination yields no valid numbers for an empty cell in a region.",
- "edu/rpi/legup/images/sudoku/rules/NoCellForNumberRegion.png");
- }
-
- /**
- * Checks whether the transition has a contradiction at the specific puzzleElement index using
- * this rule
- *
- * @param board board to check contradiction
- * @param puzzleElement equivalent puzzleElement
- * @return null if the transition contains a contradiction at the specified puzzleElement,
- * otherwise error message
- */
- @Override
- public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
- SudokuBoard sudokuBoard = (SudokuBoard) board;
- SudokuCell cell = (SudokuCell) sudokuBoard.getPuzzleElement(puzzleElement);
- if (cell.getData() != 0) {
- return super.getNoContradictionMessage();
- }
-
- int groupSize = sudokuBoard.getSize();
-
- Set region = sudokuBoard.getRegion(cell.getGroupIndex());
- Set numbersNotInRegion = new HashSet<>();
-
- for (int i = 1; i <= groupSize; i++) {
- numbersNotInRegion.add(i);
- }
- for (SudokuCell c : region) {
- if (c.getData() != 0) {
- numbersNotInRegion.remove(c.getData());
- }
- }
-
- for (Integer i : numbersNotInRegion) {
- // Check if number can be in cell
- boolean canFit = false;
- for (SudokuCell c : region) {
- if (c.getData() != 0) {
- continue;
- }
-
- // Get row and col groups
- Set row = sudokuBoard.getRow(c.getLocation().y);
- Set col = sudokuBoard.getCol(c.getLocation().x);
-
- // Check if it alr exists in row or col
- boolean duplicate = false;
- for (SudokuCell rc : row) {
- if (rc.getData() == i) {
- duplicate = true;
- }
- }
- for (SudokuCell cc : col) {
- if (cc.getData() == i) {
- duplicate = true;
- }
- }
-
- // If there is no duplicate it can exist in the region
- if (!duplicate) {
- canFit = true;
- break;
- }
- }
- // If the number can't fit anywhere in region then contradiction
- if (!canFit) {
- return null;
- }
- }
- return super.getNoContradictionMessage();
- }
-}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoCellForNumberRowContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoCellForNumberRowContradictionRule.java
deleted file mode 100644
index e3f9f764a..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoCellForNumberRowContradictionRule.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package edu.rpi.legup.puzzle.sudoku.rules;
-
-import edu.rpi.legup.model.gameboard.Board;
-import edu.rpi.legup.model.gameboard.PuzzleElement;
-import edu.rpi.legup.model.rules.ContradictionRule;
-import edu.rpi.legup.puzzle.sudoku.SudokuBoard;
-import edu.rpi.legup.puzzle.sudoku.SudokuCell;
-import java.util.HashSet;
-import java.util.Set;
-
-public class NoCellForNumberRowContradictionRule extends ContradictionRule {
-
- public NoCellForNumberRowContradictionRule() {
- super(
- "SUDO-CONT-0002",
- "No Cell for Number (Row)",
- "Process of elimination yields no valid numbers for an empty cell in a row.",
- "edu/rpi/legup/images/sudoku/rules/NoCellForNumberRow.png");
- }
-
- /**
- * Checks whether the transition has a contradiction at the specific puzzleElement index using
- * this rule
- *
- * @param board board to check contradiction
- * @param puzzleElement equivalent puzzleElement
- * @return null if the transition contains a contradiction at the specified puzzleElement,
- * otherwise error message
- */
- @Override
- public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
- SudokuBoard sudokuBoard = (SudokuBoard) board;
- SudokuCell cell = (SudokuCell) sudokuBoard.getPuzzleElement(puzzleElement);
- if (cell.getData() != 0) {
- return super.getNoContradictionMessage();
- }
-
- int groupSize = sudokuBoard.getSize();
-
- Set row = sudokuBoard.getRow(cell.getGroupIndex());
- Set numbersNotInRow = new HashSet<>();
-
- for (int i = 1; i <= groupSize; i++) {
- numbersNotInRow.add(i);
- }
- for (SudokuCell c : row) {
- if (c.getData() != 0) {
- numbersNotInRow.remove(c.getData());
- }
- }
-
- for (Integer i : numbersNotInRow) {
- // Check if number can be in cell
- boolean canFit = false;
- for (SudokuCell c : row) {
- if (c.getData() != 0) {
- continue;
- }
-
- // Get row and col groups
- Set region = sudokuBoard.getRow(c.getLocation().y);
- Set col = sudokuBoard.getCol(c.getLocation().x);
-
- // Check if it alr exists in row or col
- boolean duplicate = false;
- for (SudokuCell rc : region) {
- if (rc.getData() == i) {
- duplicate = true;
- }
- }
- for (SudokuCell cc : col) {
- if (cc.getData() == i) {
- duplicate = true;
- }
- }
-
- // If there is no duplicate it can exist in the region
- if (!duplicate) {
- canFit = true;
- break;
- }
- }
- // If the number can't fit anywhere in region then contradiction
- if (!canFit) {
- return null;
- }
- }
- return super.getNoContradictionMessage();
- }
-}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoNumberForCellContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoSolutionContradictionRule.java
similarity index 72%
rename from src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoNumberForCellContradictionRule.java
rename to src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoSolutionContradictionRule.java
index 6ea8f0a2a..e44728d3e 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoNumberForCellContradictionRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/NoSolutionContradictionRule.java
@@ -8,14 +8,14 @@
import java.util.HashSet;
import java.util.Set;
-public class NoNumberForCellContradictionRule extends ContradictionRule {
+public class NoSolutionContradictionRule extends ContradictionRule {
- public NoNumberForCellContradictionRule() {
+ public NoSolutionContradictionRule() {
super(
- "SUDO-CONT-0004",
- "No Number for Cell",
+ "SUDO-CONT-0001",
+ "No Solution for Cell",
"Process of elimination yields no valid numbers for an empty cell.",
- "edu/rpi/legup/images/sudoku/rules/NoSolution.png");
+ "edu/rpi/legup/images/sudoku/NoSolution.png");
}
/**
@@ -41,19 +41,21 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
Set row = sudokuBoard.getRow(cell.getLocation().y);
Set col = sudokuBoard.getCol(cell.getLocation().x);
Set solution = new HashSet<>();
- for (SudokuCell s : region) {
- solution.add(s.getData());
- }
- for (SudokuCell s : row) {
- solution.add(s.getData());
+ for (int i = 1; i <= groupSize; i++) {
+ solution.add(i);
}
- for (SudokuCell s : col) {
- solution.add(s.getData());
+ for (SudokuCell c : region) {
+ solution.remove(c.getData());
+ }
+ for (SudokuCell c : row) {
+ solution.remove(c.getData());
+ }
+ for (SudokuCell c : col) {
+ solution.remove(c.getData());
}
- solution.remove(0);
- if (solution.size() == 9) {
+ if (solution.isEmpty()) {
return null;
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleNumbersForCellCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellCaseRule.java
similarity index 59%
rename from src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleNumbersForCellCaseRule.java
rename to src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellCaseRule.java
index e17acc26b..fb6da62d4 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleNumbersForCellCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellCaseRule.java
@@ -5,18 +5,19 @@
import edu.rpi.legup.model.gameboard.PuzzleElement;
import edu.rpi.legup.model.rules.CaseRule;
import edu.rpi.legup.model.tree.TreeTransition;
-import edu.rpi.legup.puzzle.sudoku.*;
+import edu.rpi.legup.puzzle.sudoku.SudokuBoard;
+import edu.rpi.legup.puzzle.sudoku.SudokuCell;
import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
-public class PossibleNumbersForCellCaseRule extends CaseRule {
-
- public PossibleNumbersForCellCaseRule() {
+public class PossibleCellCaseRule extends CaseRule {
+ public PossibleCellCaseRule() {
super(
"SUDO-CASE-0001",
- "Possible Numbers for Cell",
- "An empty cell has a limited set of possible numbers that can fill it.",
- "edu/rpi/legup/images/sudoku/rules/PossibleValues.png");
+ "Possible Cells for Number",
+ "A number has a limited set of cells in which it can be placed.",
+ "edu/rpi/legup/images/sudoku/possible_cells_number.png");
}
/**
@@ -65,34 +66,42 @@ public CaseBoard getCaseBoard(Board board) {
*/
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
- return getCases(board, puzzleElement, 1, GroupType.REGION);
- }
-
- /**
- * Gets the possible cases at a specific location based on this case rule
- *
- * @param board the current board state
- * @param puzzleElement equivalent puzzleElement
- * @param value value that the rule will be applied from
- * @param groupType group type
- * @return a list of elements the specified could be
- */
- public ArrayList getCases(
- Board board, PuzzleElement puzzleElement, int value, GroupType groupType) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
-
SudokuBoard sudokuBoard = (SudokuBoard) board;
- List caseCells = new ArrayList<>();
SudokuCell cell = (SudokuCell) puzzleElement;
- for (int i = 1; i <= 9; i++) {
- Board newCase = sudokuBoard.copy();
- PuzzleElement element = newCase.getPuzzleElement(puzzleElement);
- element.setData(i);
- newCase.addModifiedData(element);
+ Set possibleValue = new HashSet<>();
+ for (int i = 1; i <= sudokuBoard.getSize(); i++) {
+ possibleValue.add(i);
+ }
+
+ int groupNum = cell.getGroupIndex();
+ for (SudokuCell c : sudokuBoard.getRegion(groupNum)) {
+ if (c.getData().equals(c.getData())) {
+ possibleValue.remove(c.getData());
+ }
+ }
+
+ int rowNum = cell.getLocation().y;
+ for (SudokuCell c : sudokuBoard.getRegion(rowNum)) {
+ if (c.getData().equals(c.getData())) {
+ possibleValue.remove(c.getData());
+ }
+ }
+
+ int colNum = cell.getLocation().x;
+ for (SudokuCell c : sudokuBoard.getRegion(colNum)) {
+ if (c.getData().equals(c.getData())) {
+ possibleValue.remove(c.getData());
+ }
+ }
+
+ for (Integer i : possibleValue) {
+ SudokuBoard newCase = sudokuBoard.copy();
+
+ PuzzleElement newCasePuzzleElement = newCase.getPuzzleElement(puzzleElement);
+ newCasePuzzleElement.setData(i);
+ newCase.addModifiedData(newCasePuzzleElement);
cases.add(newCase);
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellsForNumberRegionCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellsForNumberRegionCaseRule.java
deleted file mode 100644
index 47e408369..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellsForNumberRegionCaseRule.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package edu.rpi.legup.puzzle.sudoku.rules;
-
-import edu.rpi.legup.model.gameboard.Board;
-import edu.rpi.legup.model.gameboard.CaseBoard;
-import edu.rpi.legup.model.gameboard.PuzzleElement;
-import edu.rpi.legup.model.rules.CaseRule;
-import edu.rpi.legup.model.tree.TreeTransition;
-import edu.rpi.legup.puzzle.sudoku.*;
-import java.util.ArrayList;
-import java.util.Set;
-
-public class PossibleCellsForNumberRegionCaseRule extends CaseRule {
-
- // Board math for translating indexes to numbers
- private ModelSudokuBoard model = new ModelSudokuBoard();
-
- // Old board for caseBoard reference
- private SudokuBoard lagBoard;
-
- public PossibleCellsForNumberRegionCaseRule() {
- super(
- "SUDO-CASE-0002",
- "Possible Cells for Number - Region",
- "An empty cell has a limited set of possible numbers that can fill it.",
- "edu/rpi/legup/images/sudoku/rules/possible_cells_number_region.png");
- }
-
- /**
- * Checks whether the transition logically follows from the parent node using this rule
- *
- * @param transition transition to check
- * @return null if the child node logically follow from the parent node, otherwise error message
- */
- @Override
- public String checkRuleRaw(TreeTransition transition) {
- return null;
- }
-
- /**
- * Checks whether the child node logically follows from the parent node at the specific
- * puzzleElement index using this rule
- *
- * @param transition transition to check
- * @param puzzleElement equivalent puzzleElement
- * @return null if the child node logically follow from the parent node at the specified
- * puzzleElement, otherwise error message
- */
- @Override
- public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) {
- return null;
- }
-
- @Override
- public CaseBoard getCaseBoard(Board board) {
- SudokuBoard sudokuBoard = (SudokuBoard) board.copy();
- lagBoard = (SudokuBoard) sudokuBoard.copy();
- CaseBoard caseBoard = new CaseBoard(sudokuBoard, this);
- for (PuzzleElement puzzleElement : sudokuBoard.getPuzzleElements()) {
- puzzleElement.setData(model.getModelRegionNumbers(puzzleElement.getIndex()));
- caseBoard.addPickableElement(puzzleElement);
- }
- return caseBoard;
- }
-
- /**
- * Gets the possible cases at a specific location based on this case rule
- *
- * @param board the current board state
- * @param puzzleElement equivalent puzzleElement
- * @return a list of elements the specified could be
- */
- @Override
- public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
- return getCases(board, puzzleElement, 1, GroupType.REGION);
- }
-
- /**
- * Gets the possible cases at a specific location based on this case rule
- *
- * @param board the current board state
- * @param puzzleElement equivalent puzzleElement
- * @param value value that the rule will be applied from
- * @param groupType group type
- * @return a list of elements the specified could be
- */
- public ArrayList getCases(
- Board board, PuzzleElement puzzleElement, int value, GroupType groupType) {
- ArrayList cases = new ArrayList<>();
- SudokuBoard sudokuBoard = lagBoard;
- SudokuCell sourceCell = (SudokuCell) puzzleElement;
-
- Set group = sudokuBoard.getRegion(sourceCell.getGroupIndex());
- for (SudokuCell cell : group) {
- if (cell.getData() == 0) {
- Board newCase = sudokuBoard.copy();
- PuzzleElement element = newCase.getPuzzleElement(cell);
- element.setData(model.getModelRegionNumbers(sourceCell.getIndex()));
- newCase.addModifiedData(element);
- cases.add(newCase);
- }
- }
- return cases;
- }
-}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellsForNumberRowCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellsForNumberRowCaseRule.java
deleted file mode 100644
index 868541377..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellsForNumberRowCaseRule.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package edu.rpi.legup.puzzle.sudoku.rules;
-
-import edu.rpi.legup.model.gameboard.Board;
-import edu.rpi.legup.model.gameboard.CaseBoard;
-import edu.rpi.legup.model.gameboard.PuzzleElement;
-import edu.rpi.legup.model.rules.CaseRule;
-import edu.rpi.legup.model.tree.TreeTransition;
-import edu.rpi.legup.puzzle.sudoku.GroupType;
-import edu.rpi.legup.puzzle.sudoku.ModelSudokuBoard;
-import edu.rpi.legup.puzzle.sudoku.SudokuBoard;
-import edu.rpi.legup.puzzle.sudoku.SudokuCell;
-import java.util.ArrayList;
-import java.util.Set;
-
-public class PossibleCellsForNumberRowCaseRule extends CaseRule {
-
- // Board math for translating indexes to numbers
- private ModelSudokuBoard model = new ModelSudokuBoard();
-
- // Old board for caseBoard reference
- private SudokuBoard lagBoard;
-
- public PossibleCellsForNumberRowCaseRule() {
- super(
- "SUDO-CASE-0003",
- "Possible Cells for Number - Row",
- "An empty cell has a limited set of possible numbers that can fill it.",
- "edu/rpi/legup/images/sudoku/rules/possible_cells_number_row.png");
- }
-
- /**
- * Checks whether the transition logically follows from the parent node using this rule
- *
- * @param transition transition to check
- * @return null if the child node logically follow from the parent node, otherwise error message
- */
- @Override
- public String checkRuleRaw(TreeTransition transition) {
- return null;
- }
-
- /**
- * Checks whether the child node logically follows from the parent node at the specific
- * puzzleElement index using this rule
- *
- * @param transition transition to check
- * @param puzzleElement equivalent puzzleElement
- * @return null if the child node logically follow from the parent node at the specified
- * puzzleElement, otherwise error message
- */
- @Override
- public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) {
- return null;
- }
-
- @Override
- public CaseBoard getCaseBoard(Board board) {
- SudokuBoard sudokuBoard = (SudokuBoard) board.copy();
- lagBoard = (SudokuBoard) sudokuBoard.copy();
- CaseBoard caseBoard = new CaseBoard(sudokuBoard, this);
- for (PuzzleElement puzzleElement : sudokuBoard.getPuzzleElements()) {
- puzzleElement.setData(model.getModelRowNumbers(puzzleElement.getIndex()));
- caseBoard.addPickableElement(puzzleElement);
- }
- return caseBoard;
- }
-
- /**
- * Gets the possible cases at a specific location based on this case rule
- *
- * @param board the current board state
- * @param puzzleElement equivalent puzzleElement
- * @return a list of elements the specified could be
- */
- @Override
- public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
- return getCases(board, puzzleElement, 1, GroupType.ROW);
- }
-
- /**
- * Gets the possible cases at a specific location based on this case rule
- *
- * @param board the current board state
- * @param puzzleElement equivalent puzzleElement
- * @param value value that the rule will be applied from
- * @param groupType group type
- * @return a list of elements the specified could be
- */
- public ArrayList getCases(
- Board board, PuzzleElement puzzleElement, int value, GroupType groupType) {
- ArrayList cases = new ArrayList<>();
- SudokuBoard sudokuBoard = lagBoard;
- SudokuCell sourceCell = (SudokuCell) puzzleElement;
-
- Set group = sudokuBoard.getRow(sourceCell.getLocation().y);
- for (SudokuCell cell : group) {
- if (cell.getData() == 0) {
- Board newCase = sudokuBoard.copy();
- PuzzleElement element = newCase.getPuzzleElement(cell);
- element.setData(model.getModelRowNumbers(sourceCell.getIndex()));
- newCase.addModifiedData(element);
- cases.add(newCase);
- }
- }
- return cases;
- }
-}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellsForNumberColumnCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleNumberCaseRule.java
similarity index 53%
rename from src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellsForNumberColumnCaseRule.java
rename to src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleNumberCaseRule.java
index bab0bc79b..e6ab0e64c 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleCellsForNumberColumnCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/PossibleNumberCaseRule.java
@@ -6,26 +6,21 @@
import edu.rpi.legup.model.rules.CaseRule;
import edu.rpi.legup.model.tree.TreeTransition;
import edu.rpi.legup.puzzle.sudoku.GroupType;
-import edu.rpi.legup.puzzle.sudoku.ModelSudokuBoard;
+import edu.rpi.legup.puzzle.sudoku.PossibleNumberCaseBoard;
import edu.rpi.legup.puzzle.sudoku.SudokuBoard;
import edu.rpi.legup.puzzle.sudoku.SudokuCell;
import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
-public class PossibleCellsForNumberColumnCaseRule extends CaseRule {
+public class PossibleNumberCaseRule extends CaseRule {
- // Board math for translating indexes to numbers
- private ModelSudokuBoard model = new ModelSudokuBoard();
-
- // Old board for caseBoard reference
- private SudokuBoard lagBoard;
-
- public PossibleCellsForNumberColumnCaseRule() {
+ public PossibleNumberCaseRule() {
super(
- "SUDO-CASE-0004",
- "Possible Cells for Number - Column",
+ "SUDO-CASE-0002",
+ "Possible Numbers for Cell",
"An empty cell has a limited set of possible numbers that can fill it.",
- "edu/rpi/legup/images/sudoku/rules/possible_cells_number_column.png");
+ "edu/rpi/legup/images/sudoku/PossibleValues.png");
}
/**
@@ -55,12 +50,12 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem
@Override
public CaseBoard getCaseBoard(Board board) {
- SudokuBoard sudokuBoard = (SudokuBoard) board.copy();
- lagBoard = (SudokuBoard) sudokuBoard.copy();
- CaseBoard caseBoard = new CaseBoard(sudokuBoard, this);
- for (PuzzleElement puzzleElement : sudokuBoard.getPuzzleElements()) {
- puzzleElement.setData(model.getModelColumnNumbers(puzzleElement.getIndex()));
- caseBoard.addPickableElement(puzzleElement);
+ SudokuBoard sudokuBoard = (SudokuBoard) board;
+ PossibleNumberCaseBoard caseBoard = new PossibleNumberCaseBoard(sudokuBoard, this, null);
+ for (int i = 0; i < sudokuBoard.getSize(); i++) {
+ caseBoard.addPickableRegion(i);
+ caseBoard.addPickableRow(i);
+ caseBoard.addPickableCol(i);
}
return caseBoard;
}
@@ -74,7 +69,7 @@ public CaseBoard getCaseBoard(Board board) {
*/
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
- return getCases(board, puzzleElement, 1, GroupType.COLUMN);
+ return getCases(board, puzzleElement, 1, GroupType.REGION);
}
/**
@@ -89,19 +84,48 @@ public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
public ArrayList getCases(
Board board, PuzzleElement puzzleElement, int value, GroupType groupType) {
ArrayList cases = new ArrayList<>();
- SudokuBoard sudokuBoard = lagBoard;
- SudokuCell sourceCell = (SudokuCell) puzzleElement;
+ SudokuBoard sudokuBoard = (SudokuBoard) board;
+ List caseCells = new ArrayList<>();
+ SudokuCell cell = (SudokuCell) puzzleElement;
- Set group = sudokuBoard.getCol(sourceCell.getLocation().x);
- for (SudokuCell cell : group) {
- if (cell.getData() == 0) {
- Board newCase = sudokuBoard.copy();
- PuzzleElement element = newCase.getPuzzleElement(cell);
- element.setData(model.getModelColumnNumbers(sourceCell.getIndex()));
- newCase.addModifiedData(element);
- cases.add(newCase);
+ Set group;
+ if (groupType == GroupType.REGION) {
+ group = sudokuBoard.getRegion(cell.getGroupIndex());
+ } else {
+ if (groupType == GroupType.ROW) {
+ group = sudokuBoard.getRow(cell.getLocation().y);
+ } else {
+ group = sudokuBoard.getCol(cell.getLocation().x);
}
}
+
+ for (SudokuCell c : group) {
+ if (c.getData() == 0) {
+ Set blockableCells = sudokuBoard.getRegion(c.getGroupIndex());
+ blockableCells.addAll(sudokuBoard.getRow(c.getLocation().y));
+ blockableCells.addAll(sudokuBoard.getCol(c.getLocation().x));
+
+ boolean repeat = false;
+ for (SudokuCell bc : blockableCells) {
+ if (bc.getData() == value) {
+ repeat = true;
+ break;
+ }
+ }
+ if (!repeat) {
+ caseCells.add(c);
+ }
+ }
+ }
+
+ for (SudokuCell c : caseCells) {
+ Board newCase = sudokuBoard.copy();
+ PuzzleElement element = newCase.getPuzzleElement(c);
+ element.setData(value);
+ newCase.addModifiedData(element);
+ cases.add(newCase);
+ }
+
return cases;
}
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/RepeatedNumberContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/RepeatedNumberContradictionRule.java
index f8172d071..955414e8e 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/RepeatedNumberContradictionRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/RepeatedNumberContradictionRule.java
@@ -12,10 +12,10 @@ public class RepeatedNumberContradictionRule extends ContradictionRule {
public RepeatedNumberContradictionRule() {
super(
- "SUDO-CONT-0005",
+ "SUDO-CONT-0002",
"Repeated Numbers",
"Two identical numbers are placed in the same group.",
- "edu/rpi/legup/images/sudoku/rules/RepeatedNumber.png");
+ "edu/rpi/legup/images/sudoku/RepeatedNumber.png");
}
/**
@@ -29,51 +29,39 @@ public RepeatedNumberContradictionRule() {
*/
@Override
public String checkContradictionAt(Board board, PuzzleElement puzzleElement) {
- // Get board to check
SudokuBoard sudokuBoard = (SudokuBoard) board;
+ SudokuCell cell = (SudokuCell) sudokuBoard.getPuzzleElement(puzzleElement);
+ if (cell.getData() == 0) {
+ return super.getNoContradictionMessage();
+ }
- // Loop all group indexes
- for (int i = 0; i < 9; i++) {
- // Get regions and sets to check duplicates
- Set region = sudokuBoard.getRegion(i);
- Set regionDup = new HashSet<>();
-
- Set row = sudokuBoard.getRow(i);
- Set rowDup = new HashSet<>();
+ Set region = sudokuBoard.getRegion(cell.getGroupIndex());
+ Set row = sudokuBoard.getRow(cell.getLocation().y);
+ Set col = sudokuBoard.getCol(cell.getLocation().x);
- Set col = sudokuBoard.getCol(i);
- Set colDup = new HashSet<>();
+ Set regionDup = new HashSet<>();
+ Set rowDup = new HashSet<>();
+ Set colDup = new HashSet<>();
- // Check for non zero duplicates to trigger contradiction
- for (SudokuCell c : region) {
- if (c.getData() == 0) {
- continue;
- }
- if (regionDup.contains(c.getData())) {
- return null;
- }
- regionDup.add(c.getData());
+ for (SudokuCell c : region) {
+ if (regionDup.contains(c.getData())) {
+ return null;
}
+ regionDup.add(c.getData());
+ }
- for (SudokuCell c : row) {
- if (c.getData() == 0) {
- continue;
- }
- if (rowDup.contains(c.getData())) {
- return null;
- }
- rowDup.add(c.getData());
+ for (SudokuCell c : row) {
+ if (rowDup.contains(c.getData())) {
+ return null;
}
+ rowDup.add(c.getData());
+ }
- for (SudokuCell c : col) {
- if (c.getData() == 0) {
- continue;
- }
- if (colDup.contains(c.getData())) {
- return null;
- }
- colDup.add(c.getData());
+ for (SudokuCell c : col) {
+ if (colDup.contains(c.getData())) {
+ return null;
}
+ colDup.add(c.getData());
}
return super.getNoContradictionMessage();
diff --git a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/sudoku_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/sudoku_reference_sheet.txt
index ceffa168c..a8635330d 100644
--- a/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/sudoku_reference_sheet.txt
+++ b/src/main/java/edu/rpi/legup/puzzle/sudoku/rules/sudoku_reference_sheet.txt
@@ -1,13 +1,9 @@
+SUDO-BASC-0001 : AdvancedDeductionDirectRule
SUDO-BASC-0002 : LastCellForNumberDirectRule
SUDO-BASC-0003 : LastNumberForCellDirectRule
-SUDO-CONT-0001 : NoCellForNumberRegionContradictionRule
-SUDO-CONT-0002 : NoCellForNumberRowContradictionRule
-SUDO-CONT-0003 : NoCellForNumberColumnContradictionRule
-SUDO-CONT-0004 : NoNumberForCellContradictionRule
-SUDO-CONT-0005 : RepeatedNumberContradictionRule
+SUDO-CONT-0001 : NoSolutionContradictionRule
+SUDO-CONT-0002 : RepeatedNumberContradictionRule
-SUDO-CASE-0001 : PossibleNumbersForCellCaseRule
-SUDO-CASE-0002 : PossibleCellsForNumberRegionCaseRule
-SUDO-CASE-0003 : PossibleCellsForNumberRowCaseRule
-SUDO-CASE-0004 : PossibleCellsForNumberColumnCaseRule
\ No newline at end of file
+SUDO-CASE-0001 : PossibleCellCaseRule
+SUDO-CASE-0002 : PossibleNumberCaseRule
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/treetent/TreeTent.java b/src/main/java/edu/rpi/legup/puzzle/treetent/TreeTent.java
index 35993303a..5ec135a22 100644
--- a/src/main/java/edu/rpi/legup/puzzle/treetent/TreeTent.java
+++ b/src/main/java/edu/rpi/legup/puzzle/treetent/TreeTent.java
@@ -59,20 +59,7 @@ public boolean isValidDimensions(int rows, int columns) {
*/
@Override
public boolean isBoardComplete(Board board) {
- TreeTentBoard treeTentBoard = (TreeTentBoard) board;
-
- for (ContradictionRule rule : contradictionRules) {
- if (rule.checkContradiction(treeTentBoard) == null) {
- return false;
- }
- }
- for (PuzzleElement data : treeTentBoard.getPuzzleElements()) {
- TreeTentCell cell = (TreeTentCell) data;
- if (cell.getType() == TreeTentType.UNKNOWN) {
- return false;
- }
- }
- return true;
+ return false;
}
/**
diff --git a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/GrassTile.java b/src/main/java/edu/rpi/legup/puzzle/treetent/elements/GrassTile.java
index 1d33b9035..5356120a8 100644
--- a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/GrassTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/treetent/elements/GrassTile.java
@@ -6,7 +6,7 @@ public class GrassTile extends PlaceableElement {
public GrassTile() {
super(
- "TREE-ELEM-0001",
+ "TREE-PlAC-0002",
"Grass Tile",
"The grass crest tile",
"edu/rpi/legup/images/treetent/grass.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/TentTile.java b/src/main/java/edu/rpi/legup/puzzle/treetent/elements/TentTile.java
index 96124a98d..950aebfa7 100644
--- a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/TentTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/treetent/elements/TentTile.java
@@ -6,7 +6,7 @@ public class TentTile extends PlaceableElement {
public TentTile() {
super(
- "TREE-ELEM-0002",
+ "TREE-PLAC-0001",
"Tent Tile",
"The tent tile",
"edu/rpi/legup/images/treetent/tent.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/TreeTile.java b/src/main/java/edu/rpi/legup/puzzle/treetent/elements/TreeTile.java
index 3d94cbfba..d04886ed5 100644
--- a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/TreeTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/treetent/elements/TreeTile.java
@@ -1,12 +1,12 @@
package edu.rpi.legup.puzzle.treetent.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class TreeTile extends PlaceableElement {
+public class TreeTile extends NonPlaceableElement {
public TreeTile() {
super(
- "TREE-ELEM-0003",
+ "TREE-UNPL-0001",
"Tree Tile",
"The tree tile",
"edu/rpi/legup/images/treetent/tree.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/UnknownTile.java b/src/main/java/edu/rpi/legup/puzzle/treetent/elements/UnknownTile.java
index 99b75b60c..a54240efd 100644
--- a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/UnknownTile.java
+++ b/src/main/java/edu/rpi/legup/puzzle/treetent/elements/UnknownTile.java
@@ -1,11 +1,11 @@
package edu.rpi.legup.puzzle.treetent.elements;
-import edu.rpi.legup.model.elements.PlaceableElement;
+import edu.rpi.legup.model.elements.NonPlaceableElement;
-public class UnknownTile extends PlaceableElement {
+public class UnknownTile extends NonPlaceableElement {
public UnknownTile() {
super(
- "TREE-ELEM-0004",
+ "TREE-UNPL-0002",
"Unknown Tile",
"The blank tile",
"edu/rpi/legup/images/treetent/UnknownTile.png");
diff --git a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/treetent_elements_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/treetent/elements/treetent_elements_reference_sheet.txt
deleted file mode 100644
index e0cfc1dfa..000000000
--- a/src/main/java/edu/rpi/legup/puzzle/treetent/elements/treetent_elements_reference_sheet.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-TREE-ELEM-0001 : GrassTile
-TREE-ELEM-0002 : TentTile
-TREE-ELEM-0003 : TreeTile
-TREE-ELEM-0004 : UnknownTile
\ No newline at end of file
diff --git a/src/main/java/edu/rpi/legup/puzzle/treetent/rules/FillinRowCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/treetent/rules/FillinRowCaseRule.java
index 8fe9b6873..aaa1a8fbc 100644
--- a/src/main/java/edu/rpi/legup/puzzle/treetent/rules/FillinRowCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/treetent/rules/FillinRowCaseRule.java
@@ -61,11 +61,7 @@ public CaseBoard getCaseBoard(Board board) {
*/
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
- if (puzzleElement == null) {
- return new ArrayList();
- }
ArrayList cases;
-
List group;
int tentsLeft;
TreeTentClue clue = ((TreeTentClue) puzzleElement);
diff --git a/src/main/java/edu/rpi/legup/puzzle/treetent/rules/LinkTentCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/treetent/rules/LinkTentCaseRule.java
index cbe91c3a7..bd303174a 100644
--- a/src/main/java/edu/rpi/legup/puzzle/treetent/rules/LinkTentCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/treetent/rules/LinkTentCaseRule.java
@@ -60,10 +60,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList();
- if (puzzleElement == null) {
- return cases;
- }
-
TreeTentCell cell = (TreeTentCell) puzzleElement;
List adj = ((TreeTentBoard) board).getAdjacent(cell, TreeTentType.TREE);
List lines = ((TreeTentBoard) board).getLines();
diff --git a/src/main/java/edu/rpi/legup/puzzle/treetent/rules/LinkTreeCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/treetent/rules/LinkTreeCaseRule.java
index 153692ad0..03d039898 100644
--- a/src/main/java/edu/rpi/legup/puzzle/treetent/rules/LinkTreeCaseRule.java
+++ b/src/main/java/edu/rpi/legup/puzzle/treetent/rules/LinkTreeCaseRule.java
@@ -62,10 +62,6 @@ public CaseBoard getCaseBoard(Board board) {
@Override
public ArrayList getCases(Board board, PuzzleElement puzzleElement) {
ArrayList cases = new ArrayList<>();
- if (puzzleElement == null) {
- return cases;
- }
-
TreeTentBoard treeTentBoard = (TreeTentBoard) board;
TreeTentCell cell = (TreeTentCell) puzzleElement;
List adjCells = treeTentBoard.getAdjacent(cell, TreeTentType.TENT);
diff --git a/src/main/java/edu/rpi/legup/ui/CreatePuzzleDialog.java b/src/main/java/edu/rpi/legup/ui/CreatePuzzleDialog.java
index bde2df3d5..32ddca34f 100644
--- a/src/main/java/edu/rpi/legup/ui/CreatePuzzleDialog.java
+++ b/src/main/java/edu/rpi/legup/ui/CreatePuzzleDialog.java
@@ -69,7 +69,9 @@ public void actionPerformed(ActionEvent e) {
*/
@Override
public void actionPerformed(ActionEvent ae) {
- String game = getGame();
+ String game =
+ Config.convertDisplayNameToClassName(
+ (String) gameBox.getSelectedItem());
// Check if all 3 TextFields are filled
if (game.equals("ShortTruthTable") && textArea.getText().isEmpty()) {
@@ -89,8 +91,8 @@ public void actionPerformed(ActionEvent ae) {
} else {
homePanel.openEditorWithNewPuzzle(
game,
- Integer.valueOf(getRows()),
- Integer.valueOf(getColumns()));
+ Integer.valueOf(rows.getText()),
+ Integer.valueOf(columns.getText()));
}
setVisible(false);
} catch (IllegalArgumentException e) {
@@ -114,12 +116,6 @@ public void actionPerformed(ActionEvent e) {
}
};
- /**
- * Constructs a new CreatePuzzleDialog
- *
- * @param parent the parent frame of the dialog
- * @param homePanel the home panel where the created puzzle will be added
- */
public CreatePuzzleDialog(JFrame parent, HomePanel homePanel) {
super(parent, true);
diff --git a/src/main/java/edu/rpi/legup/ui/DynamicView.java b/src/main/java/edu/rpi/legup/ui/DynamicView.java
index fa0004d0b..d6dbfb4c3 100644
--- a/src/main/java/edu/rpi/legup/ui/DynamicView.java
+++ b/src/main/java/edu/rpi/legup/ui/DynamicView.java
@@ -16,10 +16,6 @@
import javax.swing.*;
import javax.swing.event.ChangeEvent;
-/**
- * A JPanel that provides a dynamic view with zooming capabilities for different types of content.
- * This class supports views such as game boards or proof trees, allowing users to zoom in and out.
- */
public class DynamicView extends JPanel {
private ScrollView scrollView;
@@ -33,12 +29,6 @@ public class DynamicView extends JPanel {
private static final Font INFO_FONT = MaterialFonts.REGULAR;
private static final Color INFO_COLOR = MaterialColors.GRAY_900;
- /**
- * Constructs a new DynamicView with the specified ScrollView and view type
- *
- * @param scrollView the ScrollView that provides the content to be displayed and zoomed
- * @param type the type of dynamic view to set up (e.g., BOARD or PROOF_TREE)
- */
public DynamicView(ScrollView scrollView, DynamicViewType type) {
this.scrollView = scrollView;
@@ -195,49 +185,24 @@ public void componentResized(ComponentEvent e) {
return zoomWrapper;
}
- /**
- * Gets the ScrollView component associated with this DynamicView
- *
- * @return the ScrollView component
- */
public ScrollView getScrollView() {
return this.scrollView;
}
- /**
- * Gets the zoom wrapper that contains the zooming controls
- *
- * @return the zoom wrapper with zooming controls
- */
public JPanel getZoomWrapper() {
return this.zoomWrapper;
}
- /**
- * Gets the zoomer that contains the zoomer component
- *
- * @return the zoomer with the zoomer component
- */
public JPanel getZoomer() {
return this.zoomer;
}
- /**
- * Updates the status label with an informational message
- *
- * @param message the informational message to display
- */
public void updateInfo(String message) {
status.setFont(INFO_FONT);
status.setForeground(INFO_COLOR);
status.setText(message);
}
- /**
- * Updates the status label with an error message
- *
- * @param message the error message to display
- */
public void updateError(String message) {
status.setFont(ERROR_FONT);
status.setForeground(ERROR_COLOR);
diff --git a/src/main/java/edu/rpi/legup/ui/HomePanel.java b/src/main/java/edu/rpi/legup/ui/HomePanel.java
index 75761c475..9e83dc9de 100644
--- a/src/main/java/edu/rpi/legup/ui/HomePanel.java
+++ b/src/main/java/edu/rpi/legup/ui/HomePanel.java
@@ -46,30 +46,40 @@ public class HomePanel extends LegupPanel {
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- legupUI.getProofEditor().loadPuzzle("", null);
+ Object[] items = legupUI.getProofEditor().promptPuzzle();
+ if (items == null) {
+ // The attempt to prompt a puzzle ended gracefully (cancel)
+ return;
+ }
+ String fileName = (String) items[0];
+ File puzzleFile = (File) items[1];
+ legupUI.getProofEditor().loadPuzzle(fileName, puzzleFile);
}
};
- /**
- * Constructs a {@code HomePanel} with the specified {@code JFrame} and {@code LegupUI}.
- *
- * @param frame the main application frame
- * @param legupUI the LEGUP user interface
- */
- public HomePanel(JFrame frame, LegupUI legupUI) {
+ private ActionListener openPuzzleListener =
+ new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Object[] items = legupUI.getPuzzleEditor().promptPuzzle();
+ if (items == null) {
+ // The attempt to prompt a puzzle ended gracefully (cancel)
+ return;
+ }
+ String fileName = (String) items[0];
+ File puzzleFile = (File) items[1];
+ legupUI.getPuzzleEditor().loadPuzzle(fileName, puzzleFile);
+ }
+ };
+
+ public HomePanel(FileDialog fileDialog, JFrame frame, LegupUI legupUI) {
this.legupUI = legupUI;
this.frame = frame;
setLayout(new GridLayout(1, 2));
- setPreferredSize(new Dimension(440, 250));
initText();
initButtons();
}
- /**
- * Creates and returns the menu bar for this panel
- *
- * @return the menu bar
- */
public JMenuBar getMenuBar() {
this.menuBar = new JMenuBar();
JMenu settings = new JMenu("Settings");
@@ -105,14 +115,6 @@ public void makeVisible() {
frame.setJMenuBar(this.getMenuBar());
}
- /**
- * Resizes the provided icon to the specified width and height
- *
- * @param icon the icon to resize
- * @param width the target width
- * @param height the target height
- * @return the resized icon
- */
private static ImageIcon resizeButtonIcon(ImageIcon icon, int width, int height) {
Image image = icon.getImage();
Image resizedImage = image.getScaledInstance(width, height, Image.SCALE_SMOOTH);
@@ -121,10 +123,10 @@ private static ImageIcon resizeButtonIcon(ImageIcon icon, int width, int height)
/** Initializes the buttons for this panel */
private void initButtons() {
- this.buttons = new JButton[3];
+ this.buttons = new JButton[4];
this.buttons[0] =
- new JButton("Puzzle Solver") {
+ new JButton("Solve Puzzle") {
{
setSize(buttonSize, buttonSize);
setMaximumSize(getSize());
@@ -142,7 +144,7 @@ private void initButtons() {
this.buttons[0].addActionListener(CursorController.createListener(this, openProofListener));
this.buttons[1] =
- new JButton("Puzzle Editor") {
+ new JButton("Create Puzzle") {
{
setSize(buttonSize, buttonSize);
setMaximumSize(getSize());
@@ -156,17 +158,35 @@ private void initButtons() {
this.buttons[1].setIcon(resizeButtonIcon(button1Icon, this.buttonSize, this.buttonSize));
this.buttons[1].setHorizontalTextPosition(AbstractButton.CENTER);
this.buttons[1].setVerticalTextPosition(AbstractButton.BOTTOM);
- this.buttons[1].addActionListener(l -> this.openPuzzleEditorDialog());
+ this.buttons[1].addActionListener(l -> this.openNewPuzzleDialog());
- for (int i = 0; i < this.buttons.length - 1; i++) { // -1 to avoid the batch grader button
- this.buttons[i].setBounds(200, 200, 700, 700);
- }
- this.buttons[2] = new JButton("Batch Grader");
+ this.buttons[2] =
+ new JButton("Edit Puzzle") {
+ {
+ setSize(buttonSize, buttonSize);
+ setMaximumSize(getSize());
+ }
+ };
+ URL button2IconLocation =
+ ClassLoader.getSystemClassLoader()
+ .getResource("edu/rpi/legup/images/Legup/homepanel/puzzle_file.png");
+ ImageIcon button2Icon = new ImageIcon(button2IconLocation);
this.buttons[2].setFocusPainted(false);
+ this.buttons[2].setIcon(resizeButtonIcon(button2Icon, this.buttonSize, this.buttonSize));
this.buttons[2].setHorizontalTextPosition(AbstractButton.CENTER);
this.buttons[2].setVerticalTextPosition(AbstractButton.BOTTOM);
-
this.buttons[2].addActionListener(
+ CursorController.createListener(this, openPuzzleListener)); // PLACEHOLDER
+
+ for (int i = 0; i < this.buttons.length - 1; i++) { // -1 to avoid the batch grader button
+ this.buttons[i].setBounds(200, 200, 700, 700);
+ }
+ this.buttons[3] = new JButton("Batch Grader");
+ this.buttons[3].setFocusPainted(false);
+ this.buttons[3].setHorizontalTextPosition(AbstractButton.CENTER);
+ this.buttons[3].setVerticalTextPosition(AbstractButton.BOTTOM);
+
+ this.buttons[3].addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -264,7 +284,7 @@ public void checkFolder() {
}
} catch (IOException ex) {
LOGGER.error(ex.getMessage());
- this.buttons[2].addActionListener((ActionEvent e) -> use_xml_to_check());
+ this.buttons[3].addActionListener((ActionEvent e) -> use_xml_to_check());
}
}
@@ -503,7 +523,7 @@ private void render() {
this.removeAll();
this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
- this.legupUI.setTitle("LEGUP: A Better Way To Learn Formal Logic");
+ this.legupUI.setTitle("LEGUP: A Better Way to Learn Formal Logic");
JPanel buttons = new JPanel();
buttons.add(Box.createRigidArea(new Dimension(5, 0)));
@@ -511,8 +531,11 @@ private void render() {
buttons.add(Box.createRigidArea(new Dimension(5, 0)));
buttons.add(this.buttons[1]);
buttons.add(Box.createRigidArea(new Dimension(5, 0)));
+ buttons.add(this.buttons[2]);
+ buttons.add(Box.createRigidArea(new Dimension(5, 0)));
+
JPanel batchGraderButton = new JPanel();
- batchGraderButton.add(this.buttons[2]);
+ batchGraderButton.add(this.buttons[3]);
batchGraderButton.setAlignmentX(Component.CENTER_ALIGNMENT);
this.add(Box.createRigidArea(new Dimension(0, 5)));
@@ -543,10 +566,6 @@ private void openPuzzleEditorDialog() {
}
}
- /**
- * Opens a dialog to select a directory, recursively processes the directory to grade puzzles,
- * and generates a CSV report of the grading results.
- */
private void checkProofAll() {
/*
* Select dir to grade; recursively grade sub-dirs using traverseDir()
@@ -590,14 +609,6 @@ private void checkProofAll() {
JOptionPane.showMessageDialog(null, "Batch grading complete.");
}
- /**
- * Recursively traverses directories to grade puzzles and writes results to a CSV file
- *
- * @param folder the folder to traverse
- * @param writer the BufferedWriter to write results to the CSV file
- * @param path the current path within the directory structure
- * @throws IOException if an I/O error occurs while writing to the CSV file
- */
private void traverseDir(File folder, BufferedWriter writer, String path) throws IOException {
// Recursively traverse directory
GameBoardFacade facade = GameBoardFacade.getInstance();
@@ -650,14 +661,6 @@ private void traverseDir(File folder, BufferedWriter writer, String path) throws
}
}
- /**
- * Opens the puzzle editor for the specified puzzle with the specified dimensions
- *
- * @param game the name of the game
- * @param rows the number of rows in the puzzle
- * @param columns the number of columns in the puzzle
- * @throws IllegalArgumentException if the dimensions are invalid
- */
public void openEditorWithNewPuzzle(String game, int rows, int columns)
throws IllegalArgumentException {
if (game.isEmpty()) {
@@ -689,7 +692,7 @@ public void openEditorWithNewPuzzle(String game, int rows, int columns)
}
/**
- * Opens the puzzle editor for the specified puzzle with the given statements
+ * Opens the puzzle editor for the specified game with the given statements
*
* @param game a String containing the name of the game
* @param statements an array of statements
diff --git a/src/main/java/edu/rpi/legup/ui/LegupUI.java b/src/main/java/edu/rpi/legup/ui/LegupUI.java
index 75f822a6c..201a2d4c7 100644
--- a/src/main/java/edu/rpi/legup/ui/LegupUI.java
+++ b/src/main/java/edu/rpi/legup/ui/LegupUI.java
@@ -41,7 +41,7 @@ public static String getOS() {
return os;
}
- /** LegupUI Constructor - creates a new LegupUI to set up the menu and toolbar */
+ /** LegupUI Constructor - creates a new LegupUI to setup the menu and toolbar */
public LegupUI() {
setTitle("LEGUP");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@@ -103,17 +103,11 @@ private void initPanels() {
add(window);
panels = new LegupPanel[3];
- panels[0] = new HomePanel(this, this);
+ panels[0] = new HomePanel(this.fileDialog, this, this);
panels[1] = new ProofEditorPanel(this.fileDialog, this, this);
panels[2] = new PuzzleEditorPanel(this.fileDialog, this, this);
}
- /**
- * Displays the specified panel
- *
- * @param option the index of the panel to display
- * @throws InvalidParameterException if the option is out of range
- */
protected void displayPanel(int option) {
if (option > panels.length || option < 0) {
throw new InvalidParameterException("Invalid option");
@@ -127,20 +121,10 @@ protected void displayPanel(int option) {
repaint();
}
- /**
- * Gets the ProofEditorPanel instance
- *
- * @return the ProofEditorPanel
- */
public ProofEditorPanel getProofEditor() {
return (ProofEditorPanel) panels[1];
}
- /**
- * Gets the PuzzleEditorPanel instance
- *
- * @return the PuzzleEditorPanel
- */
public PuzzleEditorPanel getPuzzleEditor() {
return (PuzzleEditorPanel) panels[2];
}
@@ -150,6 +134,17 @@ public void repaintTree() {
getProofEditor().repaintTree();
}
+ private void directions() {
+ JOptionPane.showMessageDialog(
+ null,
+ "For every move you make, you must provide a rules for it (located in the Rules"
+ + " panel).\n"
+ + "While working on the edu.rpi.legup.puzzle, you may click on the \"Check\""
+ + " button to test your proof for correctness.",
+ "Directions",
+ JOptionPane.PLAIN_MESSAGE);
+ }
+
public void showStatus(String status, boolean error) {
showStatus(status, error, 1);
}
@@ -162,13 +157,8 @@ public void showStatus(String status, boolean error, int timer) {
// TODO: implement
}
- /**
- * Prompts the user to confirm if they want to exit LEGUP
- *
- * @param instr the prompt message
- * @return true if the user chooses not to quit, false otherwise
- */
- public boolean exit(String instr) {
+ // ask to edu.rpi.legup.save current proof
+ public boolean noquit(String instr) {
int n = JOptionPane.showConfirmDialog(null, instr, "Confirm", JOptionPane.YES_NO_OPTION);
return n != JOptionPane.YES_OPTION;
}
@@ -178,7 +168,7 @@ public void windowOpened(WindowEvent e) {}
public void windowClosing(WindowEvent e) {
if (GameBoardFacade.getInstance().getHistory().getIndex() > -1) {
- if (exit("Exiting LEGUP?")) {
+ if (noquit("Exiting LEGUP?")) {
this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
} else {
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
@@ -200,47 +190,22 @@ public void windowActivated(WindowEvent e) {}
public void windowDeactivated(WindowEvent e) {}
- /**
- * Gets the BoardView instance from the proof editor
- *
- * @return the BoardView
- */
public BoardView getBoardView() {
return getProofEditor().getBoardView();
}
- /**
- * Gets the BoardView instance from the puzzle editor
- *
- * @return the BoardView
- */
public BoardView getEditorBoardView() {
return getPuzzleEditor().getBoardView();
}
- /**
- * Gets the DynamicView instance from the proof editor
- *
- * @return the DynamicView
- */
public DynamicView getDynamicBoardView() {
return getProofEditor().getDynamicBoardView();
}
- /**
- * Gets the DynamicView instance from the puzzle editor.
- *
- * @return the DynamicView
- */
public DynamicView getEditorDynamicBoardView() {
return getPuzzleEditor().getDynamicBoardView();
}
- /**
- * Gets the TreePanel instance from the proof editor
- *
- * @return the TreePanel
- */
public TreePanel getTreePanel() {
return getProofEditor().getTreePanel();
}
diff --git a/src/main/java/edu/rpi/legup/ui/PickGameDialog.java b/src/main/java/edu/rpi/legup/ui/PickGameDialog.java
index 3b66931a7..ed510c6b6 100644
--- a/src/main/java/edu/rpi/legup/ui/PickGameDialog.java
+++ b/src/main/java/edu/rpi/legup/ui/PickGameDialog.java
@@ -136,20 +136,10 @@ public void initPuzzles() {
gameBox = new JComboBox(games);
}
- /**
- * Gets the selected puzzle file path
- *
- * @return the puzzle file path as a String
- */
public String getPuzzle() {
return puzzleBox.getText();
}
- /**
- * Returns the selected puzzle
- *
- * @return the selected puzzle as a String
- */
public String getGame() {
return (String) gameBox.getSelectedItem();
}
diff --git a/src/main/java/edu/rpi/legup/ui/PreferencesDialog.java b/src/main/java/edu/rpi/legup/ui/PreferencesDialog.java
index e90d06640..e9a0df4a2 100644
--- a/src/main/java/edu/rpi/legup/ui/PreferencesDialog.java
+++ b/src/main/java/edu/rpi/legup/ui/PreferencesDialog.java
@@ -53,24 +53,12 @@ public class PreferencesDialog extends JDialog {
}
}
- /**
- * Creates a new instance of PreferencesDialog for the proof editor
- *
- * @param frame the parent frame
- * @param rules the RuleFrame associated with the proof editor
- * @return a new instance of PreferencesDialog
- */
public static PreferencesDialog CreateDialogForProofEditor(Frame frame, RuleFrame rules) {
PreferencesDialog p = new PreferencesDialog(frame);
p.rulesFrame = rules;
return p;
}
- /**
- * Constructs a PreferencesDialog
- *
- * @param frame the parent frame
- */
public PreferencesDialog(Frame frame) {
super(frame);
@@ -120,11 +108,6 @@ public PreferencesDialog(Frame frame) {
setVisible(true);
}
- /**
- * Toggles between dark mode and light mode based on the given preferences
- *
- * @param prefs the LegupPreferences instance holding user preferences
- */
private void toggleDarkMode(LegupPreferences prefs) {
try {
if (Boolean.valueOf(prefs.getUserPref(LegupPreferences.DARK_MODE))) {
@@ -138,11 +121,6 @@ private void toggleDarkMode(LegupPreferences prefs) {
}
}
- /**
- * Creates the general preferences tab
- *
- * @return a JScrollPane containing the general preferences panel
- */
private JScrollPane createGeneralTab() {
LegupPreferences prefs = LegupPreferences.getInstance();
JScrollPane scrollPane = new JScrollPane();
diff --git a/src/main/java/edu/rpi/legup/ui/ProofEditorPanel.java b/src/main/java/edu/rpi/legup/ui/ProofEditorPanel.java
index 5ecbd5564..ddabb5705 100644
--- a/src/main/java/edu/rpi/legup/ui/ProofEditorPanel.java
+++ b/src/main/java/edu/rpi/legup/ui/ProofEditorPanel.java
@@ -53,8 +53,8 @@ public class ProofEditorPanel extends LegupPanel implements IHistoryListener {
private DynamicView dynamicBoardView;
private JSplitPane topHalfPanel, mainPanel;
private TitledBorder boardBorder;
- private JButton[] toolBar1Buttons;
- private JButton[] toolBar2Buttons;
+
+ private JButton[] toolBarButtons;
private JMenu file;
private JMenuItem newPuzzle,
resetPuzzle,
@@ -74,8 +74,7 @@ public class ProofEditorPanel extends LegupPanel implements IHistoryListener {
private JMenu about, help;
private JMenuItem helpLegup, aboutLegup;
- private JToolBar toolBar1;
- private JToolBar toolBar2;
+ private JToolBar toolBar;
private BoardView boardView;
private JFileChooser folderBrowser;
@@ -89,6 +88,7 @@ public class ProofEditorPanel extends LegupPanel implements IHistoryListener {
public static final int IMD_FEEDBACK = 32;
public static final int INTERN_RO = 64;
public static final int AUTO_JUST = 128;
+ static final int[] TOOLBAR_SEPARATOR_BEFORE = {2, 4, 8};
private static final String[] PROFILES = {
"No Assistance",
"Rigorous Proof",
@@ -118,13 +118,6 @@ public class ProofEditorPanel extends LegupPanel implements IHistoryListener {
protected JMenuItem testAI = new JMenuItem("Test AI!");
protected JMenuItem hintAI = new JMenuItem("Hint");
- /**
- * Constructs a new {@code ProofEditorPanel} with the specified parameters
- *
- * @param fileDialog the {@code FileDialog} used for file operations
- * @param frame the {@code JFrame} that contains this panel
- * @param legupUI the {@code LegupUI} instance managing the user interface
- */
public ProofEditorPanel(FileDialog fileDialog, JFrame frame, LegupUI legupUI) {
this.fileDialog = fileDialog;
this.frame = frame;
@@ -141,7 +134,7 @@ public ProofEditorPanel(FileDialog fileDialog, JFrame frame, LegupUI legupUI) {
public void makeVisible() {
this.removeAll();
- setupToolBar1();
+ setupToolBar();
setupContent();
frame.setJMenuBar(getMenuBar());
}
@@ -172,7 +165,7 @@ public JMenuBar getMenuBar() {
file = new JMenu("File");
newPuzzle = new JMenuItem("Open");
- resetPuzzle = new JMenuItem("Reset");
+ resetPuzzle = new JMenuItem("Reset Puzzle");
// genPuzzle = new JMenuItem("Puzzle Generators"); // TODO: implement puzzle
// generator
saveProofAs = new JMenuItem("Save As"); // create a new file to save
@@ -348,7 +341,6 @@ public JMenuBar getMenuBar() {
} else {
resetPuzzle.setAccelerator(KeyStroke.getKeyStroke('R', InputEvent.CTRL_DOWN_MASK));
}
-
file.addSeparator();
file.add(saveProofAs);
@@ -555,7 +547,6 @@ public Object[] promptPuzzle() {
return null;
}
- System.out.println(preferences.getSavedPath());
return new Object[] {fileName, puzzleFile};
}
@@ -721,14 +712,16 @@ private void helpTutorial() {
default:
url = "https://github.com/Bram-Hub/Legup/wiki/LEGUP-Tutorial";
}
+ Runtime rt = Runtime.getRuntime();
try {
+ // rt.exec("rundll32 url.dll,FileProtocolHandler "+url);
java.awt.Desktop.getDesktop().browse(java.net.URI.create(url));
} catch (IOException e) {
e.printStackTrace();
}
}
- // unfinished
+ // add the new function need to implement
public void add_drop() {
// add the mouse event then we can use the new listener to implement and
// we should create a need jbuttom for it to ship the rule we select.
@@ -772,22 +765,13 @@ private void saveProofChange() {
}
}
- /**
- * Displays a confirmation dialog with a specified message. Returns {@code true} if the user
- * selects "No" or cancels the action, and {@code false} if the user selects "Yes".
- *
- * @param instr the message to display in the confirmation dialog
- * @return {@code true} if the user chooses not to quit, {@code false} otherwise
- */
+ // ask to edu.rpi.legup.save current proof
public boolean noquit(String instr) {
int n = JOptionPane.showConfirmDialog(null, instr, "Confirm", JOptionPane.YES_NO_OPTION);
return n != JOptionPane.YES_OPTION;
}
- /**
- * Configures the layout and components for the main user interface. This includes setting up
- * panels, split panes, and borders, and adding them to the main content pane.
- */
+ /** Sets the main content for the edu.rpi.legup.user interface */
protected void setupContent() {
// JPanel consoleBox = new JPanel(new BorderLayout());
JPanel treeBox = new JPanel(new BorderLayout());
@@ -820,9 +804,16 @@ protected void setupContent() {
ruleBox.add(boardPanel);
treeBox.add(ruleBox);
this.add(treeBox);
+ // consoleBox.add(treeBox);
+ //
+ // getContentPane().add(consoleBox);
- mainPanel.setDividerLocation(mainPanel.getMaximumDividerLocation() + 100);
+ // JPopupPanel popupPanel = new JPopupPanel();
+ // setGlassPane(popupPanel);
+ // popupPanel.setVisible(true);
+ mainPanel.setDividerLocation(mainPanel.getMaximumDividerLocation() + 100);
+ // frame.pack();
revalidate();
}
@@ -837,29 +828,68 @@ private void setupToolBar1() {
toolBar1.setRollover(true);
setToolBar2Buttons(new JButton[1]);
- URL open_url =
- ClassLoader.getSystemClassLoader()
- .getResource("edu/rpi/legup/images/Legup/Open.png");
+ // Scale the image icons down to make the buttons smaller
+ ImageIcon imageIcon = new ImageIcon(resourceLocation);
+ Image image = imageIcon.getImage();
+ imageIcon =
+ new ImageIcon(
+ image.getScaledInstance(
+ this.TOOLBAR_ICON_SCALE,
+ this.TOOLBAR_ICON_SCALE,
+ Image.SCALE_SMOOTH));
+
+ JButton button = new JButton(toolBarName, imageIcon);
+ button.setFocusPainted(false);
+ getToolBarButtons()[i] = button;
+ }
- // Scale the image icons down to make the buttons smaller
- ImageIcon OpenImageIcon = new ImageIcon(open_url);
- Image OpenImage = OpenImageIcon.getImage();
- OpenImageIcon =
- new ImageIcon(
- OpenImage.getScaledInstance(
- this.TOOLBAR_ICON_SCALE,
- this.TOOLBAR_ICON_SCALE,
- Image.SCALE_SMOOTH));
+ toolBar = new JToolBar();
+ toolBar.setFloatable(false);
+ toolBar.setRollover(true);
- JButton open = new JButton("Open", OpenImageIcon);
- open.setFocusPainted(false);
+ for (int i = 0; i < getToolBarButtons().length; i++) {
+ for (int s = 0; s < TOOLBAR_SEPARATOR_BEFORE.length; s++) {
+ if (i == TOOLBAR_SEPARATOR_BEFORE[s]) {
+ toolBar.addSeparator();
+ }
+ }
+ String toolBarName = ToolbarName.values()[i].toString();
- open.addActionListener((ActionEvent) -> loadPuzzle());
+ toolBar.add(getToolBarButtons()[i]);
+ getToolBarButtons()[i].setToolTipText(toolBarName);
- getToolBar2Buttons()[0] = open;
- toolBar1.add(getToolBar2Buttons()[0]);
+ getToolBarButtons()[i].setVerticalTextPosition(SwingConstants.BOTTOM);
+ getToolBarButtons()[i].setHorizontalTextPosition(SwingConstants.CENTER);
+ }
- this.add(toolBar1, BorderLayout.NORTH);
+ // toolBarButtons[ToolbarName.OPEN_PUZZLE.ordinal()].addActionListener((ActionEvent
+ // e) ->
+ // promptPuzzle());
+ // toolBarButtons[ToolbarName.SAVE.ordinal()].addActionListener((ActionEvent e) ->
+ // saveProof());
+ // toolBarButtons[ToolbarName.UNDO.ordinal()].addActionListener((ActionEvent e) ->
+ // GameBoardFacade.getInstance().getHistory().undo());
+ // toolBarButtons[ToolbarName.REDO.ordinal()].addActionListener((ActionEvent e) ->
+ // GameBoardFacade.getInstance().getHistory().redo());
+ toolBarButtons[ToolbarName.HINT.ordinal()].addActionListener((ActionEvent e) -> {});
+ toolBarButtons[ToolbarName.CHECK.ordinal()].addActionListener(
+ (ActionEvent e) -> checkProof());
+ toolBarButtons[ToolbarName.SUBMIT.ordinal()].addActionListener((ActionEvent e) -> {});
+ toolBarButtons[ToolbarName.DIRECTIONS.ordinal()].addActionListener((ActionEvent e) -> {});
+
+ toolBarButtons[ToolbarName.CHECK_ALL.ordinal()].addActionListener(
+ (ActionEvent e) -> checkProofAll());
+
+ // toolBarButtons[ToolbarName.SAVE.ordinal()].setEnabled(false);
+ // toolBarButtons[ToolbarName.UNDO.ordinal()].setEnabled(false);
+ // toolBarButtons[ToolbarName.REDO.ordinal()].setEnabled(false);
+ toolBarButtons[ToolbarName.HINT.ordinal()].setEnabled(false);
+ toolBarButtons[ToolbarName.CHECK.ordinal()].setEnabled(false);
+ toolBarButtons[ToolbarName.SUBMIT.ordinal()].setEnabled(false);
+ toolBarButtons[ToolbarName.DIRECTIONS.ordinal()].setEnabled(false);
+ toolBarButtons[ToolbarName.CHECK_ALL.ordinal()].setEnabled(true);
+
+ this.add(toolBar, BorderLayout.NORTH);
}
/**
@@ -969,19 +999,19 @@ private void setupToolBar2() {
/**
* Sets the toolbar1 buttons
*
- * @param toolBar1Buttons toolbar buttons
+ * @param toolBarButtons toolbar buttons
*/
- public void setToolBar1Buttons(JButton[] toolBar1Buttons) {
- this.toolBar1Buttons = toolBar1Buttons;
+ public void setToolBarButtons(JButton[] toolBarButtons) {
+ this.toolBarButtons = toolBarButtons;
}
/**
- * Sets the toolbar2 buttons
+ * Gets the toolbar buttons
*
- * @param toolBar2Buttons toolbar buttons
+ * @return toolbar buttons
*/
- public void setToolBar2Buttons(JButton[] toolBar2Buttons) {
- this.toolBar2Buttons = toolBar2Buttons;
+ public JButton[] getToolBarButtons() {
+ return toolBarButtons;
}
/**
@@ -1082,12 +1112,6 @@ private void repaintAll() {
treePanel.repaint();
}
- /**
- * Initializes the dynamic board view, updates the tree panel, and sets rules and search panels
- * based on the provided puzzle. It also updates toolbars and reloads the GUI.
- *
- * @param puzzle the puzzle to be displayed
- */
public void setPuzzleView(Puzzle puzzle) {
this.boardView = puzzle.getBoardView();
@@ -1111,8 +1135,9 @@ public void setPuzzleView(Puzzle puzzle) {
ruleFrame.getContradictionPanel().setRules(puzzle.getContradictionRules());
ruleFrame.getSearchPanel().setSearchBar(puzzle);
- toolBar1.setVisible(false);
- setupToolBar2();
+ toolBarButtons[ToolbarName.CHECK.ordinal()].setEnabled(true);
+ // toolBarButtons[ToolbarName.SAVE.ordinal()].setEnabled(true);
+
reloadGui();
}
@@ -1178,15 +1203,6 @@ private boolean basicCheckProof(int[][] origCells) {
return false;
}
- /**
- * Traverses a given directory, grades the proofs found in the directory, and writes the results
- * to the specified CSV writer.
- *
- * @param folder the folder to traverse
- * @param writer the CSV writer
- * @param path the current path in the directory traversal
- * @throws IOException if an error occurs while writing to the CSV file
- */
private void traverseDir(File folder, BufferedWriter writer, String path) throws IOException {
// Recursively traverse directory
GameBoardFacade facade = GameBoardFacade.getInstance();
@@ -1241,11 +1257,6 @@ private void traverseDir(File folder, BufferedWriter writer, String path) throws
}
}
- /**
- * Returns the current board view.
- *
- * @return the current {@link BoardView}
- */
public BoardView getBoardView() {
return boardView;
}
@@ -1259,17 +1270,12 @@ public DynamicView getDynamicBoardView() {
return dynamicBoardView;
}
- /**
- * Returns the current tree panel.
- *
- * @return the current {@link TreePanel}
- */
public TreePanel getTreePanel() {
return treePanel;
}
/**
- * Called when an action is pushed onto the edu.rpi.legup.history stack
+ * Called when a action is pushed onto the edu.rpi.legup.history stack
*
* @param command action to push onto the stack
*/
@@ -1277,7 +1283,9 @@ public TreePanel getTreePanel() {
public void onPushChange(ICommand command) {
LOGGER.info("Pushing " + command.getClass().getSimpleName() + " to stack.");
undo.setEnabled(true);
+ // toolBarButtons[ToolbarName.UNDO.ordinal()].setEnabled(true);
redo.setEnabled(false);
+ // toolBarButtons[ToolbarName.REDO.ordinal()].setEnabled(false);
String puzzleName = GameBoardFacade.getInstance().getPuzzleModule().getName();
File puzzleFile = new File(GameBoardFacade.getInstance().getCurFileName());
@@ -1300,7 +1308,9 @@ public void onClearHistory() {}
@Override
public void onRedo(boolean isBottom, boolean isTop) {
undo.setEnabled(!isBottom);
+ // toolBarButtons[ToolbarName.UNDO.ordinal()].setEnabled(!isBottom);
redo.setEnabled(!isTop);
+ // toolBarButtons[ToolbarName.REDO.ordinal()].setEnabled(!isTop);
if (isBottom) {
String puzzleName = GameBoardFacade.getInstance().getPuzzleModule().getName();
File puzzleFile = new File(GameBoardFacade.getInstance().getCurFileName());
@@ -1321,7 +1331,9 @@ public void onRedo(boolean isBottom, boolean isTop) {
@Override
public void onUndo(boolean isBottom, boolean isTop) {
undo.setEnabled(!isBottom);
+ // toolBarButtons[ToolbarName.UNDO.ordinal()].setEnabled(!isBottom);
redo.setEnabled(!isTop);
+ // toolBarButtons[ToolbarName.REDO.ordinal()].setEnabled(!isTop);
String puzzleName = GameBoardFacade.getInstance().getPuzzleModule().getName();
File puzzleFile = new File(GameBoardFacade.getInstance().getCurFileName());
if (isBottom) {
diff --git a/src/main/java/edu/rpi/legup/ui/PuzzleEditorPanel.java b/src/main/java/edu/rpi/legup/ui/PuzzleEditorPanel.java
index 7c2ba06ff..6b65e72f7 100644
--- a/src/main/java/edu/rpi/legup/ui/PuzzleEditorPanel.java
+++ b/src/main/java/edu/rpi/legup/ui/PuzzleEditorPanel.java
@@ -39,14 +39,12 @@ public class PuzzleEditorPanel extends LegupPanel implements IHistoryListener {
private JMenu[] menus;
private JMenuItem helpLegup, aboutLegup;
private JMenuBar menuBar;
- private JToolBar toolBar1;
- private JToolBar toolBar2;
+ private JToolBar toolBar;
private JFileChooser folderBrowser;
private JFrame frame;
private JButton[] buttons;
JSplitPane splitPanel;
- private JButton[] toolBar1Buttons;
- private JButton[] toolBar2Buttons;
+ private JButton[] toolBarButtons;
private JPanel elementPanel;
private DynamicView dynamicBoardView;
private BoardView boardView;
@@ -58,11 +56,7 @@ public class PuzzleEditorPanel extends LegupPanel implements IHistoryListener {
private JPanel treePanel;
private LegupUI legupUI;
private EditorElementController editorElementController;
- private CreatePuzzleDialog cpd;
- private HomePanel hp;
- private boolean existingPuzzle;
- private String fileName;
- private File puzzleFile;
+ static final int[] TOOLBAR_SEPARATOR_BEFORE = {2, 4, 8};
/**
* Constructs a {@code PuzzleEditorPanel} with the specified file dialog, frame, and Legup UI
@@ -130,14 +124,14 @@ public void setMenuBar() {
menus[0] = new JMenu("File");
// file>new
- JMenuItem openPuzzle = new JMenuItem("Open");
- openPuzzle.addActionListener((ActionEvent) -> loadPuzzle());
+ JMenuItem newPuzzle = new JMenuItem("New");
+ newPuzzle.addActionListener((ActionEvent) -> loadPuzzle());
if (os.equals("mac")) {
- openPuzzle.setAccelerator(
+ newPuzzle.setAccelerator(
KeyStroke.getKeyStroke(
- 'O', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ 'N', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
} else {
- openPuzzle.setAccelerator(KeyStroke.getKeyStroke('O', InputEvent.CTRL_DOWN_MASK));
+ newPuzzle.setAccelerator(KeyStroke.getKeyStroke('N', InputEvent.CTRL_DOWN_MASK));
}
// file>create
JMenuItem createPuzzle = new JMenuItem("Create");
@@ -150,11 +144,11 @@ public void setMenuBar() {
existingPuzzle = false;
});
if (os.equals("mac")) {
- createPuzzle.setAccelerator(
+ newPuzzle.setAccelerator(
KeyStroke.getKeyStroke(
- 'C', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ 'D', Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
} else {
- createPuzzle.setAccelerator(KeyStroke.getKeyStroke('C', InputEvent.CTRL_DOWN_MASK));
+ newPuzzle.setAccelerator(KeyStroke.getKeyStroke('D', InputEvent.CTRL_DOWN_MASK));
}
JMenuItem exit = new JMenuItem("Exit");
@@ -285,7 +279,8 @@ public void exitEditor() {
@Override
public void makeVisible() {
this.removeAll();
- setupToolBar1();
+
+ setupToolBar();
setupContent();
setMenuBar();
}
@@ -297,21 +292,21 @@ public void makeVisible() {
private void setupToolBar1() {
setToolBar1Buttons(new JButton[2]);
- URL open_url =
- ClassLoader.getSystemClassLoader()
- .getResource("edu/rpi/legup/images/Legup/Open.png");
- ImageIcon OpenImageIcon = new ImageIcon(open_url);
- Image OpenImage = OpenImageIcon.getImage();
- OpenImageIcon =
- new ImageIcon(
- OpenImage.getScaledInstance(
- this.TOOLBAR_ICON_SCALE,
- this.TOOLBAR_ICON_SCALE,
- Image.SCALE_SMOOTH));
-
- JButton open = new JButton("Open", OpenImageIcon);
- open.setFocusPainted(false);
- open.addActionListener((ActionEvent) -> loadPuzzle());
+ // Scale the image icons down to make the buttons smaller
+ ImageIcon imageIcon = new ImageIcon(resourceLocation);
+ Image image = imageIcon.getImage();
+ imageIcon =
+ new ImageIcon(
+ image.getScaledInstance(
+ this.TOOLBAR_ICON_SCALE,
+ this.TOOLBAR_ICON_SCALE,
+ Image.SCALE_SMOOTH));
+
+ JButton button = new JButton(toolBarName, imageIcon);
+ button.setFocusPainted(false);
+ getToolBarButtons()[i] = button;
+ lastone = i;
+ }
getToolBar1Buttons()[0] = open;
@@ -419,51 +414,81 @@ private void setupToolBar2() {
URL save_and_solve =
ClassLoader.getSystemClassLoader()
.getResource("edu/rpi/legup/images/Legup/Check.png");
- ImageIcon SaveSolveImageIcon = new ImageIcon(save_and_solve);
- Image SaveSolveImage = SaveSolveImageIcon.getImage();
- SaveSolveImageIcon =
+ ImageIcon imageIcon = new ImageIcon(check_and_save);
+ Image image = imageIcon.getImage();
+ imageIcon =
new ImageIcon(
- SaveSolveImage.getScaledInstance(
+ image.getScaledInstance(
this.TOOLBAR_ICON_SCALE,
this.TOOLBAR_ICON_SCALE,
Image.SCALE_SMOOTH));
- JButton saveandsolve = new JButton("Save & Solve", SaveSolveImageIcon);
- saveandsolve.setFocusPainted(false);
- saveandsolve.addActionListener(
+ JButton checkandsave = new JButton("check and Save", imageIcon);
+ checkandsave.setFocusPainted(false);
+ checkandsave.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- if (GameBoardFacade.getInstance().getPuzzleModule() != null) {
- String filename = savePuzzle();
- File puzzlename = new File(filename);
- System.out.println(filename);
-
- GameBoardFacade.getInstance().getLegupUI().displayPanel(1);
- GameBoardFacade.getInstance()
- .getLegupUI()
- .getProofEditor()
- .loadPuzzle(filename, new File(filename));
- String puzzleName =
- GameBoardFacade.getInstance().getPuzzleModule().getName();
- frame.setTitle(puzzleName + " - " + puzzlename.getName());
- }
+ // savePuzzle();
+ String filename = savePuzzle();
+ File puzzlename = new File(filename);
+ System.out.println(filename);
+
+ GameBoardFacade.getInstance().getLegupUI().displayPanel(1);
+ GameBoardFacade.getInstance()
+ .getLegupUI()
+ .getProofEditor()
+ .loadPuzzle(filename, new File(filename));
+ String puzzleName =
+ GameBoardFacade.getInstance().getPuzzleModule().getName();
+ frame.setTitle(puzzleName + " - " + puzzlename.getName());
}
});
- getToolBar2Buttons()[2] = saveandsolve;
- toolBar2.add(getToolBar2Buttons()[2]);
+ getToolBarButtons()[lastone + 1] = checkandsave;
+ System.out.println("it is create new file");
+
+ toolBar = new JToolBar();
+ toolBar.setFloatable(false);
+ toolBar.setRollover(true);
+
+ for (int i = 0; i < getToolBarButtons().length - 1; i++) {
+ for (int s = 0; s < TOOLBAR_SEPARATOR_BEFORE.length; s++) {
+ if (i == TOOLBAR_SEPARATOR_BEFORE[s]) {
+ toolBar.addSeparator();
+ }
+ }
+ String toolBarName = ToolbarName.values()[i].toString();
+
+ toolBar.add(getToolBarButtons()[i]);
+ getToolBarButtons()[i].setToolTipText(toolBarName);
+
+ getToolBarButtons()[i].setVerticalTextPosition(SwingConstants.BOTTOM);
+ getToolBarButtons()[i].setHorizontalTextPosition(SwingConstants.CENTER);
+ }
- this.add(toolBar2, BorderLayout.NORTH);
+ // toolBarButtons[ToolbarName.OPEN_PUZZLE.ordinal()].addActionListener((ActionEvent
+ // e) ->
+ // promptPuzzle());
+ // toolBarButtons[ToolbarName.SAVE.ordinal()].addActionListener((ActionEvent e) ->
+ // saveProof());
+ // toolBarButtons[ToolbarName.UNDO.ordinal()].addActionListener((ActionEvent e) ->
+ // GameBoardFacade.getInstance().getHistory().undo());
+ // toolBarButtons[ToolbarName.REDO.ordinal()].addActionListener((ActionEvent e) ->
+ // GameBoardFacade.getInstance().getHistory().redo());
+ toolBarButtons[ToolbarName.HINT.ordinal()].addActionListener((ActionEvent e) -> {});
+ toolBarButtons[ToolbarName.SUBMIT.ordinal()].addActionListener((ActionEvent e) -> {});
+ toolBarButtons[ToolbarName.DIRECTIONS.ordinal()].addActionListener((ActionEvent e) -> {});
+
+ // toolBarButtons[ToolbarName.SAVE.ordinal()].setEnabled(false);
+ // toolBarButtons[ToolbarName.UNDO.ordinal()].setEnabled(false);
+ // toolBarButtons[ToolbarName.REDO.ordinal()].setEnabled(false);
+ toolBarButtons[ToolbarName.HINT.ordinal()].setEnabled(false);
+ toolBarButtons[ToolbarName.SUBMIT.ordinal()].setEnabled(false);
+ toolBarButtons[ToolbarName.DIRECTIONS.ordinal()].setEnabled(false);
+
+ this.add(toolBar, BorderLayout.NORTH);
}
- /**
- * Initializes a puzzle based on the provided game name, rows, and columns.
- *
- * @param game the name of the game or puzzle to load
- * @param rows the number of rows in the puzzle
- * @param columns the number of columns in the puzzle
- * @throws IllegalArgumentException if the provided arguments are invalid
- */
public void loadPuzzleFromHome(String game, int rows, int columns)
throws IllegalArgumentException {
GameBoardFacade facade = GameBoardFacade.getInstance();
@@ -477,13 +502,6 @@ public void loadPuzzleFromHome(String game, int rows, int columns)
}
}
- /**
- * Initializes a puzzle based on the provided game name and an array of statements.
- *
- * @param game the name of the game or puzzle to load
- * @param statements an array of statements to initialize the puzzle
- * @throws IllegalArgumentException if the provided arguments are invalid
- */
public void loadPuzzleFromHome(String game, String[] statements) {
GameBoardFacade facade = GameBoardFacade.getInstance();
try {
@@ -507,7 +525,7 @@ public void loadPuzzleFromHome(String game, String[] statements) {
public Object[] promptPuzzle() {
GameBoardFacade facade = GameBoardFacade.getInstance();
if (facade.getBoard() != null) {
- if (noQuit("Open an existing puzzle?")) {
+ if (noQuit("Opening a new puzzle?")) {
return new Object[0];
}
}
@@ -531,6 +549,7 @@ public Object[] promptPuzzle() {
fileBrowser.setAcceptAllFileFilterUsed(false);
File puzzlePath = fileBrowser.getSelectedFile();
+ System.out.println(puzzlePath.getAbsolutePath());
if (puzzlePath != null) {
fileName = puzzlePath.getAbsolutePath();
@@ -575,9 +594,6 @@ public void loadPuzzle(String fileName, File puzzleFile) {
GameBoardFacade.getInstance().loadPuzzleEditor(fileName);
String puzzleName = GameBoardFacade.getInstance().getPuzzleModule().getName();
frame.setTitle(puzzleName + " - " + puzzleFile.getName());
- existingPuzzle = true;
- this.fileName = fileName;
- this.puzzleFile = puzzleFile;
} catch (InvalidFileFormatException e) {
legupUI.displayPanel(0);
LOGGER.error(e.getMessage());
@@ -628,22 +644,12 @@ public BoardView getBoardView() {
return boardView;
}
- /**
- * Returns the array of buttons for the first toolbar
- *
- * @return the array of toolbar1 buttons
- */
- public JButton[] getToolBar1Buttons() {
- return toolBar1Buttons;
+ public JButton[] getToolBarButtons() {
+ return toolBarButtons;
}
- /**
- * Sets the array of buttons for the first toolbar
- *
- * @param toolBar1Buttons the array of toolbar1 buttons
- */
- public void setToolBar1Buttons(JButton[] toolBar1Buttons) {
- this.toolBar1Buttons = toolBar1Buttons;
+ public void setToolBarButtons(JButton[] toolBarButtons) {
+ this.toolBarButtons = toolBarButtons;
}
/**
@@ -690,11 +696,13 @@ public void setPuzzleView(Puzzle puzzle) {
dynamicBoardView.setBorder(titleBoard);
puzzle.addBoardListener(puzzle.getBoardView());
+ System.out.println("Setting elements");
if (this.elementFrame != null) {
elementFrame.setElements(puzzle);
}
- toolBar1.setVisible(false);
- setupToolBar2();
+
+ toolBarButtons[ToolbarName.CHECK.ordinal()].setEnabled(true);
+ // toolBarButtons[ToolbarName.SAVE.ordinal()].setEnabled(true);
}
/** Saves a puzzle */
@@ -760,7 +768,7 @@ private String savePuzzle() {
folderBrowser.setAcceptAllFileFilterUsed(false);
String path = folderBrowser.getSelectedFile().getAbsolutePath();
- preferences.setSavedPath(path);
+
if (path != null) {
try {
PuzzleExporter exporter = puzzle.getExporter();
@@ -775,11 +783,6 @@ private String savePuzzle() {
return path;
}
- /**
- * Returns the current dynamic board view
- *
- * @return the dynamic board view
- */
public DynamicView getDynamicBoardView() {
return dynamicBoardView;
}
diff --git a/src/main/java/edu/rpi/legup/ui/ScrollView.java b/src/main/java/edu/rpi/legup/ui/ScrollView.java
index 589573154..4d53cd747 100644
--- a/src/main/java/edu/rpi/legup/ui/ScrollView.java
+++ b/src/main/java/edu/rpi/legup/ui/ScrollView.java
@@ -293,11 +293,6 @@ public void setSize(Dimension size) {
updateSize();
}
- /**
- * Gets the canvas for this {@code ScrollView}
- *
- * @return the ZoomablePane instance used as the canvas
- */
public ZoomablePane getCanvas() {
return canvas;
}
diff --git a/src/main/java/edu/rpi/legup/ui/ToolbarName.java b/src/main/java/edu/rpi/legup/ui/ToolbarName.java
index 622d16d8d..5cf9b5923 100644
--- a/src/main/java/edu/rpi/legup/ui/ToolbarName.java
+++ b/src/main/java/edu/rpi/legup/ui/ToolbarName.java
@@ -5,8 +5,11 @@
* specific toolbar action.
*/
public enum ToolbarName {
+ HINT,
+ CHECK,
+ SUBMIT,
DIRECTIONS,
- CHECK;
+ CHECK_ALL;
/**
* Gets the String representation of the ToolbarName enum
diff --git a/src/main/java/edu/rpi/legup/ui/ZoomWidget.java b/src/main/java/edu/rpi/legup/ui/ZoomWidget.java
index 40f36113f..3207462ed 100644
--- a/src/main/java/edu/rpi/legup/ui/ZoomWidget.java
+++ b/src/main/java/edu/rpi/legup/ui/ZoomWidget.java
@@ -10,10 +10,6 @@
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
-/**
- * The {@code ZoomWidget} displays a zoom icon that, when clicked, shows a popup slider to adjust
- * the zoom level of the associated {@code ScrollView}.
- */
public class ZoomWidget extends JLabel {
private ScrollView parent;
private PopupSlider palette = new PopupSlider();
@@ -52,11 +48,6 @@ public PopupSlider() {
slider.addChangeListener(this);
}
- /**
- * Handles state changes in the slider by adjusting the zoom level of the {@code ScrollView}
- *
- * @param e the {@code ChangeEvent} indicating that the slider's state has changed
- */
public void stateChanged(ChangeEvent e) {
if (slider.getValueIsAdjusting()) {
parent.zoomTo((double) slider.getValue() / 100.0);
diff --git a/src/main/java/edu/rpi/legup/ui/ZoomablePane.java b/src/main/java/edu/rpi/legup/ui/ZoomablePane.java
index 66af90abd..934d31c53 100644
--- a/src/main/java/edu/rpi/legup/ui/ZoomablePane.java
+++ b/src/main/java/edu/rpi/legup/ui/ZoomablePane.java
@@ -5,10 +5,6 @@
import java.awt.Graphics2D;
import javax.swing.*;
-/**
- * The {@code ZoomablePane} class is used to display components in a zoomable and scalable manner.
- * It uses {@code ScrollView} to handle scaling and drawing of the content.
- */
public class ZoomablePane extends JLayeredPane {
private ScrollView viewer;
diff --git a/src/main/java/edu/rpi/legup/ui/boardview/BoardView.java b/src/main/java/edu/rpi/legup/ui/boardview/BoardView.java
index 18b47d98b..0b395c774 100644
--- a/src/main/java/edu/rpi/legup/ui/boardview/BoardView.java
+++ b/src/main/java/edu/rpi/legup/ui/boardview/BoardView.java
@@ -188,11 +188,6 @@ public ArrayList getElementViews() {
return elementViews;
}
- /**
- * Gets the ElementController associated with this board view.
- *
- * @return the ElementController
- */
public ElementController getElementController() {
return elementController;
}
@@ -202,11 +197,6 @@ public void draw(Graphics2D graphics2D) {
drawBoard(graphics2D);
}
- /**
- * Draws the board and its elements.
- *
- * @param graphics2D the Graphics2D context used for drawing
- */
public void drawBoard(Graphics2D graphics2D) {
for (ElementView element : elementViews) {
element.draw(graphics2D);
@@ -223,10 +213,5 @@ public void onBoardDataChanged(PuzzleElement puzzleElement) {
repaint();
}
- /**
- * Gets the selection popup menu for this board view.
- *
- * @return the DataSelectionView associated with this view
- */
public abstract DataSelectionView getSelectionPopupMenu();
}
diff --git a/src/main/java/edu/rpi/legup/ui/boardview/DataSelectionView.java b/src/main/java/edu/rpi/legup/ui/boardview/DataSelectionView.java
index bc40e3d58..44cee38fb 100644
--- a/src/main/java/edu/rpi/legup/ui/boardview/DataSelectionView.java
+++ b/src/main/java/edu/rpi/legup/ui/boardview/DataSelectionView.java
@@ -11,11 +11,6 @@
*/
public class DataSelectionView extends JPopupMenu {
- /**
- * Constructs a DataSelectionView with the given controller.
- *
- * @param controller The ElementController to handle UI events.
- */
public DataSelectionView(ElementController controller) {
setBackground(Color.GRAY);
setBorder(new BevelBorder(BevelBorder.RAISED));
diff --git a/src/main/java/edu/rpi/legup/ui/boardview/ElementSelection.java b/src/main/java/edu/rpi/legup/ui/boardview/ElementSelection.java
index eaa85082d..5ddbab909 100644
--- a/src/main/java/edu/rpi/legup/ui/boardview/ElementSelection.java
+++ b/src/main/java/edu/rpi/legup/ui/boardview/ElementSelection.java
@@ -12,29 +12,16 @@ public class ElementSelection {
private ElementView hover;
private Point mousePoint;
- /**
- * Constructs an ElementSelection instance with an empty selection and no hover or mouse point
- */
public ElementSelection() {
this.selection = new ArrayList<>();
this.hover = null;
this.mousePoint = null;
}
- /**
- * Gets the list of currently selected ElementViews.
- *
- * @return the list of selected ElementViews
- */
public ArrayList getSelection() {
return selection;
}
- /**
- * Gets the first ElementView in the selection, or null if the selection is empty.
- *
- * @return the first selected ElementView, or null if there are no selections
- */
public ElementView getFirstSelection() {
return selection.size() == 0 ? null : selection.get(0);
}
@@ -75,20 +62,10 @@ public void clearSelection() {
selection.clear();
}
- /**
- * Gets the currently hovered ElementView.
- *
- * @return the currently hovered ElementView, or null if no element is hovered
- */
public ElementView getHover() {
return hover;
}
- /**
- * Sets a new hovered ElementView, updating the hover state of the previous and new elements.
- *
- * @param newHovered the new ElementView to be hovered
- */
public void newHover(ElementView newHovered) {
newHovered.setHover(true);
if (hover != null) {
@@ -105,20 +82,10 @@ public void clearHover() {
}
}
- /**
- * Gets the current mouse point location.
- *
- * @return the current mouse point location
- */
public Point getMousePoint() {
return mousePoint;
}
- /**
- * Sets the mouse point location.
- *
- * @param point the new mouse point location
- */
public void setMousePoint(Point point) {
this.mousePoint = point;
}
diff --git a/src/main/java/edu/rpi/legup/ui/boardview/ElementView.java b/src/main/java/edu/rpi/legup/ui/boardview/ElementView.java
index eab13cc1d..48a33493c 100644
--- a/src/main/java/edu/rpi/legup/ui/boardview/ElementView.java
+++ b/src/main/java/edu/rpi/legup/ui/boardview/ElementView.java
@@ -97,19 +97,8 @@ public void drawElement(Graphics2D graphics2D) {
graphics2D.drawString(String.valueOf(puzzleElement.getData()), xText, yText);
}
- /**
- * Draws additional elements for given PuzzleElements (default implementation does nothing).
- * Overriden in some puzzle element views.
- *
- * @param graphics2D the Graphics2D context to use for drawing
- */
public void drawGiven(Graphics2D graphics2D) {}
- /**
- * Draws a hover effect on the ElementView.
- *
- * @param graphics2D the Graphics2D context to use for drawing
- */
public void drawHover(Graphics2D graphics2D) {
graphics2D.setColor(hoverColor);
graphics2D.setStroke(new BasicStroke(2));
@@ -118,11 +107,6 @@ public void drawHover(Graphics2D graphics2D) {
location.x + 1.5f, location.y + 1.5f, size.width - 3, size.height - 3));
}
- /**
- * Draws a modified effect on the ElementView.
- *
- * @param graphics2D the Graphics2D context to use for drawing
- */
public void drawModified(Graphics2D graphics2D) {
graphics2D.setColor(puzzleElement.isValid() ? modifiedColor : invalidColor);
graphics2D.setStroke(new BasicStroke(2));
@@ -131,11 +115,6 @@ public void drawModified(Graphics2D graphics2D) {
location.x + 1.5f, location.y + 1.5f, size.width - 3, size.height - 3));
}
- /**
- * Draws a case rule picker on the ElementView.
- *
- * @param graphics2D the Graphics2D context to use for drawing
- */
public void drawCase(Graphics2D graphics2D) {
graphics2D.setColor(caseColor);
graphics2D.fill(
@@ -143,11 +122,6 @@ public void drawCase(Graphics2D graphics2D) {
location.x + 1.5f, location.y + 1.5f, size.width - 3, size.height - 3));
}
- /**
- * Creates an image representation of the ElementView.
- *
- * @return a BufferedImage of the ElementView
- */
public BufferedImage getImage() {
BufferedImage image =
new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
@@ -229,20 +203,10 @@ public void setPuzzleElement(PuzzleElement data) {
this.puzzleElement = data;
}
- /**
- * Checks if the case picker should be shown for this ElementView
- *
- * @return true if the case picker should be shown, false otherwise
- */
public boolean isShowCasePicker() {
return showCasePicker;
}
- /**
- * Sets whether the case picker should be shown for this ElementView
- *
- * @param showCasePicker true if the case picker should be shown, false otherwise
- */
public void setShowCasePicker(boolean showCasePicker) {
this.showCasePicker = showCasePicker;
}
@@ -450,21 +414,11 @@ public PathIterator getPathIterator(AffineTransform at, double flatness) {
.getPathIterator(at, flatness);
}
- /**
- * Returns the bounding rectangle of this ElementView
- *
- * @return a Rectangle representing the bounding box of this ElementView
- */
@Override
public Rectangle getBounds() {
return new Rectangle(location.x, location.y, size.width, size.height);
}
- /**
- * Returns the bounding rectangle of this ElementView as a Rectangle2D
- *
- * @return a Rectangle2D representing the bounding box of this ElementView
- */
@Override
public Rectangle2D getBounds2D() {
return new Rectangle(location.x, location.y, size.width, size.height);
diff --git a/src/main/java/edu/rpi/legup/ui/boardview/GridBoardView.java b/src/main/java/edu/rpi/legup/ui/boardview/GridBoardView.java
index e2b8bbc12..db5ccbc82 100644
--- a/src/main/java/edu/rpi/legup/ui/boardview/GridBoardView.java
+++ b/src/main/java/edu/rpi/legup/ui/boardview/GridBoardView.java
@@ -81,9 +81,9 @@ public void initSize() {
}
/**
- * Determines the proper dimension of the grid view based on grid size and element size.
+ * Helper method to determine the proper dimension of the grid view
*
- * @return the dimension of the grid view
+ * @return proper dimension of the grid view
*/
protected Dimension getProperSize() {
Dimension boardViewSize = new Dimension();
@@ -102,11 +102,6 @@ public DataSelectionView getSelectionPopupMenu() {
return null;
}
- /**
- * Gets the size of each element in the grid
- *
- * @return the dimension of each element in the grid
- */
public Dimension getElementSize() {
return this.elementSize;
}
diff --git a/src/main/java/edu/rpi/legup/ui/boardview/SelectionItemView.java b/src/main/java/edu/rpi/legup/ui/boardview/SelectionItemView.java
index 6a1429a61..e3bb3592f 100644
--- a/src/main/java/edu/rpi/legup/ui/boardview/SelectionItemView.java
+++ b/src/main/java/edu/rpi/legup/ui/boardview/SelectionItemView.java
@@ -58,11 +58,6 @@ public SelectionItemView(PuzzleElement data) {
this(data, (Integer) data.getData());
}
- /**
- * Gets the PuzzleElement associated with this menu item
- *
- * @return the PuzzleElement associated with this menu item
- */
public PuzzleElement getData() {
return data;
}
diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RuleFrame.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RuleFrame.java
index b14091351..cf01f3ede 100644
--- a/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RuleFrame.java
+++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RuleFrame.java
@@ -131,7 +131,7 @@ public void resetSize() {
/**
* Set the status label to a value. Use resetStatus to clear it.
*
- * @param check true if we want a checkbox, if false we'll have a red x box
+ * @param check true iff we want a check box, if false we'll have a red x box
* @param text the text we're setting the label to display
*/
public void setStatus(boolean check, String text) {
@@ -169,47 +169,22 @@ public RuleController getController() {
return controller;
}
- /**
- * Gets the JTabbedPane used in this frame
- *
- * @return the JTabbedPane instance
- */
public JTabbedPane getTabbedPane() {
return tabbedPane;
}
- /**
- * Gets the {@code DirectRulePanel} contained in this frame
- *
- * @return the {@link DirectRulePanel} instance
- */
public DirectRulePanel getDirectRulePanel() {
return DirectRulePanel;
}
- /**
- * Gets the {@code CaseRulePanel} contained in this frame
- *
- * @return the {@link CaseRulePanel} instance
- */
public CaseRulePanel getCasePanel() {
return casePanel;
}
- /**
- * Gets the {@code ContradictionRulePanel} contained in this frame
- *
- * @return the {@link ContradictionRulePanel} instance
- */
public ContradictionRulePanel getContradictionPanel() {
return contradictionPanel;
}
- /**
- * Gets the {@code SearchBarPanel} contained in this frame
- *
- * @return the {@link SearchBarPanel} instance
- */
public SearchBarPanel getSearchPanel() {
return searchPanel;
}
diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RulePanel.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RulePanel.java
index 85ddf82b5..c5e7327fd 100644
--- a/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RulePanel.java
+++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RulePanel.java
@@ -36,7 +36,7 @@ public RulePanel(RuleFrame ruleFrame) {
}
/**
- * Gets the array of rule buttons
+ * Gets the rule rule buttons
*
* @return rule ruleButtons
*/
@@ -338,58 +338,28 @@ public List extends Rule> getRules() {
return rules;
}
- /**
- * Gets the icon associated with this panel
- *
- * @return The ImageIcon associated with this panel
- */
public ImageIcon getIcon() {
return icon;
}
- /**
- * Sets the icon for this panel
- *
- * @return the ImageIcon associated with this panel
- */
public void setIcon(ImageIcon icon) {
this.icon = icon;
}
- /**
- * Gets the name of this panel
- *
- * @return the name of this panel in a String
- */
@Override
public String getName() {
return name;
}
- /**
- * Sets the name of this panel
- *
- * @param name the name to set for this panel
- */
@Override
public void setName(String name) {
this.name = name;
}
- /**
- * Gets the tooltip text associated with this panel
- *
- * @return the tooltip text of this panel
- */
public String getToolTip() {
return toolTip;
}
- /**
- * Sets the tooltip text for this panel
- *
- * @param toolTip the tooltip text to set for this panel
- */
public void setToolTip(String toolTip) {
this.toolTip = toolTip;
}
diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeElementView.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeElementView.java
index e5e523e11..0233ec6d4 100644
--- a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeElementView.java
+++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeElementView.java
@@ -41,7 +41,7 @@ protected TreeElementView(TreeElementType type, TreeElement treeElement) {
public abstract void draw(Graphics2D graphics2D);
/**
- * Gets the span for the subtree rooted at this view
+ * Gets the span for the sub tree rooted at this view
*
* @return span bounded y span
*/
@@ -50,7 +50,7 @@ public double getSpan() {
}
/**
- * Sets the span for the subtree rooted at this view.
+ * Sets the span for the sub tree rooted at this view.
*
* @param span bounded y span
*/
diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeNodeView.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeNodeView.java
index c9aedaef3..8e9562d10 100644
--- a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeNodeView.java
+++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeNodeView.java
@@ -266,21 +266,11 @@ public int getRadius() {
return RADIUS;
}
- /**
- * Returns the bounding rectangle of this TreeNodeView
- *
- * @return a Rectangle representing the bounding box of this TreeNodeView
- */
@Override
public Rectangle getBounds() {
return new Rectangle(location.x, location.y, DIAMETER, DIAMETER);
}
- /**
- * Returns the bounding rectangle of this TreeNodeView as a Rectangle2D
- *
- * @return a Rectangle2D representing the bounding box of this TreeNodeView
- */
@Override
public Rectangle2D getBounds2D() {
return new Rectangle(location.x, location.y, DIAMETER, DIAMETER);
diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreePanel.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreePanel.java
index 936b0de95..9efeb8dfb 100644
--- a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreePanel.java
+++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreePanel.java
@@ -66,20 +66,10 @@ public TreePanel(/*LegupUI legupUI*/ ) {
updateStatusTimer = 0;
}
- /**
- * Repaints the tree view with the provided {@link Tree} object
- *
- * @param tree the {@link Tree} object to update the view with
- */
public void repaintTreeView(Tree tree) {
treeView.updateTreeView(tree);
}
- /**
- * Updates the status of the panel based on changes to the {@link Board}
- *
- * @param board the {@link Board} object representing the current board state
- */
public void boardDataChanged(Board board) {
modifiedSinceSave = true;
modifiedSinceUndoPush = true;
@@ -99,33 +89,18 @@ public void updateStatus() {
this.status.setText("");
}
- /**
- * Updates the status display with the given status string
- *
- * @param statusString the status string to display
- */
public void updateStatus(String statusString) {
status.setForeground(Color.BLACK);
status.setFont(MaterialFonts.REGULAR);
status.setText(statusString);
}
- /**
- * Updates the status display as an error with an error message
- *
- * @param error the error message to display
- */
public void updateError(String error) {
status.setForeground(Color.RED);
status.setFont(MaterialFonts.ITALIC);
status.setText(error);
}
- /**
- * Gets the {@link TreeView} instance associated with this panel
- *
- * @return the {@link TreeView} instance
- */
public TreeView getTreeView() {
return treeView;
}
diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeToolBarButton.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeToolBarButton.java
index 232498723..2718f733d 100644
--- a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeToolBarButton.java
+++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeToolBarButton.java
@@ -9,12 +9,6 @@ public class TreeToolBarButton extends JButton {
private TreeToolBarName name;
private final Dimension MINIMUM_DIMENSION = new Dimension(60, 60);
- /**
- * Constructs a {@code TreeToolBarButton} with the specified icon and name.
- *
- * @param imageIcon the {@link ImageIcon} to be displayed on the button
- * @param name the {@link TreeToolBarName} associated with this button
- */
public TreeToolBarButton(ImageIcon imageIcon, TreeToolBarName name) {
super(imageIcon);
this.name = name;
@@ -23,11 +17,6 @@ public TreeToolBarButton(ImageIcon imageIcon, TreeToolBarName name) {
this.setFocusPainted(false);
}
- /**
- * Gets the {@link TreeToolBarName} associated with this button
- *
- * @return the {@link TreeToolBarName} associated with this button
- */
public TreeToolBarName getToolBarName() {
return name;
}
diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeToolBarName.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeToolBarName.java
index 3aec664be..c805021be 100644
--- a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeToolBarName.java
+++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeToolBarName.java
@@ -1,9 +1,5 @@
package edu.rpi.legup.ui.proofeditorui.treeview;
-/**
- * {@code TreeToolBarName} defines the names of actions represented by buttons in the tree toolbar.
- * These actions are used for managing tree elements within the UI.
- */
public enum TreeToolBarName {
ADD_CHILD,
DEL_CHILD,
diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeTransitionView.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeTransitionView.java
index 5a3aa7d5c..70546616d 100644
--- a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeTransitionView.java
+++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeTransitionView.java
@@ -271,67 +271,47 @@ public void removeParentView(TreeNodeView nodeView) {
}
}
- /**
- * Gets the x-coordinate of the end point of the transition arrow
- *
- * @return the x-coordinate of the end point
- */
+ public Point getEndPoint() {
+ return endPoint;
+ }
+
+ public void setEndPoint(Point endPoint) {
+ this.endPoint = endPoint;
+ }
+
public int getEndX() {
return endPoint.x;
}
- /**
- * Sets the x-coordinate of the end point of the transition arrow
- *
- * @param x the new x-coordinate of the end point
- */
public void setEndX(int x) {
this.endPoint.x = x;
}
- /**
- * Gets the y-coordinate of the end point of the transition arrow
- *
- * @return the y-coordinate of the end point
- */
public int getEndY() {
return endPoint.y;
}
- /**
- * Sets the y-coordinate of the end point of the transition arrow
- *
- * @param y the new y-coordinate of the end point
- */
public void setEndY(int y) {
this.endPoint.y = y;
}
- /**
- * Gets the start point at the specified index from the list of start points
- *
- * @param index the index of the start point to retrieve
- * @return the start point at the specified index, or null if the index is out of range
- */
+ public List getLineStartPoints() {
+ return lineStartPoints;
+ }
+
+ public void setLineStartPoints(List lineStartPoints) {
+ this.lineStartPoints = lineStartPoints;
+ }
+
public Point getLineStartPoint(int index) {
return index < lineStartPoints.size() ? lineStartPoints.get(index) : null;
}
- /**
- * Returns the bounding rectangle of this TreeTransitionView
- *
- * @return a Rectangle representing the bounding box of this TreeTransitionView
- */
@Override
public Rectangle getBounds() {
return arrowhead.getBounds();
}
- /**
- * Returns the bounding rectangle of this TreeTransitionView as a Rectangle2D
- *
- * @return a Rectangle2D representing the bounding box of this TreeTransitionView
- */
@Override
public Rectangle2D getBounds2D() {
return arrowhead.getBounds2D();
diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeView.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeView.java
index 65f49ff0a..3d74d1e08 100644
--- a/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeView.java
+++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/treeview/TreeView.java
@@ -57,11 +57,6 @@ public class TreeView extends ScrollView implements ITreeListener {
private TreeViewSelection selection;
- /**
- * Constructs a {@code TreeView} with the specified {@code TreeController}.
- *
- * @param treeController the {@code TreeController} used to manage tree operations
- */
public TreeView(TreeController treeController) {
super(treeController);
currentStateBoxes = new ArrayList<>();
@@ -73,11 +68,6 @@ public TreeView(TreeController treeController) {
selection = new TreeViewSelection();
}
- /**
- * Gets the current tree view selection
- *
- * @return the {@code TreeViewSelection} object representing the current selection
- */
public TreeViewSelection getSelection() {
return selection;
}
@@ -147,11 +137,6 @@ private TreeElementView getTreeElementView(Point point, TreeElementView elementV
return null;
}
- /**
- * Updates the tree view with the specified {@code Tree}
- *
- * @param tree the {@code Tree} to display in the view
- */
public void updateTreeView(Tree tree) {
this.tree = tree;
if (selection.getSelectedViews().size() == 0) {
@@ -189,9 +174,8 @@ public void reset() {
* button is selected
*/
public void zoomFit() {
- final int MIN_HEIGHT = 200;
- double fitWidth = (viewport.getWidth() - 7.0) / (getSize().width - 75);
- double fitHeight = (viewport.getHeight()) / Math.max((getSize().height - 115), MIN_HEIGHT);
+ double fitWidth = (viewport.getWidth() - 8.0) / (getSize().width - 200);
+ double fitHeight = (viewport.getHeight() - 8.0) / (getSize().height - 120);
zoomTo(Math.min(fitWidth, fitHeight));
viewport.setViewPosition(new Point(0, viewport.getHeight() / 2));
}
@@ -240,11 +224,6 @@ public void layoutContainer(Container parent) {
};
}
- /**
- * Draws the tree view on the provided {@code Graphics2D} context
- *
- * @param graphics2D the {@code Graphics2D} context to draw on
- */
public void draw(Graphics2D graphics2D) {
currentStateBoxes.clear();
Tree tree = GameBoardFacade.getInstance().getTree();
@@ -276,12 +255,6 @@ public void zoomReset() {
viewport.setViewPosition(new Point(0, 0));
}
- /**
- * Recursively redraws the tree starting from the specified node view
- *
- * @param graphics2D the {@code Graphics2D} context to draw on
- * @param nodeView the {@code TreeNodeView} to start drawing from
- */
private void redrawTree(Graphics2D graphics2D, TreeNodeView nodeView) {
if (nodeView != null) {
nodeView.draw(graphics2D);
@@ -292,11 +265,6 @@ private void redrawTree(Graphics2D graphics2D, TreeNodeView nodeView) {
}
}
- /**
- * Removes the specified {@code TreeElementView} from the tree view
- *
- * @param view the {@code TreeElementView} to remove
- */
public void removeTreeElement(TreeElementView view) {
if (view.getType() == NODE) {
TreeNodeView nodeView = (TreeNodeView) view;
@@ -456,17 +424,8 @@ public TreeElementView getElementView(TreeElement element) {
return viewMap.get(element);
}
- /**
- * Removes the specified {@link TreeNode} and its associated views
- *
- * @param node the {@link TreeNode} to be removed
- */
- public void removeTreeNode(TreeNode node) {
+ private void removeTreeNode(TreeNode node) {
viewMap.remove(node);
- if (node.getChildren() != null) {
- node.getChildren().forEach(t -> removeTreeTransition(t));
- }
-
List children = node.getChildren();
// if child is a case rule, unlock ancestor elements
@@ -493,13 +452,11 @@ public void removeTreeNode(TreeNode node) {
}
// set modifiable if started modifiable
- boolean modifiable = false;
- if (tree != null) {
- tree.getRootNode()
- .getBoard()
- .getPuzzleElement(oldElement)
- .isModifiable();
- }
+ boolean modifiable =
+ tree.getRootNode()
+ .getBoard()
+ .getPuzzleElement(oldElement)
+ .isModifiable();
// unmodifiable if already modified
TreeNode modNode = ancestor.getParent().getParents().get(0);
@@ -517,14 +474,10 @@ public void removeTreeNode(TreeNode node) {
}
}
}
+ node.getChildren().forEach(t -> removeTreeTransition(t));
}
- /**
- * Removes the specified {@link TreeTransition} and its associated views
- *
- * @param trans the {@link TreeTransition} to be removed
- */
- public void removeTreeTransition(TreeTransition trans) {
+ private void removeTreeTransition(TreeTransition trans) {
viewMap.remove(trans);
if (trans.getChildNode() != null) {
removeTreeNode(trans.getChildNode());
@@ -561,16 +514,12 @@ public void removeTreeTransition(TreeTransition trans) {
}
}
- /**
- * Adds the specified {@link TreeNode} and its associated views
- *
- * @param node the {@link TreeNode} to be added
- */
private void addTreeNode(TreeNode node) {
TreeTransition parent = node.getParent();
- TreeNodeView nodeView = new TreeNodeView(node);
+ TreeNodeView nodeView = new TreeNodeView(node);
TreeTransitionView parentView = (TreeTransitionView) viewMap.get(parent);
+
nodeView.setParentView(parentView);
parentView.setChildView(nodeView);
@@ -605,25 +554,20 @@ private void addTreeNode(TreeNode node) {
}
}
- /**
- * Adds the specified {@link TreeTransition} and its associated views
- *
- * @param trans The {@link TreeTransition} to be added
- */
private void addTreeTransition(TreeTransition trans) {
List parents = trans.getParents();
- TreeTransitionView transView = new TreeTransitionView(trans);
+ TreeTransitionView transView = new TreeTransitionView(trans);
for (TreeNode parent : parents) {
TreeNodeView parentNodeView = (TreeNodeView) viewMap.get(parent);
transView.addParentView(parentNodeView);
parentNodeView.addChildrenView(transView);
- viewMap.put(trans, transView);
-
// if transition is a new case rule, lock dependent ancestor elements
Rule rule = trans.getRule();
if (rule instanceof CaseRule && parent.getChildren().size() == 1) {
+ CaseRule caseRule = (CaseRule) rule;
+
List ancestors = parent.getAncestors();
for (TreeNode ancestor : ancestors) {
// for all ancestors but root
@@ -640,16 +584,15 @@ private void addTreeTransition(TreeTransition trans) {
}
}
+ viewMap.put(trans, transView);
+
if (trans.getChildNode() != null) {
addTreeNode(trans.getChildNode());
}
}
- /**
- * Draws the tree using the provided {@link Graphics2D} object
- *
- * @param graphics2D the {@link Graphics2D} object used for drawing the tree
- */
+ /// New Draw Methods
+
public void drawTree(Graphics2D graphics2D) {
if (tree == null) {
LOGGER.error("Unable to draw tree.");
@@ -675,11 +618,6 @@ public void drawTree(Graphics2D graphics2D) {
}
}
- /**
- * Creates views for the given {@link TreeNodeView} and its children
- *
- * @param nodeView the {@link TreeNodeView} for which to create views
- */
public void createViews(TreeNodeView nodeView) {
if (nodeView != null) {
viewMap.put(nodeView.getTreeElement(), nodeView);
diff --git a/src/main/java/edu/rpi/legup/ui/puzzleeditorui/elementsview/ElementFrame.java b/src/main/java/edu/rpi/legup/ui/puzzleeditorui/elementsview/ElementFrame.java
index 1619ecbaa..bcb69f6c0 100644
--- a/src/main/java/edu/rpi/legup/ui/puzzleeditorui/elementsview/ElementFrame.java
+++ b/src/main/java/edu/rpi/legup/ui/puzzleeditorui/elementsview/ElementFrame.java
@@ -19,30 +19,45 @@ public class ElementFrame extends JPanel {
private EditorElementController controller;
public ElementFrame(EditorElementController controller) {
-
this.controller = controller;
-
+ MaterialTabbedPaneUI tabOverride =
+ new MaterialTabbedPaneUI() {
+ // this prevents the tabs from moving around when you select them
+ @Override
+ protected boolean shouldRotateTabRuns(int i) {
+ return false;
+ }
+ };
+
+ this.tabbedPane = new JTabbedPane();
+ tabbedPane.setUI(tabOverride);
JLabel status = new JLabel("", SwingConstants.CENTER);
this.buttonGroup = new ButtonGroup();
- // Parent panel to hold all elements
- JPanel elementPanel = new JPanel();
- elementPanel.setLayout(new BoxLayout(elementPanel, BoxLayout.Y_AXIS));
+ nonPlaceableElementPanel = new NonPlaceableElementPanel(this);
+ // nonPlaceableElementPanel.setMinimumSize(new Dimension(100,200));
+ tabbedPane.addTab(
+ nonPlaceableElementPanel.getName(),
+ nonPlaceableElementPanel.getIcon(),
+ new JScrollPane(nonPlaceableElementPanel),
+ nonPlaceableElementPanel.getToolTip());
placeableElementPanel = new PlaceableElementPanel(this);
- placeableElementPanel.setMinimumSize(new Dimension(100, 200));
- elementPanel.add(new JScrollPane(placeableElementPanel));
+ // placeableElementPanel.setMinimuSize(new Dimension(100,200));
+ tabbedPane.addTab(
+ placeableElementPanel.getName(),
+ placeableElementPanel.getIcon(),
+ new JScrollPane(placeableElementPanel),
+ placeableElementPanel.getToolTip());
+ tabbedPane.setTabPlacement(JTabbedPane.TOP);
- // Set layout and dimensions for the main panel
setLayout(new BorderLayout());
setMinimumSize(new Dimension(250, 256));
setPreferredSize(new Dimension(330, 256));
- // Add components to the main panel
- add(elementPanel, BorderLayout.CENTER);
+ add(tabbedPane);
add(status, BorderLayout.SOUTH);
- // Center-align the titled border
TitledBorder title = BorderFactory.createTitledBorder("Elements");
title.setTitleJustification(TitledBorder.CENTER);
setBorder(title);
@@ -60,9 +75,8 @@ public ButtonGroup getButtonGroup() {
// }
public void setElements(Puzzle puzzle) {
- if (puzzle != null) {
- placeableElementPanel.setElements(puzzle.getPlaceableElements());
- }
+ nonPlaceableElementPanel.setElements(puzzle.getNonPlaceableElements());
+ placeableElementPanel.setElements(puzzle.getPlaceableElements());
}
public EditorElementController getController() {
diff --git a/src/main/java/edu/rpi/legup/ui/puzzleeditorui/elementsview/ElementPanel.java b/src/main/java/edu/rpi/legup/ui/puzzleeditorui/elementsview/ElementPanel.java
index 70826d25c..46198e226 100644
--- a/src/main/java/edu/rpi/legup/ui/puzzleeditorui/elementsview/ElementPanel.java
+++ b/src/main/java/edu/rpi/legup/ui/puzzleeditorui/elementsview/ElementPanel.java
@@ -20,7 +20,7 @@ public ElementPanel(ElementFrame eFrame) {
setLayout(new WrapLayout());
}
- public int setElements(List extends Element> elements) {
+ public void setElements(List extends Element> elements) {
this.elements = elements;
clearButtons();
@@ -38,7 +38,6 @@ public int setElements(List extends Element> elements) {
add(elementButtons[i]);
}
revalidate();
- return elements.size();
}
protected void clearButtons() {
diff --git a/src/main/resources/edu/rpi/legup/images/Legup/Reset.png b/src/main/resources/edu/rpi/legup/images/Legup/Reset.png
deleted file mode 100644
index fd6ffefa0..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/Legup/Reset.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/CompleteRowColumnDirectRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/CompleteRowColumnDirectRule.png
index 27ccec972..a74654d43 100644
Binary files a/src/main/resources/edu/rpi/legup/images/binary/rules/CompleteRowColumnDirectRule.png and b/src/main/resources/edu/rpi/legup/images/binary/rules/CompleteRowColumnDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/DuplicateRowOrColumnContradictionRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/DuplicateRowOrColumnContradictionRule.png
new file mode 100644
index 000000000..214aa5348
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/binary/rules/DuplicateRowOrColumnContradictionRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/OneOrZeroCaseRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/OneOrZeroCaseRule.png
new file mode 100644
index 000000000..73072f2ce
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/binary/rules/OneOrZeroCaseRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/OneTileGapDirectRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/OneTileGapDirectRule.png
new file mode 100644
index 000000000..b68f67e44
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/binary/rules/OneTileGapDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/PreventTrioDirectRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/PreventTrioDirectRule.png
deleted file mode 100644
index ed0701f26..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/binary/rules/PreventTrioDirectRule.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/RepeatedRowColumnContradictionRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/RepeatedRowColumnContradictionRule.png
deleted file mode 100644
index 5cc030a76..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/binary/rules/RepeatedRowColumnContradictionRule.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/SaveBlockerDirectRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/SaveBlockerDirectRule.png
deleted file mode 100644
index 7695ae2da..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/binary/rules/SaveBlockerDirectRule.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/SurroundPairDirectRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/SurroundPairDirectRule.png
new file mode 100644
index 000000000..67a4e47f3
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/binary/rules/SurroundPairDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/ThreeAdjacentContradictionRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/ThreeAdjacentContradictionRule.png
new file mode 100644
index 000000000..862408b63
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/binary/rules/ThreeAdjacentContradictionRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/TrioContradictionRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/TrioContradictionRule.png
deleted file mode 100644
index e292ec9fa..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/binary/rules/TrioContradictionRule.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/UnbalancedRowColumnContradictionRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/UnbalancedRowColumnContradictionRule.png
index bd66c16a7..029bd12ac 100644
Binary files a/src/main/resources/edu/rpi/legup/images/binary/rules/UnbalancedRowColumnContradictionRule.png and b/src/main/resources/edu/rpi/legup/images/binary/rules/UnbalancedRowColumnContradictionRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/UniqueRowColumnDirectRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/UniqueRowColumnDirectRule.png
deleted file mode 100644
index 7785d198c..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/binary/rules/UniqueRowColumnDirectRule.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/WastedBlockerContradictionRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/WastedBlockerContradictionRule.png
deleted file mode 100644
index 8813d7956..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/binary/rules/WastedBlockerContradictionRule.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/rules/ZeroOrOneCaseRule.png b/src/main/resources/edu/rpi/legup/images/binary/rules/ZeroOrOneCaseRule.png
deleted file mode 100644
index 7394bff91..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/binary/rules/ZeroOrOneCaseRule.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/tiles/NumberTile.png b/src/main/resources/edu/rpi/legup/images/binary/tiles/NumberTile.png
deleted file mode 100644
index 41fb61dfa..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/binary/tiles/NumberTile.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/binary/tiles/UnknownTile.png b/src/main/resources/edu/rpi/legup/images/binary/tiles/UnknownTile.png
deleted file mode 100644
index 9ab9f7481..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/binary/tiles/UnknownTile.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/cases/CellForNumber.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/cases/CellForNumber.png
index e8cca03b4..7ab0cdbef 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/cases/CellForNumber.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/cases/CellForNumber.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/cases/NumberForCell.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/cases/NumberForCell.png
index 307d0d754..fedbbbac8 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/cases/NumberForCell.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/cases/NumberForCell.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/DuplicateNumber.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/DuplicateNumber.png
index 6ab3cd769..7ba489c2b 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/DuplicateNumber.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/DuplicateNumber.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/ExceedingVisibility.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/ExceedingVisibility.png
index 2f5b5237d..ff999f4bc 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/ExceedingVisibility.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/ExceedingVisibility.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/InsufficientVisibility.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/InsufficientVisibility.png
index 285451ba1..cfe04a503 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/InsufficientVisibility.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/InsufficientVisibility.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/PreemptiveVisibility.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/PreemptiveVisibility.png
index 6c4a6e457..6d330baa6 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/PreemptiveVisibility.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/PreemptiveVisibility.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/UnresolvedCell.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/UnresolvedCell.png
index ae78caf49..76947671d 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/UnresolvedCell.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/UnresolvedCell.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/UnresolvedNumber.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/UnresolvedNumber.png
index 602f62702..8862702f1 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/UnresolvedNumber.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/contradictions/UnresolvedNumber.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/FixedMax.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/FixedMax.png
index 86a4ee8a0..8a26bbfeb 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/FixedMax.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/FixedMax.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/LastCell.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/LastCell.png
index 8db8a3bbf..216a0f3a1 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/LastCell.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/LastCell.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/LastNumber.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/LastNumber.png
index dcf4cb2b8..1e0555648 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/LastNumber.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/LastNumber.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/NEdge.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/NEdge.png
index b238b36aa..d3dd36bbc 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/NEdge.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/NEdge.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/OneEdge.png b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/OneEdge.png
index 6841a8034..40d6ff65f 100644
Binary files a/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/OneEdge.png and b/src/main/resources/edu/rpi/legup/images/skyscrapers/rules/OneEdge.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/tiles/UnknownTile.png b/src/main/resources/edu/rpi/legup/images/starbattle/UnknownTile.png
similarity index 100%
rename from src/main/resources/edu/rpi/legup/images/sudoku/tiles/UnknownTile.png
rename to src/main/resources/edu/rpi/legup/images/starbattle/UnknownTile.png
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/black.gif b/src/main/resources/edu/rpi/legup/images/starbattle/black.gif
new file mode 100644
index 000000000..13381a717
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/black.gif differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/cases/StarOrEmptyCaseRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/cases/StarOrEmptyCaseRule.png
new file mode 100644
index 000000000..0383711bb
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/cases/StarOrEmptyCaseRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/contradictions/ClashingOrbitContradictionRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/contradictions/ClashingOrbitContradictionRule.png
new file mode 100644
index 000000000..d25340b40
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/contradictions/ClashingOrbitContradictionRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/contradictions/TooFewStarsContradictionRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/contradictions/TooFewStarsContradictionRule.png
new file mode 100644
index 000000000..cc019752f
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/contradictions/TooFewStarsContradictionRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/contradictions/TooManyStarsContradictionRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/contradictions/TooManyStarsContradictionRule.png
new file mode 100644
index 000000000..b468ae6f6
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/contradictions/TooManyStarsContradictionRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/empty.gif b/src/main/resources/edu/rpi/legup/images/starbattle/empty.gif
new file mode 100644
index 000000000..38b91d0a2
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/empty.gif differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/BlackOutDirectRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/BlackOutDirectRule.png
new file mode 100644
index 000000000..f72fd7d7f
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/rules/BlackOutDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/ColumnsWithinRegionsDirectRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/ColumnsWithinRegionsDirectRule.png
new file mode 100644
index 000000000..1a88e9d07
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/rules/ColumnsWithinRegionsDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/ColumnsWithinRowsDirectRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/ColumnsWithinRowsDirectRule.png
new file mode 100644
index 000000000..24fb0d48a
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/rules/ColumnsWithinRowsDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/FinishWithStarDirectRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/FinishWithStarDirectRule.png
new file mode 100644
index 000000000..11cfbf899
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/rules/FinishWithStarDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/RegionsWithinColumnsDirectRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/RegionsWithinColumnsDirectRule.png
new file mode 100644
index 000000000..fde683dcd
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/rules/RegionsWithinColumnsDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/RegionsWithinRowsDirectRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/RegionsWithinRowsDirectRule.png
new file mode 100644
index 000000000..30170df40
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/rules/RegionsWithinRowsDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/RowsWithinColumnsDirectRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/RowsWithinColumnsDirectRule.png
new file mode 100644
index 000000000..bac64a87c
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/rules/RowsWithinColumnsDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/RowsWithinRegionsDirectRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/RowsWithinRegionsDirectRule.png
new file mode 100644
index 000000000..8907e0475
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/rules/RowsWithinRegionsDirectRule.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/SurroundStar.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/SurroundStar.png
new file mode 100644
index 000000000..13287f779
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/rules/SurroundStar.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/star.gif b/src/main/resources/edu/rpi/legup/images/starbattle/star.gif
new file mode 100644
index 000000000..e289b287a
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/starbattle/star.gif differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/tiles/NumberTile.png b/src/main/resources/edu/rpi/legup/images/starbattle/white.gif
similarity index 82%
rename from src/main/resources/edu/rpi/legup/images/sudoku/tiles/NumberTile.png
rename to src/main/resources/edu/rpi/legup/images/starbattle/white.gif
index 5a8540d02..fc2c683eb 100644
Binary files a/src/main/resources/edu/rpi/legup/images/sudoku/tiles/NumberTile.png and b/src/main/resources/edu/rpi/legup/images/starbattle/white.gif differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/AdvancedDeduction.png b/src/main/resources/edu/rpi/legup/images/sudoku/AdvancedDeduction.png
new file mode 100644
index 000000000..d51538baf
Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/sudoku/AdvancedDeduction.png differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoSolution.png b/src/main/resources/edu/rpi/legup/images/sudoku/NoSolution.png
similarity index 100%
rename from src/main/resources/edu/rpi/legup/images/sudoku/rules/NoSolution.png
rename to src/main/resources/edu/rpi/legup/images/sudoku/NoSolution.png
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/PossibleValues.png b/src/main/resources/edu/rpi/legup/images/sudoku/PossibleValues.png
similarity index 100%
rename from src/main/resources/edu/rpi/legup/images/sudoku/rules/PossibleValues.png
rename to src/main/resources/edu/rpi/legup/images/sudoku/PossibleValues.png
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/RepeatedNumber.png b/src/main/resources/edu/rpi/legup/images/sudoku/RepeatedNumber.png
similarity index 100%
rename from src/main/resources/edu/rpi/legup/images/sudoku/rules/RepeatedNumber.png
rename to src/main/resources/edu/rpi/legup/images/sudoku/RepeatedNumber.png
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/forcedByDeduction.png b/src/main/resources/edu/rpi/legup/images/sudoku/forcedByDeduction.png
similarity index 100%
rename from src/main/resources/edu/rpi/legup/images/sudoku/rules/forcedByDeduction.png
rename to src/main/resources/edu/rpi/legup/images/sudoku/forcedByDeduction.png
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/forcedByElimination.png b/src/main/resources/edu/rpi/legup/images/sudoku/forcedByElimination.png
similarity index 100%
rename from src/main/resources/edu/rpi/legup/images/sudoku/rules/forcedByElimination.png
rename to src/main/resources/edu/rpi/legup/images/sudoku/forcedByElimination.png
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number.png b/src/main/resources/edu/rpi/legup/images/sudoku/possible_cells_number.png
similarity index 100%
rename from src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number.png
rename to src/main/resources/edu/rpi/legup/images/sudoku/possible_cells_number.png
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoCellForNumberColumn.png b/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoCellForNumberColumn.png
deleted file mode 100644
index 9dcade64b..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoCellForNumberColumn.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoCellForNumberRegion.png b/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoCellForNumberRegion.png
deleted file mode 100644
index 000dc8b68..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoCellForNumberRegion.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoCellForNumberRow.png b/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoCellForNumberRow.png
deleted file mode 100644
index f984f8365..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/sudoku/rules/NoCellForNumberRow.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number_column.png b/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number_column.png
deleted file mode 100644
index 2ebdc5823..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number_column.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number_region.png b/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number_region.png
deleted file mode 100644
index cc371e3e9..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number_region.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number_row.png b/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number_row.png
deleted file mode 100644
index 80476a428..000000000
Binary files a/src/main/resources/edu/rpi/legup/images/sudoku/rules/possible_cells_number_row.png and /dev/null differ
diff --git a/src/main/resources/edu/rpi/legup/images/sudoku/rules/tem.png b/src/main/resources/edu/rpi/legup/images/sudoku/tem.png
similarity index 100%
rename from src/main/resources/edu/rpi/legup/images/sudoku/rules/tem.png
rename to src/main/resources/edu/rpi/legup/images/sudoku/tem.png
diff --git a/src/main/resources/edu/rpi/legup/legup/config b/src/main/resources/edu/rpi/legup/legup/config
index e01767677..1ee9ed79c 100644
--- a/src/main/resources/edu/rpi/legup/legup/config
+++ b/src/main/resources/edu/rpi/legup/legup/config
@@ -34,22 +34,26 @@
fileCreationDisabled="false"/>
+ fileCreationDisabled="true"/>
+
-
-
-
+
+
+
diff --git a/src/test/java/puzzles/nurikabe/rules/FinishRoomCaseRuleTest.java b/src/test/java/puzzles/nurikabe/rules/FinishRoomCaseRuleTest.java
index 32a440d13..9ba7fb9f3 100644
--- a/src/test/java/puzzles/nurikabe/rules/FinishRoomCaseRuleTest.java
+++ b/src/test/java/puzzles/nurikabe/rules/FinishRoomCaseRuleTest.java
@@ -78,6 +78,34 @@ public void FinishRoomCaseRule_FinishRoomCaseRuleBaseTest() throws InvalidFileFo
NurikabeCell cell2 = board.getCell(4, 2);
ArrayList cases2 = RULE.getCases(board, cell2);
- Assert.assertEquals(9, cases2.size());
+ Assert.assertEquals(6, cases2.size()); // correctly stops generating possible cases after
+ // more than 5 (the max) is found. Would have generated 8 cases
+ // FinishRoomCaseRule finny = new FinishRoomCaseRule();
+ // finny.checkRuleRaw();
+ // "Invalid use of the case rule FinishRoom: This case rule must have 5 or less children."
+
+ // getErrorString in auto case rule
+ // should display "The selection can produce a max of 5 cases."
+ // AutoCaseRuleCommand autoCaseRuleCommand = new AutoCaseRuleCommand(elementView, selection,
+ // caseBoard.getCaseRule(), caseBoard, e);
+
+ // NurikabeBoard caseyBoard = (NurikabeBoard) cases2.get(0);
+ // NurikabeBoard caseyBoard2 = (NurikabeBoard) cases2.get(1);
+ // NurikabeBoard caseyBoard3 = (NurikabeBoard) cases2.get(2);
+ // NurikabeBoard caseyBoard4 = (NurikabeBoard) cases2.get(3);
+ // NurikabeBoard caseyBoard5 = (NurikabeBoard) cases2.get(4);
+ // NurikabeBoard caseyBoard6 = (NurikabeBoard) cases2.get(5);
+ // NurikabeBoard caseyBoard7 = (NurikabeBoard) cases2.get(6);
+ // NurikabeBoard caseyBoard8 = (NurikabeBoard) cases2.get(7);
+ //
+ // NurikabeType boardy1Type = caseyBoard.getCell(5,5).getType();
+ // NurikabeType boardy2Type = caseyBoard2.getCell(6,6).getType();
+ // NurikabeType boardy3Type = caseyBoard.getCell(5,5).getType();
+ // NurikabeType boardy4Type = caseyBoard2.getCell(6,6).getType();
+ // NurikabeType boardy5Type = caseyBoard.getCell(5,5).getType();
+ // NurikabeType boardy6Type = caseyBoard2.getCell(6,6).getType();
+ // NurikabeType boardy7Type = caseyBoard.getCell(5,5).getType();
+ // NurikabeType boardy8Type = caseyBoard2.getCell(6,6).getType();
+
}
}
diff --git a/src/test/java/puzzles/sudoku/rules/LastNumberForCellDirectRuleRegionTest.java b/src/test/java/puzzles/sudoku/rules/LastNumberForCellDirectRuleRegionTest.java
deleted file mode 100644
index f27f38d8a..000000000
--- a/src/test/java/puzzles/sudoku/rules/LastNumberForCellDirectRuleRegionTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package puzzles.sudoku.rules;
-
-import edu.rpi.legup.model.tree.TreeNode;
-import edu.rpi.legup.model.tree.TreeTransition;
-import edu.rpi.legup.puzzle.sudoku.Sudoku;
-import edu.rpi.legup.puzzle.sudoku.SudokuBoard;
-import edu.rpi.legup.puzzle.sudoku.SudokuCell;
-import edu.rpi.legup.puzzle.sudoku.rules.LastNumberForCellDirectRule;
-import edu.rpi.legup.save.InvalidFileFormatException;
-import legup.MockGameBoardFacade;
-import legup.TestUtilities;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class LastNumberForCellDirectRuleRegionTest {
- private static final LastNumberForCellDirectRule RULE = new LastNumberForCellDirectRule();
- private static Sudoku sudoku;
-
- @BeforeClass
- public static void setUp() {
- MockGameBoardFacade.getInstance();
- sudoku = new Sudoku();
- }
-
- @Test
- public void LastNumberForCellDirectRule_FullRegionTest() throws InvalidFileFormatException {
- // Import board and create transition
- TestUtilities.importTestBoard(
- "puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRegion", sudoku);
- TreeNode rootNode = sudoku.getTree().getRootNode();
- TreeTransition transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
-
- // Loop all numbers at point
- for (int i = 1; i < 10; i++) {
- // Reset board
- SudokuBoard board = (SudokuBoard) transition.getBoard();
- // Set cell
- SudokuCell cell1 = board.getCell(2, 5);
- cell1.setData(i);
- board.addModifiedData(cell1);
-
- // Test the case
- if (i == 9) {
- Assert.assertNull(RULE.checkRuleAt(transition, cell1));
- } else {
- Assert.assertNotNull(RULE.checkRuleAt(transition, cell1));
- }
- }
-
- // Import Board and create transition
- TestUtilities.importTestBoard(
- "puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRow", sudoku);
- rootNode = sudoku.getTree().getRootNode();
- transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
-
- // Loop all numbers at point
- for (int i = 1; i < 10; i++) {
- // Reset board
- SudokuBoard board = (SudokuBoard) transition.getBoard();
- // Set cell
- SudokuCell cell = board.getCell(4, 4);
- cell.setData(i);
- board.addModifiedData(cell);
-
- // Test the case
- if (i == 5) {
- Assert.assertNull(RULE.checkRuleAt(transition, cell));
- } else {
- Assert.assertNotNull(RULE.checkRuleAt(transition, cell));
- }
- }
-
- // Import Board and create transition
- TestUtilities.importTestBoard(
- "puzzles/sudoku/rules/LastNumberForCellDirectRule/FullMixed", sudoku);
- rootNode = sudoku.getTree().getRootNode();
- transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
-
- // Loop all numbers at point
- for (int i = 1; i < 10; i++) {
- // Reset board
- SudokuBoard board = (SudokuBoard) transition.getBoard();
- // Set cell
- SudokuCell cell = board.getCell(5, 3);
- cell.setData(i);
- board.addModifiedData(cell);
-
- // Test the case
- if (i == 2) {
- Assert.assertNull(RULE.checkRuleAt(transition, cell));
- } else {
- Assert.assertNotNull(RULE.checkRuleAt(transition, cell));
- }
- }
- }
-}
diff --git a/src/test/java/puzzles/sudoku/rules/RepeatedNumberContradictionRuleTest.java b/src/test/java/puzzles/sudoku/rules/RepeatedNumberContradictionRuleTest.java
deleted file mode 100644
index 704167a29..000000000
--- a/src/test/java/puzzles/sudoku/rules/RepeatedNumberContradictionRuleTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package puzzles.sudoku.rules;
-
-import edu.rpi.legup.model.tree.TreeNode;
-import edu.rpi.legup.model.tree.TreeTransition;
-import edu.rpi.legup.puzzle.sudoku.Sudoku;
-import edu.rpi.legup.puzzle.sudoku.SudokuBoard;
-import edu.rpi.legup.puzzle.sudoku.SudokuCell;
-import edu.rpi.legup.puzzle.sudoku.rules.RepeatedNumberContradictionRule;
-import edu.rpi.legup.save.InvalidFileFormatException;
-import legup.MockGameBoardFacade;
-import legup.TestUtilities;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class RepeatedNumberContradictionRuleTest {
- private static final RepeatedNumberContradictionRule RULE =
- new RepeatedNumberContradictionRule();
- private static Sudoku sudoku;
-
- @BeforeClass
- public static void setUp() {
- MockGameBoardFacade.getInstance();
- sudoku = new Sudoku();
- }
-
- @Test
- public void RepeatedNumberContradictionRule_GlobalTest() throws InvalidFileFormatException {
- // Import board and create transition
- TestUtilities.importTestBoard(
- "puzzles/sudoku/rules/RepeatedNumberContradictionRule/BlankBoard7", sudoku);
- TreeNode rootNode = sudoku.getTree().getRootNode();
- TreeTransition transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
-
- // Loop through every cell
- for (int i = 0; i < 81; i++) {
- // Reset board
- SudokuBoard board = (SudokuBoard) transition.getBoard();
- // Set cell
- int x = i / 9;
- int y = i % 9;
- if (x == 0 && y == 0) {
- continue;
- }
- SudokuCell cell = board.getCell(x, y);
- cell.setData(7);
-
- // Test the case
- if (x == 0 || y == 0 || (x < 3 && y < 3)) {
- Assert.assertNull(RULE.checkRuleAt(transition, cell));
- } else {
- Assert.assertNotNull(RULE.checkRuleAt(transition, cell));
- }
- cell.setData(0);
- }
- // Import board and create transition
- TestUtilities.importTestBoard(
- "puzzles/sudoku/rules/RepeatedNumberContradictionRule/BlankBoard4", sudoku);
- rootNode = sudoku.getTree().getRootNode();
- transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
-
- // Loop through every cell
- for (int i = 0; i < 81; i++) {
- // Reset board
- SudokuBoard board = (SudokuBoard) transition.getBoard();
- // Set cell
- int x = i / 9;
- int y = i % 9;
- if ((x == 3 && y == 0) || (x == 6 && y == 8)) {
- continue;
- }
- SudokuCell cell = board.getCell(x, y);
- cell.setData(4);
-
- // Test the case
- if ((x == 3 || y == 0 || x == 6 || y == 8)
- || (x > 2 && x < 6 && y < 3)
- || (x > 5 && y > 5)) {
- Assert.assertNull(RULE.checkRuleAt(transition, cell));
- } else {
- Assert.assertNotNull(RULE.checkRuleAt(transition, cell));
- }
- cell.setData(0);
- }
- }
-}
diff --git a/src/test/resources/puzzles/binary/rules/SurroundPairDirectRule/SurroundTwoZerosWithTwoOnes b/src/test/resources/puzzles/binary/rules/SurroundPairDirectRule/SurroundTwoZerosWithTwoOnes
deleted file mode 100644
index 026742fea..000000000
--- a/src/test/resources/puzzles/binary/rules/SurroundPairDirectRule/SurroundTwoZerosWithTwoOnes
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/src/test/resources/puzzles/binary/rules/SurroundPairDirectRule/test b/src/test/resources/puzzles/binary/rules/SurroundPairDirectRule/test
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/test/resources/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/SurroundTwoZerosWithTwoOnes b/src/test/resources/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/SurroundTwoZerosWithTwoOnes
deleted file mode 100644
index 026742fea..000000000
--- a/src/test/resources/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/SurroundTwoZerosWithTwoOnes
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/src/test/resources/puzzles/starbattle.rules/BlackoutDirectRule/ColumnBlackout b/src/test/resources/puzzles/starbattle.rules/BlackoutDirectRule/ColumnBlackout
new file mode 100644
index 000000000..ddcc4dc9a
--- /dev/null
+++ b/src/test/resources/puzzles/starbattle.rules/BlackoutDirectRule/ColumnBlackout
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/starbattle.rules/BlackoutDirectRule/RegionBlackout b/src/test/resources/puzzles/starbattle.rules/BlackoutDirectRule/RegionBlackout
new file mode 100644
index 000000000..f2a5b42d9
--- /dev/null
+++ b/src/test/resources/puzzles/starbattle.rules/BlackoutDirectRule/RegionBlackout
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
+
+ | | | |
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/starbattle.rules/BlackoutDirectRule/RowBlackout b/src/test/resources/puzzles/starbattle.rules/BlackoutDirectRule/RowBlackout
new file mode 100644
index 000000000..f2a5b42d9
--- /dev/null
+++ b/src/test/resources/puzzles/starbattle.rules/BlackoutDirectRule/RowBlackout
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
+
+
+ | | | |
+
+
+
+
+
+
+ | | | |
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/sudoku/rules/LastCellForNumberDirectRule/CorneredRegion b/src/test/resources/puzzles/sudoku/rules/LastCellForNumberDirectRule/CorneredRegion
deleted file mode 100644
index 4d3c57225..000000000
--- a/src/test/resources/puzzles/sudoku/rules/LastCellForNumberDirectRule/CorneredRegion
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
-
-
-
-
-
diff --git a/src/test/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullMixed b/src/test/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullMixed
deleted file mode 100644
index 55b501fec..000000000
--- a/src/test/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullMixed
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
\ No newline at end of file
diff --git a/src/test/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRegion b/src/test/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRegion
deleted file mode 100644
index 58fd02162..000000000
--- a/src/test/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRegion
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/src/test/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRow b/src/test/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRow
deleted file mode 100644
index 07e502ed9..000000000
--- a/src/test/resources/puzzles/sudoku/rules/LastNumberForCellDirectRule/FullRow
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
-
diff --git a/src/test/resources/puzzles/sudoku/rules/RepeatedNumberContradictionRule/BlankBoard4 b/src/test/resources/puzzles/sudoku/rules/RepeatedNumberContradictionRule/BlankBoard4
deleted file mode 100644
index abaa0ba6b..000000000
--- a/src/test/resources/puzzles/sudoku/rules/RepeatedNumberContradictionRule/BlankBoard4
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
- |
- |
-
-
-
-
-
diff --git a/src/test/resources/puzzles/sudoku/rules/RepeatedNumberContradictionRule/BlankBoard7 b/src/test/resources/puzzles/sudoku/rules/RepeatedNumberContradictionRule/BlankBoard7
deleted file mode 100644
index 5692dea64..000000000
--- a/src/test/resources/puzzles/sudoku/rules/RepeatedNumberContradictionRule/BlankBoard7
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
- |
-
-
-
-
-