<repo_name>NicolaiNisbeth/CDIO3<file_sep>/src/test/java/Utilities/TextReaderTest.java
package Utilities;

import org.junit.Test;

import java.io.IOException;
import java.util.HashMap;

import static org.junit.Assert.*;

public class TextReaderTest {


    @Test
    public void textReader() throws IOException {
        int[] fieldsPrice = {2,1,1,0,1,1,0,2,2,0,2,2,0,3,3,0,3,3,0,4,4,0,5,5};
        String file = ".\\src\\Resources\\SquarePrice";
        HashMap fieldPricesFile = TextReader.textReader(file);

        assertEquals(fieldsPrice.length, fieldPricesFile.size());

        for (int price = 0; price < fieldsPrice.length; price++) {
            assertEquals(fieldsPrice[price], fieldPricesFile.get(price));
        }
    }
}<file_sep>/src/main/java/Model/Fields/Start.java
package Model.Fields;

import Controller.PlayerController;

public class Start extends Field {

    public Start(int positionOnBoard) {
        super(positionOnBoard);
    }

    @Override
    public int getPositionOnBoard() {
        return super.getPositionOnBoard();
    }

    @Override
    public int landedOnStreet(PlayerController playerC, int ref) {
        return -1;
    }
}
<file_sep>/src/main/java/Model/Fields/Parking.java
package Model.Fields;

import Controller.PlayerController;

public class Parking extends Field {


    public Parking(int positionOnBoard) {
        super(positionOnBoard);
    }

    @Override
    public int getPositionOnBoard() {
        return super.getPositionOnBoard();
    }

    @Override
    public int landedOnStreet(PlayerController playerC, int ref) {
        return -1;
    }
}
<file_sep>/src/test/java/Model/Fields/ChanceTest.java
package Model.Fields;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

public class ChanceTest {
    Chance chance;

    @Before
    public void initialize() {
         chance = new Chance(3);
    }

    @Test
    public void instantiateCards() {
        int[] chanceD = chance.getChanceCards();

        // Makes sure there are no duplicates in deck
        for (int i = 0; i < chanceD.length; i++) {
            int j = (i + 1) % chanceD.length;
            assertTrue(chanceD[i] != chanceD[j]);
        }
    }

    @Test
    public void mixCards() {
        for (int i = 0; i < chance.getChanceCards().length; i++) {
            int firstCard = chance.getChanceCards()[0];
            int secondCard = chance.getChanceCards()[1];
            chance.mixCards();
            int cardOnTop = chance.getChanceCards()[0];
            int cardInBottom = chance.getChanceCards()[20-1];
            assertEquals(firstCard, cardInBottom);
            assertEquals(secondCard, cardOnTop);
        }
    }
}<file_sep>/src/main/java/View/CarColor.java
package View;

import java.awt.*;

public class CarColor {
    private Color[] colorArray = new Color[4];
    private int numOfColors = 4;
    private int colorsChosen;
    private String[] colorStringArray;
    private String[] colorStringArray2;
    private String colorChosenString;

    public CarColor() {
        instaColorArray();
        instaColorStringArray();
    }

    public Color colorChosen(String colorChoiceString) {
        Color returnColor;
        colorChosenString = colorChoiceString;
        if (colorChoiceString.equalsIgnoreCase("grey")) {
            returnColor = colorArray[0];
        } else if (colorChoiceString.equalsIgnoreCase("green")) {
            returnColor = colorArray[1];
        } else if (colorChoiceString.equalsIgnoreCase("blue")) {
            returnColor = colorArray[2];
        } else {
            //If choice is magenta
            returnColor = colorArray[3];
        }
        colorsChosen++;
        updateColorStringArray(colorChoiceString);
        return returnColor;
    }

