|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdk.brics.bisim.BisimulationGame
public class BisimulationGame
The main class of the application.
Design
Parts:
1. Model-View-Controller
The application uses the MVC design pattern throughout choosing options, playing a game, and simulation a CCS agent. This means e.g. that the SimulatorController listens on user-events on the SimulatorView, and reflects changes in the SimulatorModel.
2. RMI
The game can be played remotely, where one player acts as a server, and one as a client.
The server chooses the input LTSs, his role, and the bisimulation type. An RMI registry is
then started on a fixed port (known to the client) on that host, with a security policy
which grants the following permissions:
permission java.net.SocketPermission "localhost:*", "listen";
permission java.net.SocketPermission "*:*", "accept,connect,resolve";
permission java.io.FilePermission "<
permission java.util.PropertyPermission "*", "read";
Basically this is what is needed for reading arbitrary graph files, executing 'dot' on an arbitrary path,
and making remote connections.
The RMI registry holds two remote objects:
3. GUI
In two-player remote games, a chat function is enabled. To chat, type a message in the text field and hit return, or press the 'Send' button. When the other user sends a message it is displayed below the text field.
4. Computer players
One player games are possible, in which the opponent is a computer player acting as either attacker or defender. The AI player is started in a separate thread and also uses the message passer to send status messages, but unlike remote games there is now only one game model and controller, namely the one associated with the human player. When the human player quits a game, the AI thread is asked to stop running. The AI strategies are based on configuration graphs.
When a game starts, check the game type:
Field Summary | |
---|---|
private AI |
ai
Thread for a computer player. |
private int |
bisimulation
|
private int |
clientServerRole
|
private DotModel |
dotModel
|
private GameController |
gameController
|
private GameModel |
gameModel
|
private GameView |
gameView
|
private GlobalModel |
globalModel
|
private boolean |
hasRegistry
|
private MessagePasser |
messagePasser
|
private OptionsModel |
optionsModel
|
private java.rmi.registry.Registry |
reg
Remote object registry: Used in 2p remote games . |
private int |
role
|
private UserProperties |
userProperties
|
private MainView |
view
|
Constructor Summary | |
---|---|
BisimulationGame()
Starts a bisimulation game, and shows the options view. |
Method Summary | |
---|---|
private void |
initClient()
|
private void |
initLocal()
|
private void |
initServer()
|
static void |
main(java.lang.String[] args)
Starts a bisimulation game with an options model and a view. |
private boolean |
makeLTSs()
Construct an LTSModel for the left and right LTSs and pass this to a GameController. |
void |
quitGame()
Invoked by the game controller when the (local) player wants to quit a game. |
void |
startGame()
Invoked by the options controller. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.rmi.registry.Registry reg
private boolean hasRegistry
private UserProperties userProperties
private DotModel dotModel
private GameModel gameModel
private OptionsModel optionsModel
private GlobalModel globalModel
private MainView view
private GameView gameView
private MessagePasser messagePasser
private GameController gameController
private AI ai
private int role
private int clientServerRole
private int bisimulation
Constructor Detail |
---|
public BisimulationGame() throws javax.swing.text.BadLocationException
javax.swing.text.BadLocationException
- Should never be thrownMethod Detail |
---|
public static void main(java.lang.String[] args)
args
- Arguments are ignoredpublic void startGame()
public void quitGame()
private void initLocal() throws java.rmi.RemoteException
java.rmi.RemoteException
private void initServer() throws java.rmi.RemoteException
java.rmi.RemoteException
private void initClient() throws java.rmi.RemoteException, java.rmi.NotBoundException
java.rmi.RemoteException
java.rmi.NotBoundException
private boolean makeLTSs() throws java.rmi.RemoteException
java.rmi.RemoteException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |