Package it.polimi.ingsw.eriantys.model
Class SchoolBoard
java.lang.Object
it.polimi.ingsw.eriantys.model.SchoolBoard
This class models a
Player
's school board: it contains an entrance and a dining room
(both StudentContainer
s) and an integer representing the number of towers it contains.
It exposes methods to get and put towers from and into the board and
a method to check if the Player
who owns the board should receive a coin based on the students it contains.-
Constructor Summary
ConstructorDescriptionSchoolBoard
(int entranceSize, int towerNumber) Constructs aSchoolBoard
initially containing the maximum number of towers, with an emptyentrance
of maximum size according to the game rules and an emptydiningRoom
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkForCoins
(Color color) Returnstrue
if and only if thePlayer
who owns thisSchoolBoard
is entitled to receive a coin based on the number of students of colorcolor
theirDiningRoom
contains.boolean
If thisSchoolBoard
has at least one tower prior to this method's invocation, decreases the number of towers by 1 and returnstrue
, otherwise returnsfalse
.A getter for the object's dining room.A getter for the object's entrance.int
A helper-getter method to fulfill theBoardStatus
creation process.boolean
If thisSchoolBoard
has less than the maximum number of towers prior to this method's invocation, increases the number of towers by 1 and returnstrue
, otherwise returnsfalse
.
-
Constructor Details
-
SchoolBoard
public SchoolBoard(int entranceSize, int towerNumber) Constructs aSchoolBoard
initially containing the maximum number of towers, with an emptyentrance
of maximum size according to the game rules and an emptydiningRoom
.- Parameters:
entranceSize
- the maximum number of students which the entrance can holdtowerNumber
- the maximum number of towers which the schoolboard can hold
-
-
Method Details
-
getEntrance
A getter for the object's entrance.- Returns:
- this
SchoolBoard
's entrance
-
getDiningRoom
A getter for the object's dining room.- Returns:
- this
SchoolBoard
's dining room
-
checkForCoins
Returnstrue
if and only if thePlayer
who owns thisSchoolBoard
is entitled to receive a coin based on the number of students of colorcolor
theirDiningRoom
contains.- Parameters:
color
- theColor
whose amount of students is checked- Returns:
true
if and only if thePlayer
who owns thisDiningRoom
is entitled to receive a coin based on the number of students of colorcolor
theirDiningRoom
contains
-
deployTower
public boolean deployTower()If thisSchoolBoard
has at least one tower prior to this method's invocation, decreases the number of towers by 1 and returnstrue
, otherwise returnsfalse
.- Returns:
true
if and only if thisSchoolBoard
can deploy an additional tower
-
returnTower
public boolean returnTower()If thisSchoolBoard
has less than the maximum number of towers prior to this method's invocation, increases the number of towers by 1 and returnstrue
, otherwise returnsfalse
.- Returns:
true
if and only if thisSchoolBoard
can contain an additional tower
-
getTowerQuantity
public int getTowerQuantity()A helper-getter method to fulfill theBoardStatus
creation process.- Returns:
- a representation for the number of towers owned by the
Player
-