    public void updateColorStringArray(String lastChosen) {
        colorStringArray2 = new String[colorStringArray.length];


        for (int i = 0; i < colorStringArray.length; i++) {
            colorStringArray2[i] = colorStringArray[i];
        }
        colorStringArray = new String[(numOfColors - colorsChosen)];
        for (int i = 0; i < colorStringArray.length; i++) {
            if (!colorStringArray2[i].equalsIgnoreCase(lastChosen)) {
                colorStringArray[i] = colorStringArray2[i];
            }
            if (colorStringArray2[i].equalsIgnoreCase(lastChosen)) {
                colorStringArray[i] = colorStringArray2[i + 1];
                for (int j = i; j < colorStringArray.length; j++) {
                    colorStringArray[j] = colorStringArray2[j + 1];
                }
                break;
            }
        }
    }
    public String colorsToChooseFrom() {
        String returnString = "";
        for (int i = 0; i < colorStringArray.length; i++) {
            returnString = returnString + colorStringArray[i] + " ";
        }
        return returnString;
    }
    private void instaColorArray() {
        colorArray[0] = Color.darkGray;
        colorArray[1] = Color.GREEN;
        colorArray[2] = Color.BLUE;
        colorArray[3] = Color.MAGENTA;
    }
    public void instaColorStringArray() {
        colorStringArray = new String[4];
        colorStringArray[0] = "Grey";
        colorStringArray[1] = "Green";
        colorStringArray[2] = "Blue";
        colorStringArray[3] = "Magenta";
    }

    public String[] getColorStringArray() {
        return colorStringArray;
    }

    public String getColorChosenString() {
        return colorChosenString;
    }
}<file_sep>/src/test/java/Model/AccountTest.java
package Model;

import Model.Fields.Street;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

public class AccountTest {
    Account account2Players;

    @Before
    public void initialize(){
        account2Players = new Account(2);
    }

    @Test
    public void startAccount() {
        assertEquals(20, account2Players.getBalance());

        Account account3Players = new Account(3);
        assertEquals(18, account3Players.getBalance());

        Account account4Players = new Account(4);
        assertEquals(16, account4Players.getBalance());
    }

    @Test
    public void addProperty() {
        Street burgerJoint = new Street(1, 1, false);
        Street boardwalk = new Street(23, 5, false);
        assertEquals(0, account2Players.getSumOfStreets());
        account2Players.addStreet(burgerJoint);
        account2Players.addStreet(boardwalk);
        assertEquals(6, account2Players.getSumOfStreets());
    }

    @Test
    public void updateBalance() {
        assertEquals(20, account2Players.getBalance());
        account2Players.updateBalance(2);
        assertEquals(22, account2Players.getBalance());
    }
}<file_sep>/src/main/java/Model/Fields/GoToPrison.java
package Model.Fields;

import Controller.PlayerController;

public class GoToPrison extends Field {


    public GoToPrison(int positionOnBoard) {
        super(positionOnBoard);
    }

    @Override
    public int getPositionOnBoard() {
        return super.getPositionOnBoard();
    }

    @Override
    public int landedOnStreet(PlayerController playerC, int ref) {
        playerC.setPosition(6,ref);
        playerC.setInJail(ref, true);
        return -18;
    }
}
<file_sep>/src/main/java/Model/Player.java
package Model;

import Model.Fields.Street;
import java.util.ArrayList;

public class Player {

    private String name = "";
    private int oldPosition;
    private int curPosition = 0;
    private int objectNumber;
    private Account account;
    private boolean broke = false;
    private boolean inJail = false;
    private boolean jailCard = false;
    private boolean specialCard = false;

    public Player(int objectNumber, int numOfPlayers){
        this.objectNumber = objectNumber;
        this.account = new Account(numOfPlayers);
    }
    public int getSumOfProperties(){
        return account.getSumOfStreets();
    }
    public void setSumOfProperties(int sumOfProperties){
        account.setSumOfStreets(sumOfProperties);
    }
    public void addStreet(Street street){
        account.addStreet(street);
    }

    public void setBalance(int newBalance){ account.setBalance(newBalance);}

    public int getBalance() {
        return account.getBalance();
    }

