Skip to content

Commit

Permalink
Various thermometer fixes (#767)
Browse files Browse the repository at this point in the history
* Fixed Short Truth Table case rule bug (#707)

* Revert "Bugfix 549 (#682)"

This reverts commit 5048ee6.

* Case rule test fix (#705)

Co-authored-by: Chase Grajeda <[email protected]>

* Rapid fix for STT case rules

Case rules broke at some point from legacy code or merge conflict. Provided is a quick fix in CaseRule and CaseRule_Generic

* Revert "Revert "Bugfix 549 (#682)"" (#706)

This reverts commit e9fe310.

---------

Co-authored-by: Chase-Grajeda <[email protected]>
Co-authored-by: Chase Grajeda <[email protected]>

* Skyscrapers Test Suite (#708)

* Simplify rule names

* Contradiction Test Suite

* checkstyle

* Update Exporter

* Revert "Update Exporter"

This reverts commit bae1a1f.

* Case Rule Test Suite

* Update SkyscrapersExporter.java

* allow null transitions

* Update TreeTransition.java

* Direct Rule Test Suite

* added tests pass

* Update DirectRule.java

Commenting out print statement

---------

Co-authored-by: ThisMatt <[email protected]>
Co-authored-by: ThisMatt <[email protected]>
Co-authored-by: Chase Grajeda <[email protected]>

* Skyscrapers puzzle editor (#720)

* Fixed Short Truth Table case rule bug (#707)

* Revert "Bugfix 549 (#682)"

This reverts commit 5048ee6.

* Case rule test fix (#705)

Co-authored-by: Chase Grajeda <[email protected]>

* Rapid fix for STT case rules

Case rules broke at some point from legacy code or merge conflict. Provided is a quick fix in CaseRule and CaseRule_Generic

* Revert "Revert "Bugfix 549 (#682)"" (#706)

This reverts commit e9fe310.

---------

Co-authored-by: Chase-Grajeda <[email protected]>
Co-authored-by: Chase Grajeda <[email protected]>

* Implementing Puzzle Editor

Removing Extraneous TreeTent Code
Allowing setting tile number

* Allow for editing clues on all axies

* Remove Extraneous Code

Removed functionality required for TreeTent but unnecessary for Skyscrapers

* Remove Extraneous Code

* Clue Tile in Editor

Editor now requires selecting the clue tile to edit clues
Added images for the tiles

* Merge branch 'dev' into skyscrapersPuzzleEditor

* Checkstyle Requirement

* Necessary Code

* Allow for test functionality

---------

Co-authored-by: Charles Tian <[email protected]>
Co-authored-by: Chase-Grajeda <[email protected]>
Co-authored-by: Chase Grajeda <[email protected]>

* Starting work on thermometer class

* Added Vial Class

Added the vial class which will be helpful for checking rules down the line

* Discontinuous Mercury Rule added

Added the Discontinuous Mercury contradiciton rule. Added variables to the ThermometerBoard class to keep track of the numbers on the perimiter of the board as well as accessors/setters for these variables. Rewrote a section of the Vials code to make sure cells are added correctly as well as added some accessor functions.

* Java Autoformatter (#728)

* Create java-autoformat.yml

* Setup Java

* Run spotless on repository

* Adding spotless dependency during build

* Adding spotless dependency during build

* Give permissions to run spotless

* Syntax

* Adding Debug Tag

* Check for modified files

Also removed debug tag

* Automated Java code formatting changes

* Test command syntax

* Correctly Identify modified files

* Test autoformatter

* Test autoformatter

* Test autoformatter

* Debugging

* Debugging

* Change method for detecting changed files

* Try building before calling spotless

* Update java-autoformat.yml

* Update java-autoformat.yml

* Update java-autoformat.yml

* Purposely bad formatting

Purposely adding some bad formatting to see if the auto-formatter triggers

* Update build.gradle

Disabling Checkstyle in build so the auto-formatter can trigger

* Update java-autoformat.yml

Have auto-formatter trigger when more commits are added to a pull request

* Debugging

* Adding more awful formatting

* Update java-autoformat.yml

* Changing repo URL

* Going back to checkout v1

* Trying URL change

* Trying out using env

* Trying this now...?

* Introducing more horrible changes

* Spotless formatting using google format v1.19.2

* Manual formatting fix

* Automated Java code formatting changes

* Different format type

Trying to get it to pass checkstyle

* Disable checkstyle temporarily

* Automated Java code formatting changes

* Default google formatting style

* Automated Java code formatting changes

* Comments and reordering styles

* Adding extra newlines

* Automated Java code formatting changes

* Changing tabs from 2 to 4 spaces

Supposedly the only difference that aosp makes is the 2 spaces?
Hopefully it doesn't break anything else

* Remove solo } requirement and reactivate checkstyle

* Automated Java code formatting changes

* Update checkstyle.xml

Removed problematic LeftCurly and RightCurly requirements

* Changing back to tabWidth

* Add newline to test formatter + build

* Automated Java code formatting changes

* Trying some ChatGPT stuff

* Getting rid of problematic experimentation

---------

Co-authored-by: Bram van Heuveln <[email protected]>
Co-authored-by: Charles Tian <[email protected]>
Co-authored-by: charlestian23 <[email protected]>

* Java21 (#714)

* Fixed Short Truth Table case rule bug (#707)

* Revert "Bugfix 549 (#682)"

This reverts commit 5048ee6.

* Case rule test fix (#705)

Co-authored-by: Chase Grajeda <[email protected]>

* Rapid fix for STT case rules

Case rules broke at some point from legacy code or merge conflict. Provided is a quick fix in CaseRule and CaseRule_Generic

* Revert "Revert "Bugfix 549 (#682)"" (#706)

This reverts commit e9fe310.

---------

Co-authored-by: Chase-Grajeda <[email protected]>
Co-authored-by: Chase Grajeda <[email protected]>

* Change Java version to 21 and setup JPackage to bundle Java with the app

* Setup gradle action for java 21

* Fix distribution in gradle.yml

* Fix java version in tests

* Fix java distribution in tests

* Add jpackage task

* Add Linux to jpackage task

* Fix jpackage task

* Add java setup to jpackage tasks

* Separate build into separate tasks for different operating systems

* Fix mac jpackage not working and changed names of artifacts

* Potential macos installer build fix

* Potential macos installer build fix attempt 2

* Potential macos installer build fix attempt 3

* Add quotes around executable name for macos installer

* Add logo and shortcut prompt

* Update version in build.gradle

* Make installer name different to app (It's a weird way to do it, it renames the file in a gradle task).

* Update java-autoformat.yml

Added check to make sure the pull request is not from a fork

---------

Co-authored-by: Charles Tian <[email protected]>
Co-authored-by: Chase-Grajeda <[email protected]>
Co-authored-by: Chase Grajeda <[email protected]>
Co-authored-by: charlestian23 <[email protected]>

* Update build.gradle (#741)

* Update build.gradle

Fixing the deprecation issues in the autoformatter

* Update build.gradle

* Update build.gradle

* Update to use Java 21

* Automated Java code formatting changes

---------

Co-authored-by: Bram van Heuveln <[email protected]>

* Updating to version 6.0.0

Changing to 6.0.0 since Java upgrade may break backwards compatibility

* Importer written

First draft of the importer written and setData refactored

* small bug fixes

* Added Puzzle Factory and Importer

Refactored a bunch of code so we now (in theory) import correctly

* Delete ThermometerExporter.java

* Added Thermometer to Config file

* Added necessary code to constructor

* Messing with Rule Recognition

* Fixing desyncs in repo

* More syncing and organizing files

* Small misc improvements

Further work on getting a file to open without errors

* Fixed verify vial method

---------

Co-authored-by: Charles Tian <[email protected]>
Co-authored-by: Chase-Grajeda <[email protected]>
Co-authored-by: Chase Grajeda <[email protected]>
Co-authored-by: ThisMatt <[email protected]>
Co-authored-by: ThisMatt <[email protected]>
Co-authored-by: Jaden Tian <[email protected]>
Co-authored-by: Bram van Heuveln <[email protected]>
Co-authored-by: charlestian23 <[email protected]>
Co-authored-by: Fisher Luba <[email protected]>
Co-authored-by: Fuzzabee <[email protected]>
  • Loading branch information
11 people authored Mar 20, 2024
1 parent 6e6a479 commit 8c6b96e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,24 @@ public void initializeBoard(Node node) throws InvalidFileFormatException {
if (boardElement.getElementsByTagName("vials").getLength() == 0) {
throw new InvalidFileFormatException("thermometer Importer: no puzzleElement found for board");
}
Element dataElement = (Element) boardElement.getElementsByTagName("cells").item(0);
NodeList elementDataList = dataElement.getElementsByTagName("cell");
Element dataElement = (Element) boardElement.getElementsByTagName("vials").item(0);
NodeList elementDataList = dataElement.getElementsByTagName("vial");

ThermometerBoard thermometerBoard = null;
if (!boardElement.getAttribute("size").isEmpty()) {
int size = Integer.parseInt(boardElement.getAttribute("size"));
thermometerBoard = new ThermometerBoard(size);
if (boardElement.getElementsByTagName("rowNumbers").getLength() != size) {
throw new InvalidFileFormatException("thermometer Importer: no rowNumbers found for board");
}
if (boardElement.getElementsByTagName("colNumbers").getLength() != size) {
throw new InvalidFileFormatException("thermometer Importer: no colNumbers found for board");
}
} else if (!boardElement.getAttribute("width").isEmpty() && !boardElement.getAttribute("height").isEmpty()) {
if (!boardElement.getAttribute("width").isEmpty() && !boardElement.getAttribute("height").isEmpty()) {
int width = Integer.parseInt(boardElement.getAttribute("width"));
int height = Integer.parseInt(boardElement.getAttribute("height"));
if (boardElement.getElementsByTagName("colNumbers").getLength() != width) {
throw new InvalidFileFormatException("thermometer Importer: no colNumbers found for board");

Element rowElement = (Element) boardElement.getElementsByTagName("rowNumbers").item(0);
NodeList rowNodeList = rowElement.getElementsByTagName("row");

Element colElement = (Element) boardElement.getElementsByTagName("colNumbers").item(0);
NodeList colNodeList = colElement.getElementsByTagName("col");

if (colNodeList.getLength() != width) {
throw new InvalidFileFormatException("Mismatch between width and number of colNums.\n colNodeList.length:" + colNodeList.getLength() + " width:" + width);
}
if (boardElement.getElementsByTagName("rowNumbers").getLength() != height) {
if (rowNodeList.getLength() != height) {
throw new InvalidFileFormatException("thermometer Importer: no rowNumbers found for board");
}
//TODO: potentially have to deal with size issues and non interactable cells
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ public static void importThermometerVial(Node node, ThermometerBoard board) thro


if(verifyVial(headX, headY, tipX, tipY, board)) {
System.out.println("Vial successfully created");
board.addVial(new ThermometerVial(headX, headY, tipX, tipY, board));
}
throw new InvalidFileFormatException("thermometer Importer: overlapping vials");
else {
throw new InvalidFileFormatException("thermometer Importer: overlapping vials");
}
}

private static boolean verifyVial(int headX, int headY, int tipX, int tipY, ThermometerBoard board) {
Expand All @@ -48,18 +51,19 @@ private static boolean verifyVial(int headX, int headY, int tipX, int tipY, Ther
int bottom = max(headY, tipY);

//verifying that every cell along path is currently unconstructed
for (int i = top; i < bottom; i++) {
for (int i = top; i <= bottom; i++) {
if(board.getCell(headX, i) != null) return false;
}
}
else if (headY == tipY) {
//finding start and end of Vial
int top = min(headX, tipX);
int bottom = max(headX, tipX);
//I have words to say to james
int left = min(headX, tipX);
int right = max(headX, tipX);

//verifying that every cell along path is currently unconstructed
for (int i = top; i < bottom; i++) {
if(board.getCell(headX, i) != null) return false;
for (int i = left; i <= right; i++) {
if(board.getCell(i, headY) != null) return false;
}
}
else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public MercuryOrBlockedCaseRule() {
super("THERM-CASE-0001",
"Mercury or Blocked",
"Each unassigned tile must be filled with mercury or blocked.",
"edu/rpi/legup/images/thermometers/MercOrBlocked.png");
"edu/rpi/legup/images/thermometer/MercOrBlocked.png");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public PriorFilledDirectRule() {
"THERM-BASC-0002",
"Prior is Filled",
"All tiles proceeding a filled tile in a vial must be filled",
"edu/rpi/legup/images/Thermometer/PriorIsFilled.png");
"edu/rpi/legup/images/thermometer/PriorIsFilled.png");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public RestEmptyDirectRule() {
"THERM-BASC-0001",
"Rest is Empty",
"All tiles following a blocked tile in a vial must be blocked",
"edu/rpi/legup/images/Thermometer/RestIsEmpty.png");
"edu/rpi/legup/images/thermometer/RestIsEmpty.png");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public TooFewMercuryContradiction(){
super("THERM-CONT-0002",
"Too Many Mercury",
"More mercury in column/row than target",
"edu/rpi/legup/images/thermometer/TooManyMercury.png");
"edu/rpi/legup/images/thermometer/NotEnoughMercury.png");
}

/**
Expand Down

0 comments on commit 8c6b96e

Please sign in to comment.