Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary #812

Merged
merged 106 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
1328083
Test commit
zacharybonagura Jan 30, 2024
3a5ce8e
Test commit again
zacharybonagura Jan 30, 2024
4a85b7f
Implementing the constructor and some abstract methods
zacharybonagura Jan 30, 2024
59128a4
Merge pull request #710 from zachbonagura/master
B-McCusker56 Jan 30, 2024
f24c41f
Implementing the BinaryType file for the grid cell possibilities
zacharybonagura Feb 1, 2024
f71a9f8
Merge pull request #715 from zachbonagura/master
zacharybonagura Feb 2, 2024
9d33a1c
initialized puzzle files, began writing the puzzle importer and finis…
B-McCusker56 Feb 2, 2024
7d8828c
Merge pull request #718 from B-McCusker56/binary
B-McCusker56 Feb 2, 2024
923b93a
Finished setting up BinaryImporter completely with all helper files (…
zacharybonagura Feb 6, 2024
5c301f7
Fixed bugs in binary files, wrote binary exporter
B-McCusker56 Feb 6, 2024
12027b8
Fixed merge problems'
B-McCusker56 Feb 6, 2024
519d351
Merge pull request #727 from B-McCusker56/binary
B-McCusker56 Feb 6, 2024
a62c000
Fixed compile errors
B-McCusker56 Feb 9, 2024
49b0058
Added binary puzzle to config, began writing rules
B-McCusker56 Feb 9, 2024
3432007
Fixed minor syntax and import error
B-McCusker56 Feb 9, 2024
304b938
Merge pull request #729 from B-McCusker56/binary
B-McCusker56 Feb 9, 2024
c544186
Merge pull request #1 from Bram-Hub/binary
B-McCusker56 Feb 9, 2024
14833b6
Merge pull request #730 from B-McCusker56/binary
B-McCusker56 Feb 10, 2024
b718f16
Fixed checkstyle error message in BinaryCellFactory
zacharybonagura Feb 13, 2024
9d026f4
Made slight progress when trying to output puzzle, first edition of T…
zacharybonagura Feb 17, 2024
6515bc3
Fixed checkstyle error for if statements
zacharybonagura Feb 17, 2024
0346d37
Added functions to BinaryBoard that returns the rows and columns of a…
zacharybonagura Feb 18, 2024
aaa23c0
Fixed error that causes BinaryImporter to fail to initialize board
zacharybonagura Feb 18, 2024
a532c1c
First edition of Unbalanced Row and Unbalanced Column Contradiction r…
zacharybonagura Feb 18, 2024
6a3cc9c
Update config
charlestian23 Feb 23, 2024
45f0d3a
Merge pull request #742 from charlestian23/binary
B-McCusker56 Feb 23, 2024
c46c46e
Deleted false config file, began rule implementation, began fixing pu…
B-McCusker56 Feb 23, 2024
9ec7cd1
Fixed stylecheck errors
B-McCusker56 Feb 23, 2024
8e7625e
Merge pull request #746 from B-McCusker56/binary
B-McCusker56 Feb 23, 2024
473d2eb
First edition of Duplicate Rows and Duplicate Columns Contradiction r…
zacharybonagura Feb 25, 2024
c53b197
First edition of One Tile Gap Direct rule
zacharybonagura Feb 25, 2024
63e858c
Second edition of One Tile Gap Direct rule, typo in if statement
zacharybonagura Feb 25, 2024
0ad68f6
Initial Board Rendering correct
B-McCusker56 Feb 27, 2024
cb57fd1
Merge branch 'binary' of https://github.com/B-McCusker56/LEGUP into b…
B-McCusker56 Feb 27, 2024
05802d7
Merge pull request #750 from B-McCusker56/binary
B-McCusker56 Feb 27, 2024
1f5fd80
All user board interactions fiex to be correct
B-McCusker56 Mar 12, 2024
6fbbccd
Merge pull request #751 from B-McCusker56/binary
B-McCusker56 Mar 12, 2024
f333429
Altered given cells color and fixed rules ref
B-McCusker56 Mar 12, 2024
735acd4
Merge branch 'Bram-Hub:binary' into binary
B-McCusker56 Mar 12, 2024
6b5887c
Merge pull request #754 from B-McCusker56/binary
B-McCusker56 Mar 12, 2024
c3894d5
Added temporary images to rules
zacharybonagura Mar 12, 2024
84bb1a2
Fixed checkStyle error
zacharybonagura Mar 12, 2024
35ef759
Changed Direct Rule
B-McCusker56 Mar 15, 2024
f7fccca
Changed Direct Rule
B-McCusker56 Mar 15, 2024
18ff93b
Merge pull request #760 from B-McCusker56/binary
B-McCusker56 Mar 15, 2024
7c51f18
Create MyWikiContributions
B-McCusker56 Mar 15, 2024
197f078
Rename MyWikiContributions to MyWikiContributions.md
B-McCusker56 Mar 15, 2024
8eaff04
Combined each of the contradiction rules into one file rather than tw…
zacharybonagura Mar 15, 2024
e2b4a96
Fixed checkStyle error in ThreeAdjacentContradictionRule
zacharybonagura Mar 15, 2024
2bf9bfb
Wrote prelim OneZeroCaseRule
B-McCusker56 Mar 15, 2024
ff7be64
Merge branch 'binary' of https://github.com/B-McCusker56/LEGUP into b…
B-McCusker56 Mar 15, 2024
f47596f
Merge branch 'Bram-Hub:binary' into binary
B-McCusker56 Mar 15, 2024
81fed78
Merge pull request #763 from B-McCusker56/binary
B-McCusker56 Mar 15, 2024
e2ee69c
Fixed bugs and continued Contradiciton rule work
B-McCusker56 Mar 22, 2024
9984846
Merge pull request #769 from B-McCusker56/binary
B-McCusker56 Mar 22, 2024
b6c29ad
Added copy in BinaryBoard, fixed getCell with checking out of bounds
zacharybonagura Mar 22, 2024
81a78bb
Added copy in BinaryBoard, fixed getCell with checking out of bounds
zacharybonagura Mar 22, 2024
7bc8739
Three adjacent CR complete and prelim testing done
B-McCusker56 Mar 22, 2024
1b9390a
Merge pull request #770 from B-McCusker56/binary
B-McCusker56 Mar 22, 2024
97a50dd
Tested UnbalancedRowOrColumnContradictionRule to verify correction
zacharybonagura Mar 23, 2024
418f3b6
Tested UnbalancedRowOrColumnContradictionRule to verify correction
zacharybonagura Mar 23, 2024
974c7a4
Fixed checkStyle error in ThreeAdjacentContradictionRule
zacharybonagura Mar 23, 2024
bafc113
Deleted unnecessary file that was auto created
zacharybonagura Mar 23, 2024
ce20def
OneZeroCaseRule working version complete, began writing SurroundPairD…
B-McCusker56 Mar 26, 2024
b303e73
Merge pull request #774 from B-McCusker56/binary
B-McCusker56 Mar 26, 2024
5972432
Finished DuplicateRowsOrColumnsContradictionRule for rows but not col…
zacharybonagura Mar 26, 2024
13aa225
Merge branch 'binary' of https://github.com/Bram-Hub/LEGUP into binary
zacharybonagura Mar 26, 2024
012fe90
fixed stylecheck errors
B-McCusker56 Mar 26, 2024
c545154
fixed stylecheck errors
B-McCusker56 Mar 26, 2024
5f6f092
All rules complete and ready for test suite, constructed additional t…
B-McCusker56 Mar 28, 2024
fd0ea65
Merge pull request #778 from B-McCusker56/binary
B-McCusker56 Mar 28, 2024
c55b5d2
Cleaned rule files, unified formatting, removed print statements from…
B-McCusker56 Mar 28, 2024
24d3df2
Merge branch 'Bram-Hub:binary' into binary
B-McCusker56 Mar 28, 2024
2fbc3f0
Cleaned rule files, unified formatting, removed print statements from…
B-McCusker56 Mar 28, 2024
9c0d0b0
Merge branch 'binary' of https://github.com/B-McCusker56/LEGUP into b…
B-McCusker56 Mar 28, 2024
a38365e
Merge pull request #779 from B-McCusker56/binary
B-McCusker56 Mar 28, 2024
27f0d91
Found error in ThreeAdjacentContradictionRule, missing valid contradi…
zacharybonagura Mar 29, 2024
6d43ce0
Fixed checkStyle error "if construct must use {}'s"
zacharybonagura Mar 30, 2024
82536af
Fixed buggy three adjacent contradiction rule
B-McCusker56 Apr 5, 2024
6a3c973
Merge pull request #796 from B-McCusker56/binary
B-McCusker56 Apr 5, 2024
534e556
Made slight progress in onetilegap direct rule
zacharybonagura Apr 5, 2024
be1b82f
Merge branch 'binary' of https://github.com/Bram-Hub/LEGUP into binary
zacharybonagura Apr 5, 2024
0e29a15
Slight progress with SurroundPairDirectRule
zacharybonagura Apr 5, 2024
10efd8b
Completed and tested all rules to verify correctness.
zacharybonagura Apr 9, 2024
51b5646
Added final rule images, adjusted nming converntions for rule images,…
B-McCusker56 Apr 12, 2024
5d9064a
Merge pull request #800 from B-McCusker56/binary
B-McCusker56 Apr 12, 2024
cf59a17
Added Wiki Contributions
B-McCusker56 Apr 12, 2024
15f6643
Added Binary Puzzle Presentation
B-McCusker56 Apr 12, 2024
9c90e2f
Merge branch 'binary' of https://github.com/B-McCusker56/LEGUP into b…
B-McCusker56 Apr 12, 2024
65b07e9
Merge pull request #802 from B-McCusker56/binary
B-McCusker56 Apr 13, 2024
714daee
Added Wiki Contributions
B-McCusker56 Apr 13, 2024
c1d8dd1
Merge branch 'Bram-Hub:binary' into binary
B-McCusker56 Apr 13, 2024
8260833
Merge pull request #803 from B-McCusker56/binary
B-McCusker56 Apr 13, 2024
44d0de5
Add files via upload
zacharybonagura Apr 13, 2024
19fbed6
Made improvement to rule images
B-McCusker56 Apr 16, 2024
1301f88
Merge pull request #809 from B-McCusker56/binary
B-McCusker56 Apr 16, 2024
2e17567
Delete LEGUP Binary Puzzle Progress.pptx
charlestian23 Apr 16, 2024
04f5728
Delete LEGUPBinaryPuzzleProgress.pptx
charlestian23 Apr 16, 2024
e8396af
Delete WikiContributions.md
charlestian23 Apr 16, 2024
6fe8768
deleted blank file
zacharybonagura Apr 16, 2024
b7e5857
Merge branch 'binary' of https://github.com/Bram-Hub/LEGUP into binary
zacharybonagura Apr 16, 2024
bb64783
Removed useless config file
charlestian23 Apr 16, 2024
fb8c02a
Merge branch 'binary' of https://github.com/Bram-Hub/LEGUP into binary
charlestian23 Apr 16, 2024
2e9fa05
Merge branch 'dev' into binary
charlestian23 Apr 16, 2024
68e8e67
Automated Java code formatting changes
Bram28 Apr 16, 2024
0308ce5
Merge branch 'dev' into binary
charlestian23 May 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions bin/main/edu/rpi/legup/legup/config

This file was deleted.

22 changes: 22 additions & 0 deletions puzzles files/binary/6x6 easy/089764562
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>
21 changes: 21 additions & 0 deletions puzzles files/binary/6x6 easy/128903434
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>
25 changes: 25 additions & 0 deletions puzzles files/binary/6x6 easy/876868768
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>
28 changes: 28 additions & 0 deletions puzzles files/binary/6x6 easy/927364891
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>
16 changes: 9 additions & 7 deletions src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@
import java.util.List;

public abstract class GridRegion<T> {

protected List<T> regionCells;

/**
* Region Constructor
*/

/** Region Constructor */
public GridRegion() {
this.regionCells = new ArrayList<>();
}

/**
* Adds the cell to the region
*
* @param cell cell to be added to the region
*/
public void addCell(T cell) {
Expand All @@ -24,6 +23,7 @@ public void addCell(T cell) {

/**
* Removes the cell from the region
*
* @param cell cell to be remove from the region
*/
public void removeCell(T cell) {
Expand All @@ -32,6 +32,7 @@ public void removeCell(T cell) {

/**
* Returns the list of cells in the region
*
* @return list of cells in region
*/
public List<T> getCells() {
Expand All @@ -40,14 +41,15 @@ public List<T> getCells() {

/**
* Returns the number of cells in the region
*
* @return number of cells in the region
*/
public int getSize(){
public int getSize() {
return regionCells.size();
}

/*
public void colorRegion(){}
*/

}
71 changes: 71 additions & 0 deletions src/main/java/edu/rpi/legup/puzzle/binary/Binary.java
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 src/main/java/edu/rpi/legup/puzzle/binary/BinaryBoard.java
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;
}
}
Loading
Loading