Class TTTengine

java.lang.Object
  extended by TTTengine

public class TTTengine
extends java.lang.Object

Main class file for the TTT ENGINE

Author:
James Barr

Field Summary
private  boolean automode
          status of the program: auto or interactive
private  java.lang.Thread ccpThread
          The thread listening for message from the ccp
private  boolean done
          status of the setup
private  LearningAlgorithm[] opponents
          the array of learning algorithms
private static TTTpanel panel
          the TTT panel object
private  LearningAlgorithm robixInterface
          the robix interface module and its data
private  javaClient.ccpClientPrimitive tttEngine
          the CCP client object
private static TTTgui tttGUI
          the TTT GUI object
private  LearningAlgorithm visionSystem
          the TTT vision system and its data
 
Constructor Summary
TTTengine()
          Creates a ccpClientPrimitive object and initializes booleans to false at the start
 
Method Summary
 boolean determineAutoMode(java.lang.String mode)
          Determine which mode was selected
 void exitAutoMode()
          Closes the auto mode modules AND closes the opponents, then exits the program.
 void exitOpponents()
          Loops through the array of opponents and exits the process for each one
 java.lang.Thread getCCPThread()
          Gets the CCP message listener thread object
 javaClient.ccpClientPrimitive getClient()
          Get the CCP client
 TTTgui getGUI()
          Get the TTT GUI
 int getLAIndex(java.lang.String name, java.lang.String type)
          Get the index of the LA in the array from its name
 java.lang.String getLAName(int index)
          Get the LA's name from the index
 LearningAlgorithm[] getOpponents()
          Get the array of LA's
 TTTpanel getPanel()
          Get the TTT panel
 LearningAlgorithm getRobixInterface()
          Get the Robix Interface object
 LearningAlgorithm getVisionSystem()
          Get the Vision System object
 boolean isAutoMode()
          Get if auto mode or not
 boolean launchAutoMode()
          Launches the modules that the auto mode requires: vision system and robix interface.
 void launchOpponents()
          Launches every LA in the array and starts an output reader thread for each process to show the output of each LA
static void main(java.lang.String[] args)
          Calls the major functions of the program
 void readOpponents()
          Reads in the opponents file and creates an array of LA objects and output readers
 boolean setup()
          Sets up the engine
private  void waitForOpponent()
          Waits for at least one opponent to become alert.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

opponents

private LearningAlgorithm[] opponents
the array of learning algorithms


visionSystem

private LearningAlgorithm visionSystem
the TTT vision system and its data


robixInterface

private LearningAlgorithm robixInterface
the robix interface module and its data


tttEngine

private javaClient.ccpClientPrimitive tttEngine
the CCP client object


tttGUI

private static TTTgui tttGUI
the TTT GUI object


panel

private static TTTpanel panel
the TTT panel object


done

private boolean done
status of the setup


automode

private boolean automode
status of the program: auto or interactive


ccpThread

private java.lang.Thread ccpThread
The thread listening for message from the ccp

Constructor Detail

TTTengine

public TTTengine()
Creates a ccpClientPrimitive object and initializes booleans to false at the start

Method Detail

main

public static void main(java.lang.String[] args)
Calls the major functions of the program

Parameters:
args - - args[0] is "-interactive" for interactive mode or "-auto" for automatic mode

setup

public boolean setup()
Sets up the engine

Returns:
- Returns true if successful, false if not

readOpponents

public void readOpponents()
Reads in the opponents file and creates an array of LA objects and output readers


launchOpponents

public void launchOpponents()
Launches every LA in the array and starts an output reader thread for each process to show the output of each LA


waitForOpponent

private void waitForOpponent()
Waits for at least one opponent to become alert. Keeps looping through the array until one is marked as alert.


launchAutoMode

public boolean launchAutoMode()
Launches the modules that the auto mode requires: vision system and robix interface. Loops and waits until both are online. Can select retry if not enough time or can just exit.

Returns:
- TRUE if both launched fine, FALSE if a problem

exitOpponents

public void exitOpponents()
Loops through the array of opponents and exits the process for each one


exitAutoMode

public void exitAutoMode()
Closes the auto mode modules AND closes the opponents, then exits the program.


determineAutoMode

public boolean determineAutoMode(java.lang.String mode)
Determine which mode was selected

Parameters:
mode - - the mode selected in string form
Returns:
- the mode

getLAIndex

public int getLAIndex(java.lang.String name,
                      java.lang.String type)
Get the index of the LA in the array from its name

Parameters:
name - - name of the LA(ID for auto, Display for interactive)
type - - the type of name: "ID" or "NAME"
Returns:
- the index of the LA in the array

getLAName

public java.lang.String getLAName(int index)
Get the LA's name from the index

Parameters:
index - - the index in the array of LA's
Returns:
- the name of the LA at that index

getOpponents

public LearningAlgorithm[] getOpponents()
Get the array of LA's

Returns:
- the array of LA's

getClient

public javaClient.ccpClientPrimitive getClient()
Get the CCP client

Returns:
- the CCP client

getGUI

public TTTgui getGUI()
Get the TTT GUI

Returns:
- the TTT GUI

getPanel

public TTTpanel getPanel()
Get the TTT panel

Returns:
- the TTT panel

isAutoMode

public boolean isAutoMode()
Get if auto mode or not

Returns:
- TRUE if auto mode, FALSE if interactive mode

getVisionSystem

public LearningAlgorithm getVisionSystem()
Get the Vision System object

Returns:
- the Vision System object

getRobixInterface

public LearningAlgorithm getRobixInterface()
Get the Robix Interface object

Returns:
- the Robix Interface object

getCCPThread

public java.lang.Thread getCCPThread()
Gets the CCP message listener thread object

Returns:
- the ccp listener thread