Exemple #1
0
        internal Piece ChangeValues(AvailableObject i_AvailableObject, ref BoardMatrix io_BoardMatrixObject, ref Piece[] io_Matrix)
        {
            char sign = io_BoardMatrixObject.IsKingOrMen(i_AvailableObject, ref io_Matrix);

            if (io_BoardMatrixObject.GotToTheEnd(i_AvailableObject))
            {
                MensPieces[i_AvailableObject.GetIndexInMensPlaces()].IsKing = true;
                io_Matrix[MensPieces[i_AvailableObject.GetIndexInMensPlaces()].IndexInMatrix].IsKing = true;
            }

            MensPieces[i_AvailableObject.GetIndexInMensPlaces()].IndexInMatrix = i_AvailableObject.indexMoveTo;
            MensPieces[i_AvailableObject.GetIndexInMensPlaces()].Sign          = sign;

            return(MensPieces[i_AvailableObject.GetIndexInMensPlaces()]);
        }
        public bool GotToTheEnd(AvailableObject i_AvailableObject) //check if men got to the end to become a king
        {
            bool checkifKing;

            if ((i_AvailableObject.GetSign() == 'X' && i_AvailableObject.indexMoveTo < m_SizeOfBoard / 2) || (i_AvailableObject.GetSign() == 'O' && i_AvailableObject.indexMoveTo >= m_SizeOfBoard * m_SizeOfBoard / 2 - m_SizeOfBoard / 2))
            {
                checkifKing = true;
            }
            else
            {
                checkifKing = false;
            }

            return(checkifKing);
        }
        public char IsKingOrMen(AvailableObject i_AvailableObject, ref Piece[] io_Matrix)
        {
            char sign;

            if (GotToTheEnd(i_AvailableObject))
            {
                sign = i_AvailableObject.GetKingSignOfPiece();
            }
            else
            {
                sign = io_Matrix[i_AvailableObject.GetIndexInMatrix()].Sign;
            }

            return(sign);
        }
Exemple #4
0
 internal void UpdateMenPieces(AvailableObject i_AvailableObject)
 {
     MensPieces[i_AvailableObject.GetIndexInMatrix()].IndexInMatrix = i_AvailableObject.indexMoveTo;
 }