public abstract class PebbleInstance extends PuzzleInstance
Constructor and Description |
---|
PebbleInstance() |
Modifier and Type | Method and Description |
---|---|
void |
addDoubleExtensionVertices()
Adds 2n vertices and connects each vertex in the original graph to a path of length 2.
|
void |
addExtensionVertices()
Adds n vertices and connects each one to a vertex in the original graph.
|
boolean |
addPebbles(Vertex vert,
int toAdd)
Do not use this or the next method in games unless you want the event to be recorded.
|
void |
addToNumberOfPebblingMoves(int toAdd)
Or subtract if you use a negative number.
|
boolean |
areAllCovered() |
boolean[] |
areCovered() |
void |
clearPebbles() |
void |
clearPebbles(Vertex vert) |
PuzzleInstance |
copyPuzzleSoItHasInitialStateTheSameAsMyCurrentState()
Copies the puzzle so that it has an initial state that is the same as this puzzle's current state.
|
java.lang.String |
coveredVerticesWithNoPebblesToString() |
void |
efficientMovePebble(Vertex from,
Vertex to)
This is identical to movePebble but it does NOT do any checking to see that the move is actually valid.
|
void |
efficientUndoPebbleMove(Vertex from,
Vertex to) |
VertexData |
getDefaultVertexDataObject() |
int |
getNumberCoveredVertices()
This method returns the total number of the vertices that are currently covered.
|
int |
getNumberOfPebblingMoves() |
int |
getNumberPebbles()
This method gets the total number of pebbles that are currently on the board.
|
int |
getNumPebbles(Vertex v)
This method returns the number of pebbles that are currently on a particular vertex.
|
java.lang.String |
getProcessedSolution() |
PebbleAlgorithmStates |
getState() |
boolean |
isCovered(Vertex v)
This method checks to see whether or not a vertex is covered or uncovered.
|
boolean |
isEventForThisPuzzleType(Event<?> e)
Return true iff this event is of type T.
|
boolean |
isSolvable() |
boolean |
isUncertain() |
boolean |
isUnsolvable() |
abstract boolean |
isValidSource(Vertex v)
This is used to determine if a vertex is valid in whatever game mode is implemented.
|
boolean |
movePebble(Vertex from,
Vertex to)
This method causes a move pebble event to occur so that two pebbles are removed from the "from" vertex and one is
added to the "to" vertex.
|
boolean |
movePebbles(Vertex from,
Vertex to,
int numberToMove) |
java.lang.String |
pebblesToString()
Since different games may want to convert pebble list to string, this is here.
|
void |
recycle()
This method causes a recycle event to occur which notifies the listeners of this class using a reset event.
|
boolean |
removePebbles(Vertex vert,
int toSubtract)
Notice that this sets a vertex uncovered when it has no pebbles.
|
void |
setCovered(java.lang.String vertexList)
A space-separated list of the indices of the vertices to set covered.
|
void |
setCovered(Vertex vertex)
Adds a vertex to the covered set.
|
void |
setNumberOfPebblingMoves(int numberOfPebblingMoves) |
void |
setNumPebbles(Vertex v,
int num)
This method sets the number of pebbles on a specific vertex
|
void |
setPebbles(int[] config)
Places new PebbleData on each vertex in the PebbleInstance according to the configuration given
|
void |
setPebbles(java.lang.String pebbleList) |
void |
setState(PebbleAlgorithmStates state)
This game is a bit odd.
|
void |
setUncovered(Vertex vertex)
Removes a vertex to the covered set.
|
boolean |
tryItResultsAreBinding()
Return true only if Try It mode, using the type from getTryItInstance, will produce a result that is AWLAYS valid
for the puzzle type.
|
void |
undoPebbleMove(Vertex from,
Vertex to)
This method causes an undo move event where the previous move is undone and two pebbles are added to the "from"
vertex and one is removed from the "to" vertex.
|
void |
undoPebbleMoves(Vertex from,
Vertex to,
int numMoved) |
void |
undoRecycle(java.lang.String pebbles)
The assumption here is that you can't actually undo a recycle.
|
java.lang.String |
uniqueIdentifier(Vertex v)
Return a string that represents the data related to the given Vertex in a way that is different if the data is
different.
|
addDoppelganger, addGraph, addGraphWithData, addToSelected, addToSelected, addVertex, canRedo, canUndo, checkAndHandlePuzzleCompletion, clearAllSelections, clearHistory, clearTutorial, computeGlobalPoints, connectAllSelectedVertices, connectToSelected, convertMovesToTutorial, copyPuzzle, copyRequested, copySelected, createNewVertexForPuzzle, currentPuzzleDataToString, deleteSelected, disableHistory, disconnectFromSelected, disconnectSelected, doNotRecordGraphEvents, enableHistory, endGame, forceRedo, getAttemptName, getBasePoints, getCurrentAnnotation, getCurrentMoveOverview, getCurrentUndoableEvent, getData, getDescription, getDiameter, getDifficultyLevel, getEdgeDataClassName, getEditHelpClassName, getEditorClassName, getFamilyName, getFirstSelected, getFirstTimeBonus, getGameName, getGlobalBest, getGraph, getHelpClassName, getHighScoreBonus, getImprovementBonus, getInstanceClassName, getInterestingTutorialVertices, getMaximumXCoordinate, getMaximumYCoordinate, getMessage, getMinimumSelectedXCoordinate, getMinimumSelectedYCoordinate, getMinimumXCoordinate, getMinimumYCoordinate, getMode, getNumberOfEdges, getNumberOfMoves, getNumberOfVertices, getNumberSelected, getOldHighScore, getPersonalBest, getPlayClassName, getPuzzleID, getPuzzleInstanceName, getPuzzleName, getScore, getSelectedVertices, getSolution, getSolutionAsString, getSolutionID, getThemeClassName, getTimeTaken, getTopOfUndoStack, getTryItInstanceForUseOnPlayScreen, getTutorialData, getUserID, getVertexIndex, getVertices, getVisibility, getVisibleSources, goToNextEvent, grossHistoryDeleteLastEvent, grossHistoryGetLastAddedEvent, grossHistoryGetNextEvent, grossHistoryGetNextEventIndex, grossHistoryIsSaved, grossHistoryIteratorAtBeginning, grossHistoryIteratorAtEnd, grossHistoryNext, grossHistoryPrevious, grossHistorySetSaved, grossHistorySize, grossHistoryToBeginning, grossHistoryToEnd, initialPuzzleDataToString, isCurrentStateValidSolution, isFinishable, isInReplayOrEditTutorialMode, isLocked, isLowerScoreBetter, isPlayable, isSaved, isShowIndices, isSolutionRefinable, isSpecialCopyOK, isTutorial, isValidToTranslationSelection, isVisibleSource, makeCurrentStateInitialState, moveGraphEnded, moveSelectedVerticesEnded, moveStarted, pasteAndConnectCopyOfSelected, pasteCopyOfSelected, performEvents, performEvents, performTutorialEvents, reallySetLocked, recordGraphEvents, redo, removeFromSelected, removeFromSelected, resetVerticesToInitialLocations, restart, runAlgorithms, runuTryIt, selectAll, sendAlgorithmResult, sendMeaninglessEvent, setAttemptName, setData, setDefaultData, setDescription, setFinishable, setGlobalBest, setGraph, setInReplayOrEditTutorialMode, setLocked, setMessage, setMode, setPersonalBest, setPlayable, setPuzzle, setPuzzleID, setPuzzleName, setSaved, setShowIndices, setSolutionData, setSolutionID, setSolutionInformation, setUserID, setVisibleSources, startTimer, stopTimer, stringToPuzzleData, submit, toggleSelected, tutorialModeEnabled, undo, update, updateStateBasedOnAlgorithmResult, updateTimeTaken, usesAlgorithms
public int getNumberOfPebblingMoves()
public void setNumberOfPebblingMoves(int numberOfPebblingMoves)
public void addToNumberOfPebblingMoves(int toAdd)
public PuzzleInstance copyPuzzleSoItHasInitialStateTheSameAsMyCurrentState()
PuzzleInstance
copyPuzzleSoItHasInitialStateTheSameAsMyCurrentState
in class PuzzleInstance
public boolean isEventForThisPuzzleType(Event<?> e)
PuzzleInstance
isEventForThisPuzzleType
in class PuzzleInstance
public java.lang.String pebblesToString()
public void setPebbles(java.lang.String pebbleList)
public void setPebbles(int[] config)
pInstance
- the game that you want to place new pebbles onconfig
- the number of pebbles to be placed on each vertexpublic java.lang.String coveredVerticesWithNoPebblesToString()
public void setCovered(java.lang.String vertexList)
vertexList
- public boolean movePebble(Vertex from, Vertex to)
from
- The vertex from which the pebbles are being movedto
- The vertex to which the pebble is being movedpublic void undoPebbleMove(Vertex from, Vertex to)
from
- The vertex that the pebbles originally moved fromto
- The vertex that the pebble was originally moved topublic void undoRecycle(java.lang.String pebbles)
pebbles
- public void recycle()
public boolean addPebbles(Vertex vert, int toAdd)
vert
- toSubtract
- public boolean removePebbles(Vertex vert, int toSubtract)
vert
- toSubtract
- public void clearPebbles(Vertex vert)
public void clearPebbles()
public void efficientMovePebble(Vertex from, Vertex to)
from
- The vertex that the pebbles are being moved fromto
- The vertex that the pebble is being moved topublic int getNumberCoveredVertices()
public void setNumPebbles(Vertex v, int num)
v
- The vertex that needs to be changednum
- The new number of pebblespublic int getNumPebbles(Vertex v)
v
- The vertex that is being checkedpublic int getNumberPebbles()
public boolean isCovered(Vertex v)
v
- The vertex to be checkedpublic boolean[] areCovered()
public void setCovered(Vertex vertex)
vertex
- The vertex to be coveredpublic void setUncovered(Vertex vertex)
vertex
- The vertex to be coveredpublic boolean areAllCovered()
public abstract boolean isValidSource(Vertex v)
public boolean tryItResultsAreBinding()
PuzzleInstance
tryItResultsAreBinding
in class PuzzleInstance
public java.lang.String getProcessedSolution()
getProcessedSolution
in class PuzzleInstance
public PebbleAlgorithmStates getState()
public boolean isSolvable()
public boolean isUnsolvable()
public boolean isUncertain()
public void setState(PebbleAlgorithmStates state)
state
- the current state of the game.public VertexData getDefaultVertexDataObject()
getDefaultVertexDataObject
in class PuzzleInstance
public java.lang.String uniqueIdentifier(Vertex v)
PuzzleInstance
uniqueIdentifier
in class PuzzleInstance
public void addExtensionVertices()
public void addDoubleExtensionVertices()