From 609b2b821a4bb043f8fe56b67723e366652e7708 Mon Sep 17 00:00:00 2001 From: Arthur <78031901+Arthur7770@users.noreply.github.com> Date: Tue, 23 Mar 2021 10:57:35 +0100 Subject: [PATCH] Remove USELESS class Battleship --- src/battleship/model/Battleship.java | 9 --------- src/battleship/model/player/Human.java | 11 +++++++++++ src/battleship/model/player/Player.java | 6 +++--- src/battleship/model/player/Random.java | 10 ++++++++++ 4 files changed, 24 insertions(+), 12 deletions(-) delete mode 100644 src/battleship/model/Battleship.java create mode 100644 src/battleship/model/player/Human.java create mode 100644 src/battleship/model/player/Random.java diff --git a/src/battleship/model/Battleship.java b/src/battleship/model/Battleship.java deleted file mode 100644 index 19cf433..0000000 --- a/src/battleship/model/Battleship.java +++ /dev/null @@ -1,9 +0,0 @@ -package battleship.model; - -import java.util.ArrayList; - -public class Battleship { - - public ArrayList ships; - -} diff --git a/src/battleship/model/player/Human.java b/src/battleship/model/player/Human.java new file mode 100644 index 0000000..904ec3e --- /dev/null +++ b/src/battleship/model/player/Human.java @@ -0,0 +1,11 @@ +package battleship.model.player; + +import battleship.utils.Triplet; + +public class Human extends Player { + + @Override + public Triplet chooseMove() { + return null; + } +} diff --git a/src/battleship/model/player/Player.java b/src/battleship/model/player/Player.java index fad7cc2..1de5ceb 100644 --- a/src/battleship/model/player/Player.java +++ b/src/battleship/model/player/Player.java @@ -8,7 +8,7 @@ import java.util.ArrayList; public abstract class Player { protected ArrayList ships = new ArrayList<>(); - protected ArrayList moves = new ArrayList<>(); + protected ArrayList> moves = new ArrayList<>(); public Player(){ setShips(); @@ -18,8 +18,8 @@ public abstract class Player { } - public void addMove(Triplet move){ + public void addMove(Triplet move){ moves.add(move); } - public abstract Triplet chooseMove(); + public abstract Triplet chooseMove(); } diff --git a/src/battleship/model/player/Random.java b/src/battleship/model/player/Random.java new file mode 100644 index 0000000..7324d47 --- /dev/null +++ b/src/battleship/model/player/Random.java @@ -0,0 +1,10 @@ +package battleship.model.player; + +import battleship.utils.Triplet; + +public class Random extends Player{ + @Override + public Triplet chooseMove() { + return null; + } +}