    public void updateBalance(int amount) {
        this.account.updateBalance(amount);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCurPosition() {
        return curPosition;
    }

    public void setCurPosition(int curPosition) {
        this.curPosition = curPosition;
    }

    public int getObjectNumber() {
        return objectNumber;
    }

    public boolean getBroke(){
        return broke;
    }

    public void setBroke(boolean broke) {
        this.broke = broke;
    }

    public int getOldPosition() {
        return oldPosition;
    }
    public void setOldPosition(int oldPosition) {
        this.oldPosition = oldPosition;
    }

    public boolean getJailCard(){
        return jailCard;
    }

    public void setJailCard(Boolean bool){
        jailCard = bool;
    }

    public boolean getInJail(){
        return inJail;
    }

    public void setInJail(Boolean bool){
        inJail = bool;
    }

    public boolean getSpecialCard() {return specialCard;}

    public void setSpecialCard(Boolean bool) {specialCard = bool; }

    public ArrayList getAllPlayersStreets(){
        return this.account.getPlayersStreets();
    }

    public boolean ownsStreetAheadOrBehind(int lfStreetPos){
        return account.ownsStreetAheadOrBehind(lfStreetPos);
    }
}
<file_sep>/src/main/java/View/GuiHandler.java
package View;

import Controller.GameBoard;
import Controller.PlayerController;
import Utilities.TextReader;
import Model.Die;
import Model.Fields.Field;
import gui_codebehind.GUI_Center;
import gui_fields.*;
import gui_main.GUI;
import java.awt.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;

import static gui_fields.GUI_Car.Type.*;

public class GuiHandler {
    private MessageHandler message;
    private GUI gui;
    private GUI_Field[] fields;
    private GUI_Player[] gui_Players;
    private GUI_Car[] gui_cars;
    private HashMap streetNames;
    private HashMap streetDesc;
    private HashMap chanceDesc;

    //Construktor
    public GuiHandler() throws IOException {
        message = new MessageHandler();
        fields = new GUI_Field[24];
        streetNames = TextReader.textReader(".\\src\\Resources\\SquareNames");
        streetDesc = TextReader.textReader(".\\src\\Resources\\SquareDescription");
        chanceDesc = TextReader.textReader(".\\src\\Resources\\ChanceCard");
        for (int i = 0; i < fields.length; i++) {
            fields[i] = new GUI_Street((String) streetNames.get(i), "", (String) streetDesc.get(i), "", Color.YELLOW, Color.BLACK);
        }
        setSpecificFields();
        gui = new GUI(fields);
    }

    public void changeBorderColor(PlayerController playerC, int i) {
        GUI_Field field;
        GUI_Street street;
        Color carColor = getGuiPlayer(i).getCar().getPrimaryColor();
        field = gui.getFields()[playerC.getPosition(i)];
        street = (GUI_Street) field;
        street.setBorder(carColor);
    }

    public int choseNumOfPlayers() {
        //int players = gui.getUserInteger("How many players is participating in the game?");
        int numOfPlayers;
        while (true) {
            String input = gui.getUserString(message.gameMessage("33"));
            if (input.matches("^[2-4]$") && input.length() > 0) {
                numOfPlayers = Integer.parseInt(input);
                break;
            } else {
                gui.showMessage(message.gameMessage("34"));
            }
        }
        return numOfPlayers;
    }

    public void setGameUpGui(PlayerController playerC) {
        int numOfPlayers = playerC.getNumOfPlayers();
        gui_cars = new GUI_Car[numOfPlayers];
        gui_Players = new GUI_Player[numOfPlayers];
        CarColor carColor = new CarColor();

        for (int i = 0; i < playerC.getNumOfPlayers(); i++) {
            enterNamePlayer(playerC, i);
            GUI_Car car = chosePlayerCar(carColor, playerC, i);
            addGuiPlayer(playerC, i, car);
            setSpecificCar(playerC, i);
        }
    }

    public GUI_Player getGuiPlayer(int i) {
        GUI_Player guiPlayer = gui_Players[i];
        return guiPlayer;
    }

    public void addGuiPlayer(PlayerController playerC, int ref, GUI_Car car) {
        gui_Players[ref] = new GUI_Player(playerC.getName(ref), playerC.getBalance(ref), car);
        gui.addPlayer(gui_Players[ref]);
    }

    public Color chooseCarColor(CarColor carColorObj, PlayerController playerC, int ref) {
        String[] chooseColorStrings = carColorObj.colorsToChooseFrom().split(" ");
        String carColorS;

        for (int i = 0; i < chooseColorStrings.length; i++) {
        }
        if (chooseColorStrings.length == 4) {
            carColorS = gui.getUserSelection("Choose color", chooseColorStrings[0], chooseColorStrings[1], chooseColorStrings[2], chooseColorStrings[3]);
        } else if (chooseColorStrings.length == 3) {
            carColorS = gui.getUserSelection("Choose color", chooseColorStrings[0], chooseColorStrings[1], chooseColorStrings[2]);
        } else if (chooseColorStrings.length == 2) {
            carColorS = gui.getUserSelection("Choose color", chooseColorStrings[0], chooseColorStrings[1]);
        } else {
            gui.showMessage(playerC.getName(ref) + "'s color is " + chooseColorStrings[0]);
            carColorS = chooseColorStrings[0];
        }
        Color carColorChoice = carColorObj.colorChosen(carColorS);

        return carColorChoice;
    }

