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 onlyvoidplaceShips()Used byComputerinstances to place shipsMethods inherited from class battleship.model.player.Computer
placeShipRandomlyMethods inherited from class battleship.model.player.AbstractPlayer
addMove, areValid, getId, getMoves, getShips, setId, setShips, toString, validMovesMethods 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:PlayerUsed by computer only- Returns:
- coords in its opponent grid to play a move
- See Also:
chooseMove()
-
placeShips
public void placeShips()Description copied from interface:PlayerUsed byComputerinstances to place ships
-