Skip to content

Commit

Permalink
Merge pull request #293 from ThisMatt/new_puzzle-skyscrapers
Browse files Browse the repository at this point in the history
Flags import now
  • Loading branch information
ThisMatt authored Sep 23, 2022
2 parents 902deeb + 318a602 commit e330ed3
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 22 deletions.
3 changes: 2 additions & 1 deletion puzzles files/skyscrapers/1646651
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Legup version="2.0.0">
<puzzle name="Skyscrapers">
<board height="8" width="8">
<board size="8">
<cells>

</cells>
Expand All @@ -25,6 +25,7 @@
<clue index="7" value="1"/>
<clue index="4" value="2"/>
</axis>
<flags dupe="true" view="false" empty="true"/>
</board>
</puzzle>
</Legup>
3 changes: 2 additions & 1 deletion puzzles files/skyscrapers/easy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Legup version="2.0.0">
<puzzle name="Skyscrapers">
<board height="4" width="4">
<board size="4">
<cells>

</cells>
Expand All @@ -17,6 +17,7 @@
<clue index="4" value="1"/>
<clue index="2" value="2"/>
</axis>
<flags dupe="true" view="false" empty="true"/>
</board>
</puzzle>
</Legup>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SkyscrapersBoard extends GridBoard {
//NORTH clues

private boolean viewFlag = false;
private boolean dupeFlag = true;
private boolean dupeFlag = false;
private boolean unresolvedFlag = false;

public SkyscrapersBoard(int width, int height) {
Expand Down Expand Up @@ -86,6 +86,13 @@ public ArrayList<SkyscrapersClue> getCol() {
return col;
}

public boolean getDupeFlag(){return dupeFlag;}
public boolean getViewFlag(){return viewFlag;}
public boolean getUnresolvedFlag(){return unresolvedFlag;}
public void setDupeFlag(boolean newFlag){dupeFlag = newFlag ;}
public void setViewFlag(boolean newFlag){viewFlag = newFlag;}
public void setUnresolvedFlag(boolean newFlag){unresolvedFlag = newFlag;}

@Override
public SkyscrapersCell getCell(int x, int y) {
return (SkyscrapersCell) super.getCell(x, y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,6 @@ public void initializeBoard(Node node) throws InvalidFileFormatException {
int size = Integer.valueOf(boardElement.getAttribute("size"));
treeTentBoard = new SkyscrapersBoard(size);
}
else {
if (!boardElement.getAttribute("width").isEmpty() && !boardElement.getAttribute("height").isEmpty()) {
int width = Integer.valueOf(boardElement.getAttribute("width"));
int height = Integer.valueOf(boardElement.getAttribute("height"));
treeTentBoard = new SkyscrapersBoard(width, height);
}
}

if (treeTentBoard == null) {
throw new InvalidFileFormatException("TreeTent Importer: invalid board dimensions");
Expand Down Expand Up @@ -149,6 +142,15 @@ public void initializeBoard(Node node) throws InvalidFileFormatException {
}
}

//Initialize present flags
NodeList flagList = boardElement.getElementsByTagName("flags");
if(flagList.getLength()==1){
Element flags = (Element) flagList.item(0);
if(flags.hasAttribute("dupe")){treeTentBoard.setDupeFlag(Boolean.parseBoolean(flags.getAttribute("dupe")));}
if(flags.hasAttribute("view")){treeTentBoard.setViewFlag(Boolean.parseBoolean(flags.getAttribute("view")));}
if(flags.hasAttribute("empty")){treeTentBoard.setUnresolvedFlag(Boolean.parseBoolean(flags.getAttribute("empty")));}
}

puzzle.setCurrentBoard(treeTentBoard);
}
catch (NumberFormatException e) {
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/edu/rpi/legup/puzzle/skyscrapers/TODO.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ spreadsheet : https://docs.google.com/spreadsheets/d/1l7aUZtavtysM8dtGnaEIXhBKMR
5. Flags
- add to all case rules
- review all basic/contradiction rules to put in terms of the new cases / add flags
- edit importer and exporter to include flags in xml file format
- edit exporter to include flags in xml file format
6. Documentation
- UML diagram(s)
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ HELPER FUNCTIONS: (check morgue for unused helpers, ctrl+f "helper function")
Notes: more than one element type?

CODE MORGUE:
- SkyscapersLine, SkyscrapersLineView
Locations: above classes, Board, Importer, CellFactory, View
Uses: drawing lines between cells on the board
Note: No purpose for lines in this puzzle yet,
probably should remove all instances of their use for cleanliness' sake
- isForced, getDefaultBoard
Locations:
Uses?: Unknown
Expand Down

0 comments on commit e330ed3

Please sign in to comment.