Ejemplo n.º 1
0
        public void MarkDead(Stone stone)
        {
            EnsureMarkup();
            Markup.EnsureDeadStones();

            Markup.DeadStones[stone.X, stone.Y] = true;

            stone.IsBlack = board.Black[stone.X, stone.Y];

            var newStone = stone.LeftStone();

            if (board.HasStone(newStone) && !Markup.DeadStones[newStone.X, newStone.Y])
            {
                MarkDead(newStone);
            }
            newStone = stone.TopStone();
            if (board.HasStone(newStone) && !Markup.DeadStones[newStone.X, newStone.Y])
            {
                MarkDead(newStone);
            }
            newStone = stone.RightStone();
            if (board.HasStone(newStone) && !Markup.DeadStones[newStone.X, newStone.Y])
            {
                MarkDead(newStone);
            }
            newStone = stone.BottomStone();
            if (board.HasStone(newStone) && !Markup.DeadStones[newStone.X, newStone.Y])
            {
                MarkDead(newStone);
            }
        }
Ejemplo n.º 2
0
        public void KillGroup(Stone stone)
        {
            if (GroupIsDead(stone.TopStone().OtherColorStone()))
            {
                RemoveGroup(stone.TopStone().OtherColorStone());
            }

            if (GroupIsDead(stone.LeftStone().OtherColorStone()))
            {
                RemoveGroup(stone.LeftStone().OtherColorStone());
            }

            if (GroupIsDead(stone.BottomStone().OtherColorStone()))
            {
                RemoveGroup(stone.BottomStone().OtherColorStone());
            }

            if (GroupIsDead(stone.RightStone().OtherColorStone()))
            {
                RemoveGroup(stone.RightStone().OtherColorStone());
            }
        }