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

Finish room case rule attempt #788

Merged
merged 33 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
33 commits
Select commit Hold shift click to select a range
5eabed7
Update SurroundRegionDirectRule.java
cadogs Oct 20, 2023
ae11843
Update SurroundRegionDirectRule.java
cadogs Oct 20, 2023
f9349f9
Merge branch 'dev' into Surround_Completed_Region_newest
Corppet Oct 27, 2023
125f557
Update SurroundRegionDirectRule.java
cadogs Oct 31, 2023
4e322b5
Merge branch 'Surround_Completed_Region_newest' of https://github.com…
cadogs Nov 3, 2023
3e539db
Create FinishRoomCaseRule.java
cadogs Nov 3, 2023
6cc91f3
more work done to finish room case rule. Also since there currently i…
cadogs Nov 10, 2023
dbb6082
Finish Room Case rule work
cadogs Dec 1, 2023
2e100bd
FinishRoomCaseRule initial completed attempt
cadogs Dec 1, 2023
323ac76
get draft pull
cadogs Feb 2, 2024
80fac53
Merge branch 'dev' into FinishRoomCaseRuleAttempt
charlestian23 Feb 2, 2024
d4c49dc
Changed the ID
charlestian23 Feb 2, 2024
41bb22b
Update FinishRoomCaseRule.java
cadogs Feb 2, 2024
b23c109
Merge branch 'FinishRoomCaseRuleAttempt' of https://github.com/cadogs…
cadogs Feb 3, 2024
3eb7eaa
Finish Room Case Rule Basically Done
cadogs Feb 9, 2024
dbf69e2
Cleaned up code
cadogs Feb 9, 2024
fe92964
Merge branch 'dev' into FinishRoomCaseRuleAttempt
charlestian23 Feb 12, 2024
f4d3c3d
Finish Room green arrows and test case start
cadogs Feb 16, 2024
397ea0f
Tests and rule rework
cadogs Feb 23, 2024
d84ed0a
Generalized max cases
cadogs Mar 12, 2024
dada125
FinishRoom Image
cadogs Mar 22, 2024
c1b10f4
Merge branch 'dev' into FinishRoomCaseRuleAttempt
cadogs Mar 22, 2024
62132c3
Added argument for minimum number of case rules
charlestian23 Mar 26, 2024
639972f
Test Case initial
cadogs Mar 26, 2024
2a559b2
Merge branch 'FinishRoomCaseRuleAttempt' of https://github.com/cadogs…
cadogs Mar 26, 2024
56ee4b3
Update CaseRule.java
charlestian23 Mar 26, 2024
89eec3a
Merge branch 'dev' into FinishRoomCaseRuleAttempt
charlestian23 Mar 27, 2024
f650c4f
Merge branch 'FinishRoomCaseRuleAttempt' of https://github.com/cadogs…
cadogs Mar 29, 2024
cd4fabe
False justification bug fix
cadogs Mar 29, 2024
84b1394
Merge branch 'dev' into FinishRoomCaseRuleAttempt
charlestian23 Apr 2, 2024
f4f7e90
deleting cases fix
cadogs Apr 2, 2024
d5bd9a9
Merge branch 'dev' into FinishRoomCaseRuleAttempt
cadogs Apr 2, 2024
a79931d
Merge branch 'dev' into FinishRoomCaseRuleAttempt
charlestian23 Apr 2, 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
7 changes: 6 additions & 1 deletion src/main/java/edu/rpi/legup/history/AutoCaseRuleCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 117,14 @@ public String getErrorString() {
return "The selection must produce at least one case";
}

if (caseRule.getCases(caseBoard.getBaseBoard(), elementView.getPuzzleElement()).size() > caseRule.MAX_CASES) {
int numberOfCaseRules = caseRule.getCases(caseBoard.getBaseBoard(), elementView.getPuzzleElement()).size();
System.out.println("Number of cases:" numberOfCaseRules);
if (numberOfCaseRules > caseRule.MAX_CASES) {
return "The selection can produce a max of " caseRule.MAX_CASES " cases";
}
if (numberOfCaseRules < caseRule.MIN_CASES) {
return "The selection must produce a minimum of " caseRule.MIN_CASES " cases";
}

return null;
}
Expand Down
18 changes: 4 additions & 14 deletions src/main/java/edu/rpi/legup/model/rules/CaseRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 15,7 @@ public abstract class CaseRule extends Rule {

private final String INVALID_USE_MESSAGE;
public int MAX_CASES;
public int MIN_CASES;

/**
* CaseRule Constructor creates a new case rule.
Expand All @@ -29,6 30,7 @@ public CaseRule(String ruleID, String ruleName, String description, String image
this.ruleType = CASE;
this.INVALID_USE_MESSAGE = "Invalid use of the case rule " this.ruleName;
this.MAX_CASES = 10;
this.MIN_CASES = 0; // By default, this will not actually have any effect
}

/**
Expand Down Expand Up @@ -95,17 97,8 @@ public String checkRule(TreeTransition transition) {
public abstract String checkRuleRaw(TreeTransition transition);

/**
* Checks whether the amount of cases generated is within bounds of the given rule.
* This method is the one that should overridden in child classes.
*
* @param transition transition to check
* @param puzzleElement equivalent puzzleElement
* @return
*/

/**
* Checks whether the child node logically follows from the parent node at the specific puzzleElement index using
* this rule.
* Checks whether the child node logically follows from the parent node at the specific
* puzzleElement index using this rule.
*
* @param transition transition to check
* @param puzzleElement equivalent puzzleElement
Expand Down Expand Up @@ -155,6 148,3 @@ public List<PuzzleElement> dependentElements(Board board, PuzzleElement puzzleEl
return elements;
}
}