Package battleship.model.player
Class Random
java.lang.Object
battleship.model.player.AbstractPlayer
battleship.model.player.Computer
battleship.model.player.Random
- All Implemented Interfaces:
Player
public class Random extends Computer
place its ship and choose moves randomly
-
Field Summary
Fields inherited from class battleship.model.player.AbstractPlayer
id, moves, ships
-
Constructor Summary
Constructors Constructor Description Random()
-
Method Summary
Modifier and Type Method Description Pair<java.lang.Integer,java.lang.Integer>
chooseMove()
Used by computer onlyvoid
placeShips()
Used byComputer
instances to place shipsMethods inherited from class battleship.model.player.Computer
placeShipRandomly
Methods inherited from class battleship.model.player.AbstractPlayer
addMove, areValid, getId, getMoves, getShips, setId, setShips, toString, validMoves
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
Random
public Random()
-
-
Method Details
-
chooseMove
Description copied from interface:Player
Used by computer only- Returns:
- coords in its opponent grid to play a move
- See Also:
chooseMove()
-
placeShips
public void placeShips()Description copied from interface:Player
Used byComputer
instances to place ships
-