PrintGame
Class TuringMachine

java.lang.Object
  extended byPrintGame.TuringMachine

public class TuringMachine
extends java.lang.Object

class representing a turing machine.


Field Summary
static int CRAZY
           
static int FASTFORWARD
           
static int NORMAL
           
static int SINGLE_STEP
           
static int VERYFASTFORWARD
           
 
Constructor Summary
TuringMachine()
           
 
Method Summary
protected  boolean checkCellIsStartpoint()
          method checks if the robot's position is the startpoint.
protected  Condition getFieldConditions()
          method returns the conditions of robot's environment
 int getNumSteps()
           
 int getNumTakenDiamonds()
           
 boolean isFinished()
           
protected  boolean performAction(Action action)
          method performes the given action and checks if the robot crashes
 void run(java.awt.Component component)
          method processes an instruction list
protected  void runSingleStep(java.awt.Component component)
           
 void setInstructionList(InstructionList instruct_list)
           
 void setLabyrinthField(LabyrinthField lab_field)
           
 void setMode(int mode)
           
 void setNumNextSteps(int num_next_steps)
           
 void setRobot(Robot robot)
           
 void start(java.awt.Component component)
           
 void takeAndCalcDiamonds()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLE_STEP

public static final int SINGLE_STEP
See Also:
Constant Field Values

FASTFORWARD

public static final int FASTFORWARD
See Also:
Constant Field Values

VERYFASTFORWARD

public static final int VERYFASTFORWARD
See Also:
Constant Field Values

NORMAL

public static final int NORMAL
See Also:
Constant Field Values

CRAZY

public static final int CRAZY
See Also:
Constant Field Values
Constructor Detail

TuringMachine

public TuringMachine()
Method Detail

getFieldConditions

protected Condition getFieldConditions()
method returns the conditions of robot's environment

Returns:
info about the current condition

performAction

protected boolean performAction(Action action)
method performes the given action and checks if the robot crashes

Parameters:
action - specifies what to do
Returns:
true if no problems occure during the action, false if the robot is crashed

setInstructionList

public void setInstructionList(InstructionList instruct_list)

setRobot

public void setRobot(Robot robot)

setLabyrinthField

public void setLabyrinthField(LabyrinthField lab_field)

takeAndCalcDiamonds

public void takeAndCalcDiamonds()

start

public void start(java.awt.Component component)
           throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

run

public void run(java.awt.Component component)
         throws java.lang.InterruptedException
method processes an instruction list

Parameters:
component - window which contains the labyrinth field
Throws:
java.lang.InterruptedException

runSingleStep

protected void runSingleStep(java.awt.Component component)
                      throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

checkCellIsStartpoint

protected boolean checkCellIsStartpoint()
method checks if the robot's position is the startpoint.


setMode

public void setMode(int mode)

getNumSteps

public int getNumSteps()

getNumTakenDiamonds

public int getNumTakenDiamonds()

isFinished

public boolean isFinished()

setNumNextSteps

public void setNumNextSteps(int num_next_steps)