Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package connect4.model;
- /**
- * This is the class Player. Here you can get the information if the player is a
- * machine or a human and other properties of the players of the game.
- */
- public class Player {
- /**
- * Number of the groups of 2 tokens.
- */
- private int groupsOfTwo;
- /**
- * Number of the groups of 3 tokens.
- */
- private int groupsOfThree;
- /**
- * Number of the goups of 4 tokens.
- */
- private int groupsOfFour;
- /**
- * Quality of the player if it's a machine or human player.
- */
- boolean isHuman = true;
- /**
- * Used sign of the player.('X' if human player and 'O' if machine.)
- */
- private String usedSign = "";
- /**
- * Constructor of the class Player.
- *
- * @param playerIsHuman
- * true if player is human and false if player is machine.
- */
- public Player(boolean playerIsHuman) {
- isHuman = playerIsHuman;
- if (isHuman) {
- usedSign = "X";
- } else {
- usedSign = "O";
- }
- groupsOfTwo = 0;
- groupsOfThree = 0;
- groupsOfFour = 0;
- }
- /**
- * Method to get quality isHuman of the player.
- *
- * @return isHuman true if player is human and false if machine.
- */
- public boolean getIsHuman() {
- return isHuman;
- }
- /**
- * Method to get used sign of the player.
- *
- * @return usedSign 'X' if it's an human player and 'O' if it's a machine.
- */
- public String getSign() {
- return usedSign;
- }
- /**
- * Method to change player..
- *
- * @param playerIsHuman
- * true if it is an human player and false if it's a machine.
- */
- public void changePlayer(boolean playerIsHuman) {
- isHuman = playerIsHuman;
- }
- /**
- * Method to count groups of 2 tokens.
- *
- * @param i
- * number of groups of 2 tokens.
- */
- public void setGroupOfTwoCounter(int i) {
- groupsOfTwo = i;
- }
- /**
- * Method to count groups of 3 tokens.
- *
- * @param i
- * number of groups of 3 tokens.
- */
- public void setGroupOfThreeCounter(int i) {
- groupsOfThree = i;
- }
- /**
- * Method to count groups of 4 tokens.
- *
- * @param i
- * number of groups of 4 tokens.
- */
- public void setGroupOfFourCounter(int i) {
- groupsOfFour = i;
- }
- /**
- * Method to get number of groups of 4 tokens.
- *
- * @return number of groups of 4 tokens.
- */
- public int getGroupOfFourCounter() {
- return groupsOfFour;
- }
- /**
- * Method to get number of groups of 3 tokens.
- *
- * @return number of groups of 3 tokens.
- */
- public int getGroupOfThreeCounter() {
- return groupsOfThree;
- }
- /**
- * Method to get number of groups of 2 tokens.
- *
- * @return number of groups of 2 tokens.
- */
- public int getGroupOfTwoCounter() {
- return groupsOfTwo;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement