Ejemplo n.º 1
0
        private string SymbolOfButton(eTypeSign i_TypeSign)
        {
            string result = null;

            switch (i_TypeSign)
            {
            case eTypeSign.EMPTY:
                result = string.Empty;
                break;

            case eTypeSign.U:
                result = eTypeSign.U.ToString();
                break;

            case eTypeSign.O:
                result = eTypeSign.O.ToString();
                break;

            case eTypeSign.K:
                result = eTypeSign.K.ToString();
                break;

            case eTypeSign.X:
                result = eTypeSign.X.ToString();
                break;

            default: break;
            }

            return(result);
        }
Ejemplo n.º 2
0
 public User(string i_Name, eUserType i_UserType, int i_Score, eTypeSign i_SoldierSign, eTypeSign i_KingSign, bool i_TurnFlag)
 {
     this.m_Name        = i_Name;
     this.m_Score       = i_Score;
     this.m_UserType    = i_UserType;
     this.m_SoldierSign = i_SoldierSign;
     this.m_KingSign    = i_KingSign;
     this.m_TurnFlag    = i_TurnFlag;
 }
Ejemplo n.º 3
0
        private List <Move> UserMovesCollection(User i_User)
        {
            eTypeSign   UserSoldierSign    = i_User.SoldierSign;
            eTypeSign   UserKingSign       = i_User.KingSign;
            List <Move> UserMoveCollection = new List <Move>();

            UserMoveCollection = EatMovesCollection(i_User);
            bool playerCanMakeAJump = UserMoveCollection.Count > 0;

            if (!playerCanMakeAJump)
            {
                UserMoveCollection = UserOnlyMoveCollection(i_User);
            }

            if (UserMoveCollection.Count == 0)
            {
                UserMoveCollection = null;
            }

            return(UserMoveCollection);
        }
Ejemplo n.º 4
0
        private List <Move> EatMovesCollection(User i_User)
        {
            eTypeSign   UserSoldierSign       = i_User.SoldierSign;
            eTypeSign   UserKingSign          = i_User.KingSign;
            List <Move> UserEatMoveCollection = new List <Move>();


            for (int i = 0; i < r_BoardSize; i++)
            {
                for (int j = 0; j < r_BoardSize; j++)
                {
                    if (m_Board[i, j] == i_User.SoldierSign || m_Board[i, j] == i_User.KingSign)
                    {
                        if (CanEatMove(i_User, i, j, i + 1, j + 1, i + 2, j + 2))
                        {
                            UserEatMoveCollection.Add(new Move(i, j, i + 2, j + 2));
                        }

                        if (CanEatMove(i_User, i, j, i + 1, j - 1, i + 2, j - 2))
                        {
                            UserEatMoveCollection.Add(new Move(i, j, i + 2, j - 2));
                        }

                        if (CanEatMove(i_User, i, j, i - 1, j - 1, i - 2, j - 2))
                        {
                            UserEatMoveCollection.Add(new Move(i, j, i - 2, j - 2));
                        }

                        if (CanEatMove(i_User, i, j, i - 1, j + 1, i - 2, j + 2))
                        {
                            UserEatMoveCollection.Add(new Move(i, j, i - 2, j + 2));
                        }
                    }
                }
            }

            return(UserEatMoveCollection);
        }
Ejemplo n.º 5
0
        private List <Move> UserOnlyMoveCollection(User i_User)
        {
            eTypeSign   UserSoldierSign        = i_User.SoldierSign;
            eTypeSign   UserKingSign           = i_User.KingSign;
            List <Move> UserOnlyMoveCollection = new List <Move>();

            for (int i = 0; i < r_BoardSize; i++)
            {
                for (int j = 0; j < r_BoardSize; j++)
                {
                    if (m_Board[i, j] == UserSoldierSign || m_Board[i, j] == UserKingSign)
                    {
                        if (CheckingLegalMovment(i_User, i, j, i + 1, j - 1))
                        {
                            UserOnlyMoveCollection.Add(new Move(i, j, i + 1, j - 1));
                        }

                        if (CheckingLegalMovment(i_User, i, j, i - 1, j - 1))
                        {
                            UserOnlyMoveCollection.Add(new Move(i, j, i - 1, j - 1));
                        }

                        if (CheckingLegalMovment(i_User, i, j, i + 1, j + 1))
                        {
                            UserOnlyMoveCollection.Add(new Move(i, j, i + 1, j + 1));
                        }

                        if (CheckingLegalMovment(i_User, i, j, i - 1, j + 1))
                        {
                            UserOnlyMoveCollection.Add(new Move(i, j, i - 1, j + 1));
                        }
                    }
                }
            }

            return(UserOnlyMoveCollection);
        }