Exemplo n.º 1
0
        public bool IsProtectedLiberty(int point)
        {
            // protected liberites are liberties that should not be played by the opponent
            // because of suicide or being directly capturable

            return(Board.IsProtectedLiberty(point, Defender));
        }
Exemplo n.º 2
0
        public static bool FindMovesInProtectedAreas(GoBoard goBoard, Color currentPlayer, int currentMove, Color nextPlayer, int nextMove)
        {
            if (nextPlayer == Color.Empty)
            {
                return(false);
            }

            if ((nextMove == CoordinateSystem.PASS) || (nextMove == CoordinateSystem.RESIGN))
            {
                return(false);
            }

            return(goBoard.IsProtectedLiberty(nextMove, nextPlayer));
        }
Exemplo n.º 3
0
        // marked to be depreciated
        private List <int> _GetProtectedLiberites(Color color)
        {
            List <int> lProtected = new List <int>();

            for (int lIndex = 0; lIndex < Board.Coord.BoardArea; lIndex++)
            {
                if (Board.IsProtectedLiberty(lIndex, color))
                {
                    lProtected.Add(lIndex);
                }
            }

            return(lProtected);
        }
        public static List <int> GetProtectedLiberites(GoBoard goBoard, Color color)
        {
            List <int> lProtected = new List <int>();

            for (int lIndex = 0; lIndex < goBoard.Coord.BoardArea; lIndex++)
            {
                if (goBoard.IsProtectedLiberty(lIndex, color))
                {
                    lProtected.Add(lIndex);
                }
            }

            return(lProtected);
        }
        public static List <int> GetNeighborsOfProtectedLiberites(GoBoard goBoard, Color color)
        {
            List <int> lNeighbors = new List <int>();

            for (int lPoint = 0; lPoint < goBoard.Coord.BoardArea; lPoint++)
            {
                if (goBoard.IsProtectedLiberty(lPoint, color))
                {
                    foreach (int lNeighbor in goBoard.Coord.GetNeighbors(lPoint))
                    {
                        if (!lNeighbors.Contains(lNeighbor))
                        {
                            lNeighbors.Add(lNeighbor);
                        }
                    }
                }
            }

            return(lNeighbors);
        }
Exemplo n.º 6
0
        public static List<int> GetProtectedLiberites(GoBoard goBoard, Color color)
        {
            List<int> lProtected = new List<int>();

            for (int lIndex = 0; lIndex < goBoard.Coord.BoardArea; lIndex++)
                if (goBoard.IsProtectedLiberty(lIndex, color))
                    lProtected.Add(lIndex);

            return lProtected;
        }
Exemplo n.º 7
0
        public static List<int> GetNeighborsOfProtectedLiberites(GoBoard goBoard, Color color)
        {
            List<int> lNeighbors = new List<int>();

            for (int lPoint = 0; lPoint < goBoard.Coord.BoardArea; lPoint++)
                if (goBoard.IsProtectedLiberty(lPoint, color))
                    foreach (int lNeighbor in goBoard.Coord.GetNeighbors(lPoint))
                        if (!lNeighbors.Contains(lNeighbor))
                            lNeighbors.Add(lNeighbor);

            return lNeighbors;
        }
Exemplo n.º 8
0
        public static bool FindMovesInProtectedAreas(GoBoard goBoard, Color currentPlayer, int currentMove, Color nextPlayer, int nextMove)
        {
            if (nextPlayer == Color.Empty)
                return false;

            if ((nextMove == CoordinateSystem.PASS) || (nextMove == CoordinateSystem.RESIGN))
                return false;

            return (goBoard.IsProtectedLiberty(nextMove, nextPlayer));
        }