    public GUI_Car chosePlayerCar(CarColor carColorObj, PlayerController playerC, int ref) {
        String carChoice = gui.getUserSelection("Choose car", "Car", "Ufo", "Tractor", "Racecar");
        GUI_Car car;
        Color carColor = chooseCarColor(carColorObj, playerC, ref);

        if (carChoice.equalsIgnoreCase("ufo")) {
            car = new GUI_Car(carColor, Color.blue, UFO, GUI_Car.Pattern.FILL);
            gui_cars[ref] = car;
        } else if (carChoice.equalsIgnoreCase("car")) {
            car = new GUI_Car(carColor, Color.blue, CAR, GUI_Car.Pattern.FILL);
            gui_cars[ref] = car;
        } else if (carChoice.equalsIgnoreCase("tractor")) {
            car = new GUI_Car(carColor, Color.blue, TRACTOR, GUI_Car.Pattern.FILL);
            gui_cars[ref] = car;
        } else {
            car = new GUI_Car(carColor, Color.blue, RACECAR, GUI_Car.Pattern.FILL);
            gui_cars[ref] = car;
        }
        return car;
    }

    public void enterNamePlayer(PlayerController playerC, int ref) {
        while (true) {
            String input = gui.getUserString(message.turnMessage(playerC, ref, "26") + " " + (ref + 1));
            if (input.length() > 0) {
                playerC.setName(input, ref);
                break;
            } else {
                gui.showMessage(message.turnMessage(playerC, ref, "27") + " " + (ref + 1));
            }
        }
    }

    public void setDiceGui(Die die) {
        gui.setDie(die.getFaceValue());
    }

    public void playerTurnGui(PlayerController player, int ref) {
        gui.showMessage(message.playerTurn(player, ref));
    }

    public void showScore(PlayerController player, int i) {
        gui.showMessage(message.playerEndTurn(player, i));
    }

    public void removeSpecificCar(PlayerController playerC, int ref) {
        fields[(playerC.getOldPosition(ref))].removeAllCars();
    }

    public void setSpecificCar(PlayerController playerC, int ref) {
        fields[(playerC.getPosition(ref))].setCar(getGuiPlayer(ref), true);
    }

    public void removeAllCarsCurPos(PlayerController playerC) {
        for (int i = 0; i < gui_Players.length; i++) {
            fields[(playerC.getPosition(i))].removeAllCars();
        }
    }

    public void setAllCarsCurPos(PlayerController playerC) {
        for (int i = 0; i < gui_Players.length; i++) {
            fields[(playerC.getPosition(i))].setCar(getGuiPlayer(i), true);
        }
    }

    public void diceUpdateGui(PlayerController player, Die die) {
        setDiceGui(die);
    }

    public void updateGuiPlayerBalance(PlayerController playerC) {
        for (int i = 0; i < gui_Players.length; i++) {
            gui_Players[i].setBalance(playerC.getBalance(i));
        }
    }

    public void messageSquareGui(PlayerController playerC, int ref, Field field, boolean passedStart) {
        if (passedStart) {
            gui.showMessage(message.messageField(playerC, ref));
        }
        gui.showMessage(message.messageField(playerC, ref, field, playerC.getPosition(ref)));
    }

    public void messageSquareGuiSpecial(PlayerController playerC, int ref, boolean passedStart) {
        if (passedStart) {
            gui.showMessage(message.messageField(playerC, ref));
        }
        gui.showMessage(message.messageSpecial(playerC, ref, playerC.getPosition(ref)));
    }

