Class SmarterCPUPlayer

java.lang.Object
  extended by SmarterCPUPlayer
All Implemented Interfaces:
Player

public class SmarterCPUPlayer
extends java.lang.Object
implements Player

SmarterCPUPlayer is a computer-controlled Player that uses a "smarter" strategy to choose which point to strike. You have great flexibility to choose a "smarter" strategy yourself.


Constructor Summary
SmarterCPUPlayer()
           
 
Method Summary
 BoardPoint getNextMove()
           Gets the next move this Player wants to execute.
 boolean isHuman()
           Returns true if this Player is human.
 Ship placeOneShip()
          This method will randomly place one ship.
 void setBoard(Grid grid)
           Sets the board for this Player to the given Grid.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmarterCPUPlayer

public SmarterCPUPlayer()
Method Detail

placeOneShip

public Ship placeOneShip()
This method will randomly place one ship. SmarterCPUPlayer only knows how many ships of each type a player has; this ship placement may or may not be legal given the current state of the Grid.

Specified by:
placeOneShip in interface Player
Returns:
a Ship object

getNextMove

public BoardPoint getNextMove()
Description copied from interface: Player
Gets the next move this Player wants to execute. This move may not be legal, if the BoardPoint in question has already been struck. It is the responsibility of the NavalVesselGame class to check move legality, though.)

Specified by:
getNextMove in interface Player
Returns:
the BoardPoint of the Player's desired move.

isHuman

public boolean isHuman()
Description copied from interface: Player
Returns true if this Player is human.

Specified by:
isHuman in interface Player
Returns:
false

setBoard

public void setBoard(Grid grid)
Description copied from interface: Player
Sets the board for this Player to the given Grid.

Specified by:
setBoard in interface Player
Parameters:
grid - this Player's board.