jvx.cellular
Class PnMinesweeper
- java.lang.Object
-
- jv.object.PsObject
-
- jvx.project.PjWorkshop
-
- jvx.cellular.PnCellOperator
-
- jvx.cellular.PnMinesweeper
-
- All Implemented Interfaces:
- java.awt.event.KeyListener, java.io.Serializable, java.lang.Cloneable, java.lang.Runnable, java.util.EventListener, PsUpdateIf, PjWorkshopIf, PvPickListenerIf
public class PnMinesweeper extends PnCellOperator implements java.awt.event.KeyListener
Minesweeper game on arbitrary polyhedral surfaces.- See Also:
- Serialized Form
- Author:
- Ulrich Reitebuch
- Version:
- 08.10.12, 3.21 revised (kp) Restore of elementColors in reset() after explosion.
08.03.03, 3.20 revised (kp) Avoid that thread is started multiple times at once.
18.12.02, 3.10 revised (ur) Adapted to changes in exploding of PgElementSet.
28.12.01, 3.00 revised (kp) Full revision when incorporating the new workshop handling.
02.05.01, 2.00 revised (ur) moved to jvx.geom, restore original colors.
16.05.00, 1.00 created (ur)
-
-
Field Summary
-
Fields inherited from class jvx.cellular.PnCellOperator
CORONA, LIFE, MAJORITY, NEIGHBOUR
-
Fields inherited from class jv.object.PsObject
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
-
Fields inherited from interface jv.project.PjWorkshopIf
MODE_BUG, MODE_STANDARD, MODE_VALIDATE
-
-
Constructor Summary
Constructors Constructor and Description PnMinesweeper()ConstructorPnMinesweeper(PgElementSet geom)Deprecated.use constructor prj=new PwMinesweeper();prj.setGeometry(geom);prj.reset();
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description voidclose()Remove pick focus and update from minesweeper, reset elementSet's colors to previous state.voidinit()InitializationvoidkeyPressed(java.awt.event.KeyEvent e)Store, if shift key is pressed.voidkeyReleased(java.awt.event.KeyEvent e)Store, if shift key is pressed.voidkeyTyped(java.awt.event.KeyEvent e)Just to fulfill KeyListener interface.voidpickInitial(PvPickEvent pos)Pick elements to mark or unmark a mined element or to be a not mined element.voidreset()Reset workshop and geometry to original state.voidrestoreColors()Restore element colors and names to the state before playing.voidrun()Explode the geometry if a mined element is hit.voidsetDisplay(PvDisplayIf display)Store currently active display.voidsetExplodeDisplay(PvDisplayIf disp)Deprecated.use setDisplay(PvDisplayIf)voidsetGeometry(PgElementSet geom)Store the PgElementSet to play upon and backup some of its properties.voidsetMines(int noMine)Get random positions for mines.voidstart()Just to disable PnCellOperator.start().voidstop()Just to disable PnCellOperator.stop().booleanupdate(java.lang.Object event)Update the class whenever a child has changed.-
Methods inherited from class jvx.cellular.PnCellOperator
cellOperator, clear, compute, dragDisplay, dragInitial, dragVertex, evaluate, getColor, getNumLoops, getNumStates, getState, makeCoronaInfluence, makeInfluence, makeNeighbourInfluence, markElement, markElement, markGlider, markVertices, pickDisplay, pickVertex, releasePick, requestPick, ruleOfLife, ruleOfMajority, selectGeometry, setColor, setColors, setCurrLoop, setElementTags, setInfluence, setInfluence, setNumLoops, setNumStates, setOutputType, setRule, setRule, unmarkVertices
-
Methods inherited from class jvx.project.PjWorkshop
cancel, getDisplay, getDisplays, getGeometry, getMode, getSavedGeometry, getViewer, isModal, isStandalone, ok, removeGeometry, setDisplays, setGeometry, setModal, setMode, setStandalone, setViewer
-
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jv.project.PvPickListenerIf
getName
-
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent
-
-
-
-
Constructor Detail
-
PnMinesweeper
public PnMinesweeper()
Constructor
-
PnMinesweeper
public PnMinesweeper(PgElementSet geom)
Deprecated. use constructor prj=new PwMinesweeper();prj.setGeometry(geom);prj.reset();Constructor.
-
-
Method Detail
-
init
public void init()
Initialization- Overrides:
initin classPnCellOperator
-
update
public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.- Specified by:
updatein interfacePsUpdateIf- Overrides:
updatein classPnCellOperator- Parameters:
event- sender of this update.- Returns:
- true if update was correctly handled by superclass.
- See Also:
PsObject.setParent(PsUpdateIf),PsObject.getFather(),PsObject.addUpdateListener(PsUpdateIf)
-
setGeometry
public void setGeometry(PgElementSet geom)
Store the PgElementSet to play upon and backup some of its properties.- Overrides:
setGeometryin classPnCellOperator
-
close
public void close()
Remove pick focus and update from minesweeper, reset elementSet's colors to previous state.- Overrides:
closein classPnCellOperator
-
reset
public void reset()
Reset workshop and geometry to original state.- Overrides:
resetin classPnCellOperator
-
setExplodeDisplay
public void setExplodeDisplay(PvDisplayIf disp)
Deprecated. use setDisplay(PvDisplayIf)Store currently active display used in the explosion.
-
setDisplay
public void setDisplay(PvDisplayIf display)
Store currently active display. This is necessary to get the current camera position. Without this we can't find a direction showing downwards on the monitor to get a proper explosion.- Specified by:
setDisplayin interfacePjWorkshopIf- Overrides:
setDisplayin classPjWorkshop
-
setMines
public void setMines(int noMine)
Get random positions for mines.
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent e)
Store, if shift key is pressed.- Specified by:
keyPressedin interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent e)
Store, if shift key is pressed.- Specified by:
keyReleasedin interfacejava.awt.event.KeyListener
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)
Just to fulfill KeyListener interface.- Specified by:
keyTypedin interfacejava.awt.event.KeyListener
-
pickInitial
public void pickInitial(PvPickEvent pos)
Pick elements to mark or unmark a mined element or to be a not mined element.This method fully overwrites the superclass method.
- Specified by:
pickInitialin interfacePvPickListenerIf- Overrides:
pickInitialin classPnCellOperator- Parameters:
pos- Pick event issued by the display- See Also:
PvPickListenerIf
-
run
public void run()
Explode the geometry if a mined element is hit. This method internally blocks when the animation is started. Note, the explosion must run in another thread, otherwise it is not possible to let the explosion run as modal animation.- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classPnCellOperator
-
restoreColors
public void restoreColors()
Restore element colors and names to the state before playing.- Overrides:
restoreColorsin classPnCellOperator
-
start
public void start()
Just to disable PnCellOperator.start().- Overrides:
startin classPnCellOperator
-
stop
public void stop()
Just to disable PnCellOperator.stop().- Overrides:
stopin classPnCellOperator
-
-
"