    public void impactSquareGui(int squareInt, PlayerController playerC, int i, GameBoard board) {
        if (squareInt < 0) {
            updateGuiPlayerBalance(playerC);
            //Player bought a street
            if (squareInt == -2) {
                changeBorderColor(playerC, i);
            } else if (squareInt == -3) {

            }
            //Go to jail
            else if (squareInt == -18) {
                removeSpecificCar(playerC, i);
                fields[6].setCar(getGuiPlayer(i), true);
            }
        } else {
            //If the square int is 0 or more, then it's because the player picked up a chance card
            guiChanceSwitch(squareInt, playerC, i, board);
            updateGuiPlayerBalance(playerC);
        }
    }

    public void resetGuiChance() {
        GUI_Center.getInstance().displayDefault();
    }

    public void guiSpecialChance(PlayerController playerC, int ref) {
        removeSpecificCar(playerC, ref);
        setAllCarsCurPos(playerC);
        setSpecificCar(playerC, ref);
    }

    public void guiChanceSwitch(int squareInt, PlayerController playerC, int ref, GameBoard board) {
        switch (squareInt + 1) {
            case 1: //Special card for player 1
                gui.displayChanceCard((String) chanceDesc.get(0));
                if (playerC.getPlayerObjectNumber(ref) != 0) {
                    board.getSquare(squareInt).landedOnStreet(playerC, ref);

                }
                break;
            case 2: //Move to start
                gui.displayChanceCard((String) chanceDesc.get(1));
                removeSpecificCar(playerC, ref);
                setAllCarsCurPos(playerC);
                setSpecificCar(playerC, ref);
                break;
            case 3: //Advance between 1 to 5 fields.
                gui.displayChanceCard((String) chanceDesc.get(2));
                int choiceInt = Integer.parseInt(gui.getUserButtonPressed("", "1", "2", "3", "4", "5"));
                playerC.setPosition(((playerC.getPosition(ref) + choiceInt) % 24), ref);
                removeSpecificCar(playerC, ref);
                setAllCarsCurPos(playerC);
                setSpecificCar(playerC, ref);
                break;
            case 4: // Move to an orange field. If it's NOT owned, the street is yours. Else pay rent to the owner.
                gui.displayChanceCard((String) chanceDesc.get(3));
                String case4 = gui.getUserButtonPressed("", "Skate Park", "Swimming Pool");
                movePlayerToColor(playerC, ref, case4);
                break;
            case 5: //Advance 1 field or take an extra chance card.
                gui.displayChanceCard((String) chanceDesc.get(4));
                String choiceS = (gui.getUserButtonPressed("", "Advance 1 field", "Try your luck"));
                if (choiceS.equalsIgnoreCase("Advance 1 field")) {
                    playerC.setPosition(playerC.getPosition(ref) + 1, ref);
                    removeSpecificCar(playerC, ref);
                    setAllCarsCurPos(playerC);
                    setSpecificCar(playerC, ref);
                } else {
                    //pick a new chance card
                    gui.showMessage("You chose to pick another card!" + "\n" + "Good luck!");
                    board.getSquare(3).landedOnStreet(playerC, ref);
                    removeSpecificCar(playerC, ref);
                    setAllCarsCurPos(playerC);
                    setSpecificCar(playerC, ref);
                }
                break;
            case 6: //Special card for player 2
                gui.displayChanceCard((String) chanceDesc.get(5));
                if (playerC.getPlayerObjectNumber(ref) != 0) {
                    board.getSquare(squareInt).landedOnStreet(playerC, ref);
                }
                break;
            case 7: //You have eaten too much candy. Pay the bank $2.
                gui.displayChanceCard((String) chanceDesc.get(6));
                updateGuiPlayerBalance(playerC);
                break;
            case 8: //Move to an orange or green field. If it's NOT owned, the street is yours. Else pay rent to the owner.
                gui.displayChanceCard((String) chanceDesc.get(7));
                String case8 = gui.getUserButtonPressed("", "Skate Park", "Swimming Pool", "Bowling Alley", "Zoo");
                movePlayerToColor(playerC, ref, case8);
                break;
            case 9: //Move to a light blue field. If it's NOT owned, the street is yours. Else pay rent to the owner.
                gui.displayChanceCard((String) chanceDesc.get(8));
                String case9 = gui.getUserButtonPressed("", "Candy Store", "Ice Cream Parlor");
                movePlayerToColor(playerC, ref, case9);
                break;
            case 10: //You will be released from prison without being charged. Save this card for later use.
                gui.displayChanceCard((String) chanceDesc.get(9));
                break;
            case 11: //Move to the sea front.
                gui.displayChanceCard((String) chanceDesc.get(10));
                removeSpecificCar(playerC, ref);
                setAllCarsCurPos(playerC);
                setSpecificCar(playerC, ref);
                break;
            case 12: //Special card for player 3
                gui.displayChanceCard((String) chanceDesc.get(11));
                if (playerC.getPlayerObjectNumber(ref) != 0) {
                    board.getSquare(squareInt).landedOnStreet(playerC, ref);
                }
                break;
            case 13: //Special card for player 4
                gui.displayChanceCard((String) chanceDesc.get(12));
                if (playerC.getPlayerObjectNumber(ref) != 0) {
                    board.getSquare(squareInt).landedOnStreet(playerC, ref);
                }
                break;
            case 14: //Today is your birthday. Every player gives you $1. HAPPY BIRTHDAY!
                gui.displayChanceCard((String) chanceDesc.get(13));
                updateGuiPlayerBalance(playerC);
                break;
            case 15: //Move to a pink or dark blue field. If it's NOT owned, the street is yours. Else pay rent to the owner.
                gui.displayChanceCard((String) chanceDesc.get(14));
                String case15 = gui.getUserButtonPressed("", "Museum", "Library", "Park Place", "Boardwalk");
                movePlayerToColor(playerC, ref, case15);
                break;
            case 16: //You have finished all your homework. Receive $2 on behalf of the bank.
                gui.displayChanceCard((String) chanceDesc.get(15));
                updateGuiPlayerBalance(playerC);
                break;
            case 17: //Move to a red field. If it's NOT owned, the street is yours. Else pay rent to the owner.
                gui.displayChanceCard((String) chanceDesc.get(16));
                String case17 = gui.getUserButtonPressed("", "Video Game Arcade", "Cinema");
                movePlayerToColor(playerC, ref, case17);
                break;
            case 18: //Move to the skater park to execute the perfect grind! If it's NOT owned, the street is yours. Else pay rent to the owner.
                gui.displayChanceCard((String) chanceDesc.get(17));
                removeSpecificCar(playerC, ref);
                setAllCarsCurPos(playerC);
                setSpecificCar(playerC, ref);
                break;
            case 19: //Move to a light blue or red field. If it's NOT owned, the street is yours. Else pay rent to the owner.
                gui.displayChanceCard((String) chanceDesc.get(18));
                String case19 = gui.getUserButtonPressed("", "Candy Store", "Ice Cream Parlor", "Video Game Arcade", "Cinema");
                movePlayerToColor(playerC, ref, case19);
                break;
            case 20: //Move to a brown or yellow field. If it's NOT owned, the street is yours. Else pay rent to the owner.
                gui.displayChanceCard((String) chanceDesc.get(19));
                String case20 = gui.getUserButtonPressed("", "Burger Joint", "Pizza House", "Toy Store", "Pet Store");
                movePlayerToColor(playerC, ref, case20);
                break;
        }
    }

