be.madoka.aardbei.sokoban.logic
Class SokoLogic

java.lang.Object
  |
  +--be.madoka.aardbei.sokoban.Logic
        |
        +--be.madoka.aardbei.sokoban.logic.SokoLogic
All Implemented Interfaces:
Direction

public class SokoLogic
extends Logic
implements Direction

Represents the Logic of a Sokoban game.

Author:
Tim Van Wassenhove

Field Summary
 
Fields inherited from interface be.madoka.aardbei.sokoban.Direction
DOWN, INSERT, LEFT, REMOVE, RIGHT, UNDO_LEVEL, UNDO_MOVE, UP
 
Constructor Summary
SokoLogic()
          Default constructor.
 
Method Summary
 boolean end()
          Ends the game.
 java.lang.String getInfo()
          Gives some info about this game.
 java.lang.String getName()
          Gives the name of this game.
 boolean move(int direction)
          Moves the game in the given direction.
 boolean start(java.lang.String playerName, java.lang.String fileName)
          Starts a new game from the given fileName for the given playerName.
 void worldEvent(PositionChangeEvent e)
          Handles PositionChangeEvents recieved from a World.
 
Methods inherited from class be.madoka.aardbei.sokoban.Logic
addVisualisation, removeVisualisation
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SokoLogic

public SokoLogic()
Default constructor.

Method Detail

worldEvent

public void worldEvent(PositionChangeEvent e)
Handles PositionChangeEvents recieved from a World.

Parameters:
e - the PositionChangeEvent

getName

public java.lang.String getName()
Description copied from class: Logic
Gives the name of this game.

Specified by:
getName in class Logic
Returns:
a String specifying the name

getInfo

public java.lang.String getInfo()
Description copied from class: Logic
Gives some info about this game.

Specified by:
getInfo in class Logic
Returns:
a String giving info about this game

move

public boolean move(int direction)
Description copied from class: Logic
Moves the game in the given direction.

Specified by:
move in class Logic
Parameters:
direction - the direction
Returns:
a boolean specifying if the move was performed or not

start

public boolean start(java.lang.String playerName,
                     java.lang.String fileName)
Description copied from class: Logic
Starts a new game from the given fileName for the given playerName.

Specified by:
start in class Logic
Parameters:
playerName - the playerName
fileName - the filename
Returns:
a boolean specifying whether the game was started or not

end

public boolean end()
Description copied from class: Logic
Ends the game.

Specified by:
end in class Logic
Returns:
a boolean specifying whether the game wa stopped or not