-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Test commit * Test commit again * Implementing the constructor and some abstract methods * Implementing the BinaryType file for the grid cell possibilities * initialized puzzle files, began writing the puzzle importer and finished most of binary.java functionality * Finished setting up BinaryImporter completely with all helper files (BinaryView, BinaryCellFactory, BinaryController, BinaryElementView). These files create the grid view of the puzzle and are responsible for the GUI of the puzzle. * Fixed bugs in binary files, wrote binary exporter * Fixed compile errors * Added binary puzzle to config, began writing rules * Fixed minor syntax and import error * Fixed checkstyle error message in BinaryCellFactory * Made slight progress when trying to output puzzle, first edition of Three Adjacent Ones and Zeros Contradiction rules * Fixed checkstyle error for if statements * Added functions to BinaryBoard that returns the rows and columns of a specified index. * Fixed error that causes BinaryImporter to fail to initialize board * First edition of Unbalanced Row and Unbalanced Column Contradiction rules * Update config * Deleted false config file, began rule implementation, began fixing puzzle board visual * Fixed stylecheck errors * First edition of Duplicate Rows and Duplicate Columns Contradiction rules * First edition of One Tile Gap Direct rule * Second edition of One Tile Gap Direct rule, typo in if statement * Initial Board Rendering correct * All user board interactions fiex to be correct * Altered given cells color and fixed rules ref * Added temporary images to rules * Fixed checkStyle error * Changed Direct Rule * Create MyWikiContributions * Rename MyWikiContributions to MyWikiContributions.md * Combined each of the contradiction rules into one file rather than two separate files * Fixed checkStyle error in ThreeAdjacentContradictionRule * Wrote prelim OneZeroCaseRule * Fixed bugs and continued Contradiciton rule work * Added copy in BinaryBoard, fixed getCell with checking out of bounds * Three adjacent CR complete and prelim testing done * Tested UnbalancedRowOrColumnContradictionRule to verify correction Fixed checkStyle errors * Tested UnbalancedRowOrColumnContradictionRule to verify correction Fixed checkStyle errors * Fixed checkStyle error in ThreeAdjacentContradictionRule * Deleted unnecessary file that was auto created * OneZeroCaseRule working version complete, began writing SurroundPairDIrectRule fixed minor bugs * Finished DuplicateRowsOrColumnsContradictionRule for rows but not columns, added method to get all types of cells in row. * fixed stylecheck errors * fixed stylecheck errors * All rules complete and ready for test suite, constructed additional test puzzles * Cleaned rule files, unified formatting, removed print statements from testing * Cleaned rule files, unified formatting, removed print statements from testing, fixed minor bug * Found error in ThreeAdjacentContradictionRule, missing valid contradictions in OneTileGap and SurroundPair Direct Rules * Fixed checkStyle error "if construct must use {}'s" * Fixed buggy three adjacent contradiction rule * Made slight progress in onetilegap direct rule * Slight progress with SurroundPairDirectRule * Completed and tested all rules to verify correctness. * Added final rule images, adjusted nming converntions for rule images, updated wiki with new rule images * Added Wiki Contributions * Added Binary Puzzle Presentation * Added Wiki Contributions * Add files via upload * Made improvement to rule images * Delete LEGUP Binary Puzzle Progress.pptx * Delete LEGUPBinaryPuzzleProgress.pptx * Delete WikiContributions.md * deleted blank file * Automated Java code formatting changes --------- Co-authored-by: zachbonagura <[email protected]> Co-authored-by: zachbonagura <[email protected]> Co-authored-by: charlestian23 <[email protected]> Co-authored-by: Charles Tian <[email protected]> Co-authored-by: Bram van Heuveln <[email protected]>
- Loading branch information
1 parent
0e8ae65
commit 58eba41
Showing
63 changed files
with
1,506 additions
and
310 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<Legup version="2.0.0"> | ||
<puzzle name="Binary"> | ||
<board height="6" width="6"> | ||
<cells> | ||
<cell value="0" x="2" y="0"/> | ||
<cell value="1" x="5" y="0"/> | ||
<cell value="1" x="0" y="1"/> | ||
<cell value="0" x="2" y="1"/> | ||
<cell value="0" x="3" y="1"/> | ||
<cell value="1" x="1" y="2"/> | ||
<cell value="1" x="4" y="3"/> | ||
<cell value="1" x="2" y="4"/> | ||
<cell value="0" x="5" y="4"/> | ||
<cell value="0" x="0" y="5"/> | ||
<cell value="0" x="1" y="5"/> | ||
<cell value="1" x="3" y="5"/> | ||
</cells> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<Legup version="2.0.0"> | ||
<puzzle name="Binary"> | ||
<board height="6" width="6"> | ||
<cells> | ||
<cell value="0" x="1" y="0"/> | ||
<cell value="1" x="0" y="1"/> | ||
<cell value="0" x="3" y="1"/> | ||
<cell value="0" x="4" y="1"/> | ||
<cell value="0" x="4" y="2"/> | ||
<cell value="0" x="0" y="3"/> | ||
<cell value="1" x="3" y="3"/> | ||
<cell value="0" x="2" y="4"/> | ||
<cell value="1" x="1" y="5"/> | ||
<cell value="0" x="5" y="5"/> | ||
|
||
</cells> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<Legup version="2.0.0"> | ||
<puzzle name="Binary"> | ||
<board height="6" width="6"> | ||
<cells> | ||
<cell value="1" x="0" y="0"/> | ||
<cell value="0" x="3" y="0"/> | ||
<cell value="0" x="2" y="1"/> | ||
<cell value="0" x="3" y="1"/> | ||
<cell value="1" x="5" y="1"/> | ||
<cell value="0" x="1" y="2"/> | ||
<cell value="0" x="2" y="2"/> | ||
<cell value="1" x="5" y="2"/> | ||
<cell value="0" x="0" y="4"/> | ||
<cell value="0" x="1" y="4"/> | ||
<cell value="1" x="3" y="4"/> | ||
<cell value="1" x="1" y="5"/> | ||
<cell value="0" x="4" y="5"/> | ||
<cell value="0" x="5" y="5"/> | ||
|
||
</cells> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<Legup version="2.0.0"> | ||
<puzzle name="Binary"> | ||
<board height="6" width="6"> | ||
<cells> | ||
<cell value="1" x="0" y="0"/> | ||
<cell value="1" x="2" y="0"/> | ||
<cell value="1" x="3" y="0"/> | ||
<cell value="0" x="5" y="0"/> | ||
<cell value="0" x="1" y="1"/> | ||
<cell value="1" x="0" y="2"/> | ||
<cell value="0" x="3" y="2"/> | ||
<cell value="0" x="5" y="2"/> | ||
<cell value="1" x="0" y="3"/> | ||
<cell value="1" x="4" y="3"/> | ||
<cell value="0" x="5" y="3"/> | ||
<cell value="1" x="1" y="4"/> | ||
<cell value="1" x="3" y="4"/> | ||
<cell value="0" x="0" y="5"/> | ||
<cell value="0" x="2" y="5"/> | ||
<cell value="1" x="4" y="5"/> | ||
<cell value="1" x="5" y="5"/> | ||
|
||
</cells> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package edu.rpi.legup.puzzle.binary; | ||
|
||
import edu.rpi.legup.model.Puzzle; | ||
import edu.rpi.legup.model.gameboard.Board; | ||
import edu.rpi.legup.model.gameboard.PuzzleElement; | ||
import edu.rpi.legup.model.rules.ContradictionRule; | ||
|
||
public class Binary extends Puzzle { | ||
public Binary() { | ||
super(); | ||
|
||
this.name = "Binary"; | ||
|
||
this.importer = new BinaryImporter(this); | ||
this.exporter = new BinaryExporter(this); | ||
|
||
this.factory = new BinaryCellFactory(); | ||
} | ||
|
||
/** Initializes the game board. Called by the invoker of the class */ | ||
@Override | ||
public void initializeView() { | ||
boardView = new BinaryView((BinaryBoard) currentBoard); | ||
boardView.setBoard(currentBoard); | ||
addBoardListener(boardView); | ||
} | ||
|
||
/** | ||
* Generates a random edu.rpi.legup.puzzle based on the difficulty | ||
* | ||
* @param difficulty level of difficulty (1-10) | ||
* @return board of the random edu.rpi.legup.puzzle | ||
*/ | ||
@Override | ||
public Board generatePuzzle(int difficulty) { | ||
return null; | ||
} | ||
|
||
// /** | ||
// * 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; | ||
|
||
for (ContradictionRule rule : contradictionRules) { | ||
if (rule.checkContradiction(binaryBoard) == null) { | ||
return false; | ||
} | ||
} | ||
for (PuzzleElement data : binaryBoard.getPuzzleElements()) { | ||
BinaryCell cell = (BinaryCell) data; | ||
if (cell.getType() == BinaryType.UNKNOWN) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
|
||
@Override | ||
public void onBoardChange(Board board) {} | ||
} |
84 changes: 84 additions & 0 deletions
84
src/main/java/edu/rpi/legup/puzzle/binary/BinaryBoard.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package edu.rpi.legup.puzzle.binary; | ||
|
||
import edu.rpi.legup.model.gameboard.GridBoard; | ||
import edu.rpi.legup.model.gameboard.PuzzleElement; | ||
import java.awt.*; | ||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
public class BinaryBoard extends GridBoard { | ||
private int size; | ||
|
||
public BinaryBoard(int width, int height) { | ||
super(width, height); | ||
this.size = width; | ||
} | ||
|
||
public BinaryBoard(int size) { | ||
super(size, size); | ||
this.size = size; | ||
} | ||
|
||
@Override | ||
public BinaryCell getCell(int x, int y) { | ||
if (y * dimension.width + x >= puzzleElements.size() | ||
|| x >= dimension.width | ||
|| y >= dimension.height | ||
|| x < 0 | ||
|| y < 0) { | ||
return null; | ||
} | ||
return (BinaryCell) super.getCell(x, y); | ||
} | ||
|
||
public Set<BinaryCell> getRowCells(int rowNum) { | ||
Set<BinaryCell> row = new HashSet<>(); | ||
for (int i = 0; i < size; i++) { | ||
BinaryCell cell = getCell(i, rowNum); | ||
row.add(cell); | ||
} | ||
return row; | ||
} | ||
|
||
public ArrayList<BinaryType> getRowTypes(int rowNum) { | ||
ArrayList<BinaryType> row = new ArrayList<BinaryType>(); | ||
for (int i = 0; i < size; i++) { | ||
BinaryCell cell = getCell(i, rowNum); | ||
row.add(cell.getType()); | ||
} | ||
return row; | ||
} | ||
|
||
public ArrayList<BinaryType> getColTypes(int colNum) { | ||
ArrayList<BinaryType> col = new ArrayList<BinaryType>(); | ||
for (int i = 0; i < size; i++) { | ||
BinaryCell cell = getCell(colNum, i); | ||
col.add(cell.getType()); | ||
} | ||
return col; | ||
} | ||
|
||
public Set<BinaryCell> getCol(int colNum) { | ||
Set<BinaryCell> col = new HashSet<>(); | ||
for (int i = 0; i < size; i++) { | ||
col.add(getCell(colNum, i)); | ||
} | ||
return col; | ||
} | ||
|
||
@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++) { | ||
copy.setCell(x, y, getCell(x, y).copy()); | ||
} | ||
} | ||
for (PuzzleElement e : modifiedData) { | ||
copy.getPuzzleElement(e).setModifiable(false); | ||
} | ||
return copy; | ||
} | ||
} |
Oops, something went wrong.