    public void movePlayerToColor(PlayerController playerC, int ref, String choice) {
        String[] streets = {"Start", "Burger Joint", "Pizza House", "Chance", "Candy Store", "Ice Cream Parlor",
                "Jail", "Museum", "Library", "Chance", "Skate Park", "Swimming Pool", "Free Parking",
                "Video Game Arcade", "Cinema", "Chance", "Toy Store", "Pet Store", "Go To Jail",
                "Bowling Alley", "Zoo", "Chance", "Park Place", "Boardwalk"};

        int position = Arrays.asList(streets).indexOf(choice);
        playerC.setPosition(position, ref);
        removeSpecificCar(playerC, ref);
        setAllCarsCurPos(playerC);
        setSpecificCar(playerC, ref);
    }

    public void playerWonGui(PlayerController playerC, int i) {
        gui.showMessage(message.playerWon(playerC, i));
    }

    public void gotBrokeGui(PlayerController playerC, int i) {
        gui.showMessage(message.gotBroke(playerC, i));
    }

    public void startGameGui() {
        gui.showMessage(message.startGame1());
        gui.showMessage(message.startGame2());
        gui.showMessage(message.startGame3());
        gui.showMessage(message.startGame4());
    }

    public void specialMessage1(PlayerController playerC, int ref) {
        gui.showMessage(message.turnMessage(playerC, ref, "32"));
    }

