-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8c9392
commit e2d9713
Showing
7 changed files
with
129 additions
and
107 deletions.
There are no files selected for viewing
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
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
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,26 @@ | ||
import {AEGTree} from "../AEG/AEGTree"; | ||
import {CutNode} from "../AEG/CutNode"; | ||
import {AtomNode} from "../AEG/AtomNode"; | ||
import {treeContext} from "../treeContext"; | ||
|
||
/** | ||
* Determines if the current node can be inserted in a position that is not overlapping with anything | ||
* and it being inserted would result in a graph that would equal one another. | ||
* @param currentNode The node that will be checked for legality | ||
* @returns Whether or no the node is in a legal position | ||
*/ | ||
export function isMoveLegal(tree: AEGTree, currentNode: CutNode | AtomNode): boolean { | ||
return tree.canInsert(currentNode) && proofCanInsert(new AEGTree(tree.sheet), currentNode); | ||
} | ||
|
||
/** | ||
* Inserts a copy of our current node into a copy of our current tree and compares this to a copy | ||
* of the original tree. | ||
* @param tree A copy of the current tree without the current node | ||
* @param currentNode The node that will be checked for legality | ||
* @returns Whether or not the two graphs are equal | ||
*/ | ||
export function proofCanInsert(tree: AEGTree, currentNode: CutNode | AtomNode): boolean { | ||
tree.insert(currentNode.copy()); | ||
return tree.isEqualTo(new AEGTree(treeContext.getLastProofStep().tree.sheet)); | ||
} |
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