From 47ade0ae68b1f5b7419440732f2c2ff2f76abe22 Mon Sep 17 00:00:00 2001 From: Fatemeh Date: Thu, 17 Dec 2020 15:44:03 +0330 Subject: [PATCH] Phase 1; Dots And Boxes Controller.(8st) Dots And Boxes View. Player. --- src/plato/controller/DotsAndBoxesController.java | 10 ++++++++-- src/plato/view/DotsAndBoxesView.java | 8 ++++---- src/plato/view/GameView.java | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/plato/controller/DotsAndBoxesController.java b/src/plato/controller/DotsAndBoxesController.java index 103a5f3..3b62031 100644 --- a/src/plato/controller/DotsAndBoxesController.java +++ b/src/plato/controller/DotsAndBoxesController.java @@ -4,6 +4,7 @@ import plato.model.Player; import plato.view.DotsAndBoxesView; +import java.util.ArrayList; import java.util.Scanner; @@ -13,8 +14,9 @@ public class DotsAndBoxesController extends DotsAndBoxes { static final int RIGHT = 0; static final int BOTTOM = 1; public static int numberofplayedgame=0; + public static int turn; boolean[][] box; - int turn; + boolean[][] rightline; boolean[][] bottomline; @@ -123,7 +125,11 @@ public void saveInformation(){ public void availableLines(){ } - public void players(Player player1, Player player2){ + ArrayList players = new ArrayList<>(); + public ArrayList players(Player player1, Player player2){ + players.add(player1); + players.add(player2); + return players; } public void timeToDrawLine(){ diff --git a/src/plato/view/DotsAndBoxesView.java b/src/plato/view/DotsAndBoxesView.java index 78396f5..336127e 100644 --- a/src/plato/view/DotsAndBoxesView.java +++ b/src/plato/view/DotsAndBoxesView.java @@ -9,16 +9,16 @@ public class DotsAndBoxesView extends GameView { public void showWhoseTurn(Player player1, Player player2){ + if(DotsAndBoxesController.turn == 1 ) + System.out.println("It's" + player1 + "Turn"); + if (DotsAndBoxesController.turn == 2) + System.out.println("It's" + player2 + "Turn"); } public void showTable(){ } - //Dots - public void showAvailableLines(){ - - } //Line public void showDrawnLines(){ diff --git a/src/plato/view/GameView.java b/src/plato/view/GameView.java index 17c1cab..2295e33 100644 --- a/src/plato/view/GameView.java +++ b/src/plato/view/GameView.java @@ -50,7 +50,7 @@ public void showPlayedCount(Game game) { } - public String showPoints(Game game) { - return null; + public void showPoints(Game game) { + } }