sg.edu.nus.comp.cs3243.pipedream
Class Driver

java.lang.Object
  |
  +--sg.edu.nus.comp.cs3243.pipedream.Driver

public class Driver
extends java.lang.Object

Driver is the class that is used to create an instance of the game. It implements the accessor functions needed in creating your player agent. It can also be used to test your game playing agent.

$Log: Action.java,v $

Since:
1.0

Constructor Summary
Driver()
          constructor for the pipedream package game driver
 
Method Summary
 char[][] getBoard()
          An accessor function to return a 2-d array of characters, giving the current state of the board
 int getFill(int x, int y)
          An accessor function to check the fill status of the board piece at x,y
 boolean getIsEmpty(int x, int y)
          An accessor function to check whether the board piece at x,y is empty.
 int getNextOozeDirection()
          An accessor function to return the Y coordinate of the next spot that the ooze will move to
 int getNextOozeSpotX()
          An accessor function to return the X coordinate of the next spot that the ooze will move to
 int getNextOozeSpotY()
          An accessor function to return the Y coordinate of the next spot that the ooze will move to
 char[] getQueue()
          An accessor function to return an array of characters, giving the queue of tiles to be placed
 int getScore()
          An accessor function to return the agent's score
 char getTile(int x, int y)
          An accessor function to check the type of board piece at x,y
 int getTime()
          An accessor function to return the number of time units elapsed since the start of the game
 int getTimeToNextOoze()
          An accessor function to return the time to the next move of the ooze.
 void printBoard()
          A method to print the board to stdout
 void printQueue()
          A method to print the queue of pieces to stdout
 boolean processTurn(Action a)
          The method used to execute a turn on the board.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Driver

public Driver()
constructor for the pipedream package game driver
Method Detail

getScore

public int getScore()
An accessor function to return the agent's score
Returns:
the score

getTime

public int getTime()
An accessor function to return the number of time units elapsed since the start of the game
Returns:
the time

getTile

public char getTile(int x,
                    int y)
An accessor function to check the type of board piece at x,y
Returns:
the tile. You can compare this value against the constants below.
See Also:
Constants.EMPTY_PIECE, Constants.CROSS_PIECE, Constants.HORIZONTAL_PIECE, Constants.VERTICAL_PIECE, Constants.TOP_LEFT_ELBOW_PIECE, Constants.TOP_RIGHT_ELBOW_PIECE, Constants.BOTTOM_LEFT_ELBOW_PIECE, Constants.BOTTOM_LEFT_ELBOW_PIECE, Constants.START_TOP_PIECE

getFill

public int getFill(int x,
                   int y)
An accessor function to check the fill status of the board piece at x,y
Returns:
the fill status of the tile. You can compare this value against the constants below.
See Also:
Constants.NOT_FILLED, Constants.FILLED, Constants.FILLED_EW_ONLY, Constants.FILLED_NS_ONLY

getIsEmpty

public boolean getIsEmpty(int x,
                          int y)
An accessor function to check whether the board piece at x,y is empty.
Returns:
whether the tile is empty. You can compare this value against the constants below.
See Also:
Constants.EMPTY_PIECE

getNextOozeDirection

public int getNextOozeDirection()
An accessor function to return the Y coordinate of the next spot that the ooze will move to
Returns:
direction of ooze flow. Will be one of the constant values below.
See Also:
Constants.FLOWING_NORTH, Constants.FLOWING_EAST, Constants.FLOWING_SOUTH, Constants.FLOWING_WEST, getNextOozeSpotX(), getNextOozeSpotY(), getTimeToNextOoze()

getTimeToNextOoze

public int getTimeToNextOoze()
An accessor function to return the time to the next move of the ooze.
Returns:
time to next ooze. Should always be positive (1-3, at the beginning of the game before the first ooze: 1-6).
See Also:
getNextOozeSpotX(), getNextOozeSpotY(), getNextOozeDirection()

getNextOozeSpotX

public int getNextOozeSpotX()
An accessor function to return the X coordinate of the next spot that the ooze will move to
Returns:
next ooze X coordinate (-1 to 7). Note that the return value can be outside of the valid range of board coordinates
See Also:
getNextOozeSpotY(), getNextOozeDirection(), getTimeToNextOoze()

getNextOozeSpotY

public int getNextOozeSpotY()
An accessor function to return the Y coordinate of the next spot that the ooze will move to
Returns:
next ooze Y coordinate (-1 to 7). Note that the return value can be outside of the valid range of board coordinates
See Also:
getNextOozeSpotX(), getNextOozeDirection(), getTimeToNextOoze()

getBoard

public char[][] getBoard()
An accessor function to return a 2-d array of characters, giving the current state of the board
Returns:
the board (7x7 array of characters)

getQueue

public char[] getQueue()
An accessor function to return an array of characters, giving the queue of tiles to be placed
Returns:
the array of tiles (of length 5) to be placed (the 0th tile is the current tile to be placed)

printBoard

public void printBoard()
A method to print the board to stdout

printQueue

public void printQueue()
A method to print the queue of pieces to stdout

processTurn

public boolean processTurn(Action a)
The method used to execute a turn on the board. Your main() should call this function in a loop after it has filled out an appropriate Action object.
Parameters:
a - filled Action object
Returns:
whether the game has ended
See Also:
Action