Esempio n. 1
0
        private int MakeStatusStone(int x, int y, ref Dictionary <int, int[]> group, ref bool bOpen)
        {
            int enemyId = (int)RulesBase[x, y];

            group[(x + y) * (x + y + 1) / 2 + y] = new[] { x, y };
            StoneWayInfo[] waysInfo = RulesBase.IsSurrounded(x, y, enemyId, new[] { -1, -2 });
            foreach (StoneWayInfo info in waysInfo)
            {
                switch (info.WayTypeType)
                {
                case WayType.Open:
                    bOpen = true;
                    break;

                case WayType.Friend:
                    int hash = (info.X + info.Y) * (info.X + info.Y + 1) / 2 + info.Y;
                    if (!group.ContainsKey(hash))
                    {
                        MakeStatusStone(info.X, info.Y, ref group, ref bOpen);
                    }
                    break;
                }
            }
            return(enemyId);
        }
Esempio n. 2
0
        public override bool MakeStep(int x, int y)
        {
            bool bAnswer = RulesBase.Check(Id, x, y);

            if (bAnswer)
            {
                OccupyEnemy();
                ClearField();
                PassesCount = 0;
                RulesBase.NextStep();
            }
            return(bAnswer);
        }
Esempio n. 3
0
 protected PersonBase(int id, bool isBot, RulesBase rulesBase)
 {
     Id        = id;
     IsBot     = isBot;
     RulesBase = rulesBase;
 }
Esempio n. 4
0
 public Player(RulesBase rulesBase, int id) : base(id, false, rulesBase)
 {
     RulesBase.AddPlayer(this);
 }
Esempio n. 5
0
 public Player(RulesBase rulesBase) : base(1, false, rulesBase)
 {
     RulesBase.AddPlayer(this);
 }
Esempio n. 6
0
 public void Pass( )
 {
     PassesCount = 1;
     RulesBase.NextStep();
 }