Skip to content

Commit

Permalink
added groupvalues parameter to isEmpty method
Browse files Browse the repository at this point in the history
  • Loading branch information
Zomis committed Jan 3, 2015
1 parent 02e49e1 commit 84c5ed7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ public double nCr() {
}

@Override
public boolean isEmpty() {
public boolean isEmpty(GroupValues<T> knownValues) {
return fields.isEmpty() && minResult >= 0;
}

@Override
public SimplifyResult simplify(GroupValues<T> knownValues) {
if (this.isEmpty()) {
if (this.isEmpty(knownValues)) {
return SimplifyResult.NO_EFFECT;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/zomis/minesweeper/analyze/FieldRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public FieldGroup<T> getSmallestFieldGroup() {
return result;
}

public boolean isEmpty() {
public boolean isEmpty(GroupValues<T> knownValues) {
return fields.isEmpty() && result == 0;
}

Expand All @@ -138,7 +138,7 @@ public double nCr() {

@Override
public SimplifyResult simplify(GroupValues<T> knownValues) {
if (this.isEmpty()) {
if (this.isEmpty(knownValues)) {
return SimplifyResult.NO_EFFECT;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class GameAnalyze<T> {
private void removeEmptyRules() {
Iterator<FieldRule<T>> it = rules.iterator();
while (it.hasNext()) {
if (it.next().isEmpty())
if (it.next().isEmpty(knownValues))
it.remove();
}
}
Expand Down

0 comments on commit 84c5ed7

Please sign in to comment.