Exemple #1
0
 public GameInfo(PlayerInfo whitePlayerInfo, PlayerInfo blackPlayerInfo, GameBoardSize boardSize, RulesetType rulesetType, int numberOfHandicapStones, HandicapPlacementType handicapPlacementType, float komi, CountingType countingType)
 {
     White                  = whitePlayerInfo;
     Black                  = blackPlayerInfo;
     BoardSize              = boardSize;
     RulesetType            = rulesetType;
     NumberOfHandicapStones = numberOfHandicapStones;
     HandicapPlacementType  = handicapPlacementType;
     Komi         = komi;
     CountingType = countingType;
 }
 public IgsGameInfo(
     PlayerInfo whitePlayerInfo,
     PlayerInfo blackPlayerInfo,
     GameBoardSize boardSize,
     RulesetType rulesetType,
     int numberOfHandicapStones,
     HandicapPlacementType handicapPlacementType,
     float komi,
     CountingType countingType,
     int igsIndex,
     int numberOfObservers) :
     base(
         whitePlayerInfo,
         blackPlayerInfo,
         boardSize,
         rulesetType,
         numberOfHandicapStones,
         handicapPlacementType,
         komi,
         countingType)
 {
     NumberOfObservers = numberOfObservers;
     IgsIndex          = igsIndex;
 }
Exemple #3
0
 protected RemoteGameInfo(PlayerInfo whitePlayerInfo, PlayerInfo blackPlayerInfo, GameBoardSize boardSize, RulesetType rulesetType, int numberOfHandicapStones, HandicapPlacementType handicapPlacementType, float komi, CountingType countingType) : base(whitePlayerInfo, blackPlayerInfo, boardSize, rulesetType, numberOfHandicapStones, handicapPlacementType, komi, countingType)
 {
 }
 public CountingEventArgs(string ColumnName, CountingType CountingType)
 {
     this._ColumnName   = ColumnName;
     this._CountingType = CountingType;
 }
Exemple #5
0
 public KgsGameInfo(PlayerInfo whitePlayerInfo, PlayerInfo blackPlayerInfo, GameBoardSize boardSize, RulesetType rulesetType, int numberOfHandicapStones, HandicapPlacementType handicapPlacementType, float komi, CountingType countingType, int channelId) : base(whitePlayerInfo, blackPlayerInfo, boardSize, rulesetType, numberOfHandicapStones, handicapPlacementType, komi, countingType)
 {
     this.ChannelId = channelId;
 }
Exemple #6
0
        /// <summary>
        /// Calculates the default compensation (komi).
        /// </summary>
        /// <param name="gbSize">Game board size</param>
        /// <param name="handicapStoneCount">Handicap stone count</param>
        /// <param name="cType">Counting type</param>
        /// <returns>Komi compensation.</returns>
        public static float GetAGACompensation(GameBoardSize gbSize, int handicapStoneCount, CountingType cType)
        {
            float compensation = 0;

            if (handicapStoneCount == 0)
            {
                compensation = 7.5f;
            }
            else if (handicapStoneCount > 0 && cType == CountingType.Area)
            {
                compensation = 0.5f + handicapStoneCount - 1;
            }
            else if (handicapStoneCount > 0 && cType == CountingType.Territory)
            {
                compensation = 0.5f;
            }
            return(compensation);
        }
Exemple #7
0
 /// <summary>
 /// Initializes the ruleset. For each game, a new ruleset must be created.
 /// </summary>
 /// <param name="gbSize">Size of the game board.</param>
 /// <param name="countingType">Chosen couting type.</param>
 public AGARuleset(GameBoardSize gbSize, CountingType countingType) : base(gbSize)
 {
     _countingType = countingType;
 }
Exemple #8
0
 public void SetUp()
 {
     _ctx = new FluentApplicationContext();
     CountingType.ClearCounter();
     OtherCountingType.ClearCounter();
 }
Exemple #9
0
        /// <summary>
        /// Calculates the default compensation (komi).
        /// </summary>
        /// <param name="rsType">Type of the ruleset</param>
        /// <param name="gbSize">Game board size</param>
        /// <param name="handicapStoneCount">Handicap stone count</param>
        /// <param name="cType">Counting type</param>
        /// <returns></returns>
        public static float GetDefaultCompensation(RulesetType rsType, GameBoardSize gbSize, int handicapStoneCount, CountingType cType)
        {
            if (rsType == RulesetType.AGA)
            {
                return(AGARuleset.GetAGACompensation(gbSize, handicapStoneCount, cType));
            }
            if (rsType == RulesetType.Chinese)
            {
                return(ChineseRuleset.GetChineseCompensation(gbSize, handicapStoneCount));
            }
            if (rsType == RulesetType.Japanese)
            {
                return(JapaneseRuleset.GetJapaneseCompensation(gbSize, handicapStoneCount));
            }

            return(0);
        }
Exemple #10
0
        /// <summary>
        /// Factory method that creates a ruleset of given type and gameboard size
        /// </summary>
        /// <param name="ruleset">Ruleset</param>
        /// <param name="gameBoardSize">Gameboard size</param>
        /// <param name="countingType">Counting type (AGA)</param>
        /// <returns>Ruleset</returns>
        public static IRuleset Create(RulesetType ruleset, GameBoardSize gameBoardSize, CountingType countingType = CountingType.Area)
        {
            switch (ruleset)
            {
            case RulesetType.Chinese:
            {
                return(new ChineseRuleset(gameBoardSize));
            }

            case RulesetType.Japanese:
            {
                return(new JapaneseRuleset(gameBoardSize));
            }

            case RulesetType.AGA:
            {
                return(new AGARuleset(gameBoardSize, countingType));
            }

            default:
                throw new ArgumentOutOfRangeException(nameof(ruleset));
            }
        }
 public TBuilderType CountingType(CountingType countingType)
 {
     _countingType = countingType;
     return(_concreteBuilderInstance);
 }