Class Game


public class Game extends Object
  • Constructor Details

    • Game

      public Game()
  • Method Details

    • main

      public static void main(String[] args) throws InterruptedException
      Throws:
      InterruptedException
    • checkDice

      public boolean checkDice(int dice, Player p, int countRolls)
      Check if the Player is allowed to roll the dice again
      Parameters:
      dice - Value of dice got from rolldice()
      p - active Player
      countRolls - Counter how often the Player already rolled the dice
      Returns:
      true if Player can roll the dice another time
    • checkFieldClear

      public int checkFieldClear(int posToCheck, Player p, Game g)
      Check if a target field is free or occupied by another figure
      Parameters:
      posToCheck - Target position to check
      p - active Player
      g - game instance
      Returns:
      2 - own Player 1 - another Player 0 - Field clear
    • getUsableFigures

      public ArrayList<Integer> getUsableFigures(int dice, Player p, Game g)
      Get List of all usable Figures in the current Play for one Player
      Parameters:
      dice - Value of dice got from rolldice()
      p - active Player
      g - game instance
      Returns:
      List of int with figIds the Player can choose from
    • figureIsUsable

      public boolean figureIsUsable(int dice, int figId, Player p, Game g)
      Check if a figure is usable
      Parameters:
      dice - Value of dice got from rolldice()
      figId - id of figure to check
      p - active Player
      g - game instance
      Returns:
      true if figure is usable
    • setFigure

      public int setFigure(int figId, int dice, Player p, Game g)
      Set a figure on a field according
      Parameters:
      figId - id of figure to check
      dice - Value of dice got from rolldice()
      p - active Player
      g - game instance
      Returns:
      0 if no figure kicked. 1 if another figure was kicked