Package net.royalur

Class GameBuilder

java.lang.Object
net.royalur.GameBuilder

public class GameBuilder extends Object
A builder to help in the creation of custom games of the Royal Game of Ur.
  • Constructor Details

    • GameBuilder

      public GameBuilder(GameSettings settings, RuleSetProvider ruleSetProvider)
      Instantiates a new game builder.
      Parameters:
      settings - The settings of the game being built.
      ruleSetProvider - The provider to use to construct the final rule set.
  • Method Details

    • getSettings

      public GameSettings getSettings()
      Get the settings of the game being built.
      Returns:
      The settings of the game being built.
    • getRuleSetProvider

      public RuleSetProvider getRuleSetProvider()
      Gets the provider to use to construct the final rule set.
      Returns:
      The provider to use to construct the final rule set.
    • replaceSettings

      public GameBuilder replaceSettings(GameSettings settings)
      Create a copy of this game builder with new settings.
      Parameters:
      settings - The new settings.
      Returns:
      A copy of this game builder with new settings.
    • finkel

      public GameBuilder finkel()
      Creates a new builder that allows the construction of games following the simple rules proposed by Irving Finkel.
      Returns:
      A new builder that allows the construction of games following the rules proposed by Irving Finkel.
    • masters

      public GameBuilder masters()
      Creates a new builder that allows the construction of games following the rules proposed by James Masters.
      Returns:
      A new builder that allows the construction of games following the rules proposed James Masters.
    • aseb

      public GameBuilder aseb()
      Creates a new builder that allows the construction of games following the Aseb rules.
      Returns:
      A new builder that allows the construction of games following the Aseb rules.
    • boardShape

      public GameBuilder boardShape(BoardType boardType)
      Copies this game builder with the shape of the board set to boardType.
      Parameters:
      boardType - The type of board shape to use for generated games.
      Returns:
      A copy of this game builder with the shape of the board set to boardType.
    • boardShape

      public GameBuilder boardShape(BoardShape boardShape)
      Copies this game builder with the shape of the board set to boardShape.
      Parameters:
      boardShape - The shape of the board to use for generated games.
      Returns:
      A copy of this game builder with the shape of the board set to boardShape.
    • paths

      public GameBuilder paths(PathType pathType)
      Copies this game builder with the paths taken by each player set to pathType.
      Parameters:
      pathType - The type of paths to be taken by each player.
      Returns:
      A copy of this game builder with the paths taken by each player set to pathType.
    • paths

      public GameBuilder paths(PathPair paths)
      Copies this game builder with the paths taken by each player set to paths.
      Parameters:
      paths - The paths to be taken by each player.
      Returns:
      A copy of this game builder with the paths taken by each player set to paths.
    • dice

      public GameBuilder dice(DiceFactory diceFactory)
      Copies this game builder with the factory used to generate dice for games set to diceFactory.
      Parameters:
      diceFactory - The factory to use to generate dice for games.
      Returns:
      A copy of this game builder with factory used to generate dice for games set to diceFactory.
    • startingPieceCount

      public GameBuilder startingPieceCount(int startingPieceCount)
      Copies this game builder with the number of starting pieces of each player set to startingPieceCount.
      Parameters:
      startingPieceCount - The number of pieces that each player starts with in the game.
      Returns:
      A copy of this game builder with the number of starting pieces of each player set to startingPieceCount.
    • safeRosettes

      public GameBuilder safeRosettes(boolean safeRosettes)
      Copies this game builder with whether rosettes are safe from capture set to safeRosettes.
      Parameters:
      safeRosettes - Whether rosette tiles are safe squares for pieces.
      Returns:
      A copy of this game builder with safe rosettes if safeRosettes is true, or else with unsafe rosettes.
    • rosettesGrantExtraRolls

      public GameBuilder rosettesGrantExtraRolls(boolean rosettesGrantExtraRolls)
      Copies this game builder with rosettes granting extra dice rolls if rosettesGrantExtraRolls is true.
      Parameters:
      rosettesGrantExtraRolls - Whether landing on a rosette grants an extra roll.
      Returns:
      A copy of this game builder with rosettes granting extra dice rolls set to rosettesGrantExtraRolls.
    • capturesGrantExtraRolls

      public GameBuilder capturesGrantExtraRolls(boolean capturesGrantExtraRolls)
      Copies this game builder with capturing pieces granting extra dice rolls if capturesGrantExtraRolls is true.
      Parameters:
      capturesGrantExtraRolls - Whether capturing a piece grants an extra roll.
      Returns:
      A copy of this game builder with capturing pieces granting extra dice rolls set to capturesGrantExtraRolls.
    • buildRules

      public RuleSet buildRules()
      Generates a rule set to match the settings in this builder.
      Returns:
      A rule set to match the settings in this builder.
    • build

      public Game build()
      Generates a new game using the rules set in this builder.
      Returns:
      A new game using the rules set in this builder.