Example #1
0
  /**
   * When the game first starts, this method initializes all new Houses
   *
   * @param suit the CardSuit of the House
   * @return the House that was created
   * @param withJokerRule <code>true</code> for the Joker Rule to be added, otherwise <code>false
   *     </code>
   * @param withNumCardRule <code>true</code> for the NumCard Rule to be added, otherwise <code>
   *     false</code>
   */
  private House createNewHouse(CardSuit suit, boolean withJokerRule, boolean withNumCardRule) {
    House house = new House(suit);
    house.addHouseListener(this);

    /*
     * Add all PermissionRules
     */
    house.addPermissionRule((new ClosedHouseRule()));

    /*
     * Add all ActionRules
     */
    if (withJokerRule) house.addActionRule(new JokerRule());
    if (withNumCardRule)
      house.addActionRule(new NumCardRule(NUM_CARDS_THRESHOLD_RULE, NUM_POINTS_THRESHOLD_RULE));
    house.addActionRule(new ScoreRule(NUM_POINTS_THRESHOLD_RULE));

    return house;
  }