vooga.games.tron
Class ComputerController

java.lang.Object
  extended by vooga.games.tron.eventsystem.UserInputEvent
      extended by vooga.games.tron.eventsystem.UserInputEventAdaptor
          extended by vooga.games.tron.ComputerController

public class ComputerController
extends UserInputEventAdaptor


Constructor Summary
ComputerController(Game game, TronPlayer player)
           
 
Method Summary
 void aiUpdate(java.util.List<TronPlayer> tronPlayerList, boolean[][] levelBlocks)
          This is the main class that implements the AI algorithm for the computer-controlled player
 void down()
          performs down turning
 void handleLeftRight()
          This methods handles the upcoming left/right turn by taking into account the previous turns.
 void handleUpDown()
          This method handles the upcoming up/down turning by taking into account the previous turns.
 void left()
           
 void randomLeftRight()
          This method randomly decides whether to turn left or right.
 void randomUpDown()
          This methods randomly decides whether to turn up or down
 void react(int row, int col, java.lang.String direction, boolean[][] blocksTaken)
          This is a subroutine of the AIupdate method that makes the computer-controlled player react to obstacles ahead and make turns accordingly.
 void right()
           
 void up()
           
 
Methods inherited from class vooga.games.tron.eventsystem.UserInputEventAdaptor
mouseLeftPressed, mouseRightPressed, spacePressed
 
Methods inherited from class vooga.games.tron.eventsystem.UserInputEvent
checkInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComputerController

public ComputerController(Game game,
                          TronPlayer player)
Method Detail

aiUpdate

public void aiUpdate(java.util.List<TronPlayer> tronPlayerList,
                     boolean[][] levelBlocks)
This is the main class that implements the AI algorithm for the computer-controlled player

Parameters:
tronPlayerList -
levelBlocks -

react

public void react(int row,
                  int col,
                  java.lang.String direction,
                  boolean[][] blocksTaken)
This is a subroutine of the AIupdate method that makes the computer-controlled player react to obstacles ahead and make turns accordingly.

Parameters:
row -
col -
direction -
blocksTaken -

handleLeftRight

public void handleLeftRight()
This methods handles the upcoming left/right turn by taking into account the previous turns.


handleUpDown

public void handleUpDown()
This method handles the upcoming up/down turning by taking into account the previous turns.


randomLeftRight

public void randomLeftRight()
This method randomly decides whether to turn left or right.


randomUpDown

public void randomUpDown()
This methods randomly decides whether to turn up or down


down

public void down()
performs down turning

Overrides:
down in class UserInputEventAdaptor

left

public void left()
Overrides:
left in class UserInputEventAdaptor

right

public void right()
Overrides:
right in class UserInputEventAdaptor

up

public void up()
Overrides:
up in class UserInputEventAdaptor