Beispiel #1
0
        internal void locatePieceOnTable(GameTable i_GameTable)
        {
            int rowOfLocatePiece    = 0;
            int columnOfLocatePiece = 0;

            if (m_CurrentPiece.Row > m_TargetPiece.Row)
            {
                rowOfLocatePiece = m_CurrentPiece.Row - 1;

                if (m_CurrentPiece.Column > m_TargetPiece.Column)
                {
                    columnOfLocatePiece = m_CurrentPiece.Column - 1;
                }
                else
                {
                    columnOfLocatePiece = m_CurrentPiece.Column + 1;
                }
            }
            else
            {
                rowOfLocatePiece = m_CurrentPiece.Row + 1;

                if (m_CurrentPiece.Column > m_TargetPiece.Column)
                {
                    columnOfLocatePiece = m_CurrentPiece.Column - 1;
                }
                else
                {
                    columnOfLocatePiece = m_CurrentPiece.Column + 1;
                }
            }

            i_GameTable.GetSolider(rowOfLocatePiece, columnOfLocatePiece).Type = Piece.eSoliderType.Empty;
        }
Beispiel #2
0
 public GameManager(string i_Player1, string i_Player2, short i_TableSize)
 {
     r_GameStatus  = new GameStatus(GameStatus.eGameStatus.StillPlaying);
     v_TurnPlayer1 = true;
     r_Player1     = new Player(Player.eShapeType.X, i_Player1, Player.ePlayerType.Person);
     if (i_Player2.Equals("Computer"))
     {
         r_Player2 = new Player(Player.eShapeType.O, "Computer", Player.ePlayerType.Computer);
     }
     else
     {
         r_Player2 = new Player(Player.eShapeType.O, i_Player2, Player.ePlayerType.Person);
     }
     r_TableSize = i_TableSize;
     r_GameTable = new GameTable(r_TableSize);
     r_GameTable.BuildTable();
     m_LegalJumps = new List <Move>();
 }
Beispiel #3
0
        internal void MoveOnTable(GameTable i_GameTable)
        {
            switch (this.MoveType)
            {
            case (eMoveType.Diagonal):

                if (m_CurrentPiece.Type == Piece.eSoliderType.X && m_TargetPiece.Row == 0)
                {
                    m_TargetPiece.Type = Piece.eSoliderType.K;
                }

                else
                if (m_CurrentPiece.Type == Piece.eSoliderType.O && m_TargetPiece.Row == i_GameTable.TableSize - 1)
                {
                    m_TargetPiece.Type = Piece.eSoliderType.U;
                }
                else
                {
                    m_TargetPiece.Type = m_CurrentPiece.Type;
                }
                m_CurrentPiece.Type = Piece.eSoliderType.Empty;
                break;

            case (eMoveType.Jump):
                locatePieceOnTable(i_GameTable);
                if (m_CurrentPiece.Type == Piece.eSoliderType.X && m_TargetPiece.Row == 0)
                {
                    m_TargetPiece.Type = Piece.eSoliderType.K;
                }
                else
                {
                    if (m_CurrentPiece.Type == Piece.eSoliderType.O && m_TargetPiece.Row == i_GameTable.TableSize - 1)
                    {
                        m_TargetPiece.Type = Piece.eSoliderType.U;
                    }
                    else
                    {
                        m_TargetPiece.Type = m_CurrentPiece.Type;
                    }
                }
                m_CurrentPiece.Type = Piece.eSoliderType.Empty;
                break;
            }
        }