    public void specialMessage2(PlayerController playerC, int ref) {
        gui.showMessage(message.turnMessage(playerC, ref, "31"));
    }

    public void specialMessage3(PlayerController playerC, int ref) {
        gui.showMessage(message.turnMessage(playerC, ref, "30"));
    }

    public void specialMessage4(PlayerController playerC, int ref) {
        gui.showMessage(message.turnMessage(playerC, ref, "40"));
    }

    public void specialMessage5(PlayerController playerC, int ref) {
        gui.showMessage(message.turnMessage(playerC, ref, "45"));
    }

    public void setSpecificFields() {
        fields[0] = new GUI_Start("Start", fields[0].getSubText(), fields[0].getDescription(), Color.RED, Color.BLACK);
        fields[3] = new GUI_Chance("?", fields[3].getSubText(), fields[3].getDescription(), new Color(204, 204, 204), Color.BLACK);
        fields[9] = new GUI_Chance("?", fields[3].getSubText(), fields[3].getDescription(), new Color(204, 204, 204), Color.BLACK);
        fields[15] = new GUI_Chance("?", fields[3].getSubText(), fields[3].getDescription(), new Color(204, 204, 204), Color.BLACK);
        fields[21] = new GUI_Chance("?", fields[3].getSubText(), fields[3].getDescription(), new Color(204, 204, 204), Color.BLACK);
        fields[6] = new GUI_Jail("default", fields[6].getTitle(), fields[6].getSubText(), fields[6].getDescription(), new Color(125, 125, 125), Color.BLACK);
        fields[18] = new GUI_Jail("default", fields[18].getTitle(), fields[18].getSubText(), fields[18].getDescription(), new Color(125, 125, 125), Color.BLACK);
        fields[1].setBackGroundColor(new Color(63, 73, 30));
        fields[2].setBackGroundColor(new Color(63, 73, 30));
        fields[4].setBackGroundColor(new Color(0, 143, 204));
        fields[5].setBackGroundColor(new Color(0, 143, 204));
        fields[7].setBackGroundColor(new Color(198, 94, 204));
        fields[8].setBackGroundColor(new Color(198, 94, 204));
        fields[10].setBackGroundColor(new Color(249, 166, 2));
        fields[11].setBackGroundColor(new Color(249, 166, 2));
        fields[13].setBackGroundColor(new Color(255, 0, 70));
        fields[14].setBackGroundColor(new Color(255, 0, 70));
        fields[16].setBackGroundColor(new Color(255, 253, 34));
        fields[17].setBackGroundColor(new Color(255, 253, 34));
        fields[19].setBackGroundColor(new Color(112, 255, 64));
        fields[20].setBackGroundColor(new Color(112, 255, 64));
        fields[22].setBackGroundColor(new Color(16, 54, 100));
        fields[23].setBackGroundColor(new Color(16, 54, 100));
    }
}<file_sep>/src/test/java/Controller/PlayerControllerTest.java
package Controller;

import Controller.PlayerController;
import org.junit.Test;

import static org.junit.Assert.*;
import org.junit.Before;

public class PlayerControllerTest {
    private PlayerController playerC;
    @Before
    public void initialize() {
        playerC = new PlayerController(4);
        for (int i = 0; i < 4; i++) {
            assertEquals(0, playerC.getPosition(i));
            assertEquals(16, playerC.getBalance(i));
        }
    }

    @Test
    public void calcNewPosition() {
        // Gameboard indexes from 0 to 23 and has 24 fields.
        playerC.setPosition(23, 0);
        playerC.calcNewPosition(1, 0);
        assertEquals(0, playerC.getPosition(0));

        playerC.setPosition(0, 1);
        playerC.calcNewPosition(5, 1);
        assertEquals(5, playerC.getPosition(1));
    }

    @Test
    public void broke() {
        assertFalse(playerC.getModelBroke(0));
        assertEquals(16, playerC.getBalance(0));

        playerC.updatePlayerBalance(0, -17);
        playerC.broke(0);

        assertTrue(playerC.getModelBroke(0));
    }

