Package battleship

Class Move

java.lang.Object
battleship.Move
All Implemented Interfaces:
IMove

public class Move extends Object implements IMove
Shot
Author:
Your Name Date: 20/02/2026 Time: 19:39
  • Constructor Details

  • Method Details

    • toString

      public String toString()
      Specified by:
      toString in interface IMove
      Overrides:
      toString in class Object
    • getNumber

      public int getNumber()
      Specified by:
      getNumber in interface IMove
    • getShots

      public List<IPosition> getShots()
      Specified by:
      getShots in interface IMove
    • getShotResults

      public List<IGame.ShotResult> getShotResults()
      Specified by:
      getShotResults in interface IMove
    • processEnemyFire

      public String processEnemyFire(boolean verbose)
      Processes the results of enemy fire on the game board, analyzing the outcomes of shots, such as valid shots, repeated shots, missed shots, hits on ships, and sunk ships. It can also display a detailed summary of the shot results if verbose mode is activated.
      Specified by:
      processEnemyFire in interface IMove
      Parameters:
      verbose - a boolean indicating whether a detailed summary should be printed to the console for the processed enemy fire data.
      Returns:
      a JSON-formatted string that encapsulates the results, including counts of valid shots, repeated shots, missed shots, shots outside the game board, and details of hits and sunk ships.