    @Test
    public void playerWithHighestBalance() {

        playerC.updatePlayerBalance(0, 4);
        playerC.updatePlayerBalance(1, 2);
        playerC.updatePlayerBalance(2, 10);
        playerC.updatePlayerBalance(3, 10);

        playerC.setSumOfStreets(2, 15);
        playerC.setSumOfStreets(3, 10);
        assertEquals(2, playerC.playerWithHighestBalance());

        playerC.setSumOfStreets(3, 20);
        assertEquals(3, playerC.playerWithHighestBalance());
    }

    @Test
    public void wantOutOfJail() {
        assertEquals(16, playerC.getBalance(0));
        assertFalse(playerC.inJail(0));

        playerC.setInJail(0, true);
        assertTrue(playerC.inJail(0));
        playerC.wantOutOfJail(0);

        assertEquals(15, playerC.getBalance(0));
        assertFalse(playerC.inJail(0));
    }
}

<file_sep>/src/test/java/Model/Fields/FieldTest.java
package Model.Fields;

import Controller.PlayerController;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

public class FieldTest {

    PlayerController playerC;
    Chance chance;

    @Before
    public void initialize(){
        playerC = new PlayerController(4);
        chance = new Chance(3);
        for (int i = 0; i < 4; i++) {
            assertEquals(0, playerC.getPosition(i));
            assertEquals(16, playerC.getBalance(i));
        }
    }

    @Test
    public void landedOnStreet() {
        // ChanceCard 0
        playerC.setPosition(3, 0);
        assertFalse(playerC.getSpecialCard(0));
        int[] chance0 = {1};
        chance.setChanceCards(chance0);
        chance.landedOnStreet(playerC, 0);
        assertTrue(playerC.getSpecialCard(0));

        // ChanceCard 1
        playerC.setPosition(3, 0);
        int[] chance1 = {2};
        chance.setChanceCards(chance1);
        chance.landedOnStreet(playerC, 0);
        assertEquals(0, playerC.getPosition(0));

        // ChanceCard 5
        playerC.setPosition(3, 0);
        assertFalse(playerC.getSpecialCard(1));
        int[] chance5 = {6};
        chance.setChanceCards(chance5);
        chance.landedOnStreet(playerC, 0);
        assertTrue(playerC.getSpecialCard(1));

        // ChanceCard 6
        playerC.setPosition(3, 0);
        int[] chance7 = {7};
        chance.setChanceCards(chance7);
        chance.landedOnStreet(playerC, 0);
        assertEquals(14, playerC.getBalance(0));

        // ChanceCard 9
        playerC.setPosition(3, 0);
        assertFalse(playerC.getJailCard(0));
        int[] chance9 = {10};
        chance.setChanceCards(chance9);
        chance.landedOnStreet(playerC, 0);
        assertTrue(playerC.getJailCard(0));

        // ChanceCard 10
        playerC.setPosition(3, 0);
        int[] chance10 = {11};
        chance.setChanceCards(chance10);
        chance.landedOnStreet(playerC, 0);
        assertEquals(23, playerC.getPosition(0));

        // ChanceCard 11
        playerC.setPosition(3, 0);
        assertFalse(playerC.getSpecialCard(2));
        int[] chance11 = {12};
        chance.setChanceCards(chance11);
        chance.landedOnStreet(playerC, 0);
        assertTrue(playerC.getSpecialCard(2));

        // ChanceCard 12
        playerC.setPosition(3, 0);
        assertFalse(playerC.getSpecialCard(3));
        int[] chance12 = {13};
        chance.setChanceCards(chance12);
        chance.landedOnStreet(playerC, 0);
        assertTrue(playerC.getSpecialCard(3));

        // ChanceCard 13
        playerC.setPosition(3, 0);
        playerC.setBalance(16, 0);
        int[] chance13 = {14};
        chance.setChanceCards(chance13);
        chance.landedOnStreet(playerC, 0);
        assertEquals(19, playerC.getBalance(0));

        // ChanceCard 15
        playerC.setPosition(3, 0);
        playerC.setBalance(16, 0);
        int[] chance15 = {16};
        chance.setChanceCards(chance15);
        chance.landedOnStreet(playerC, 0);
        assertEquals(18, playerC.getBalance(0));

        // ChanceCard 17
        playerC.setPosition(3, 0);
        int[] chance17 = {18};
        chance.setChanceCards(chance17);
        chance.landedOnStreet(playerC, 0);
        assertEquals(10, playerC.getPosition(0));
    }
}