예제 #1
0
        private void clickForEndMove()
        {
            try
            {
                r_GameMover.MakeAMove(m_Board, m_StartPoint, m_EndPoint, m_PlayerTurn);

                if (r_GameMover.CanEatAgain)
                {
                    m_CurrentMove = eClickTypeMove.Combo;
                    m_StartPoint  = m_EndPoint;
                    damkaSquereButtonMatrix[m_StartPoint.GetX(), m_StartPoint.GetY()].BackColor = Color.Blue;
                }
                else
                {
                    swapTurn();
                    checkGameOver();
                    checkIfPCTurn();
                    m_CurrentMove = eClickTypeMove.Start;
                }

                updateGameDetails();
                checkGameOver();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        private void checkCaptureOptionsOfaGivenPawn(GameBoard i_Matrix, Point i_Start, char i_PlayerColor, ref List <Point> o_ResDestanation)// returns start,end,start,end..
        {
            Square checkSquare1 = null;
            Square checkSquare2 = null;
            int    x            = i_Start.GetX();
            int    y            = i_Start.GetY();
            int    matrixSize   = i_Matrix.GetSize;

            checkSquare1 = i_Matrix.GetSquare(x, y);
            if (checkSquare1.GetChecker() != null)
            {
                if ((i_PlayerColor == (char)eCheckerGame.WhitePlayer) || (checkSquare1.GetChecker().IsKing))
                {
                    if ((x + 2 < matrixSize) && (y - 2 >= 0))
                    {
                        checkSquare1 = i_Matrix.GetSquare(x + 1, y - 1);
                        checkSquare2 = i_Matrix.GetSquare(x + 2, y - 2);
                        if (checkSquare1.GetChecker() != null && checkSquare2.GetChecker() == null && (checkSquare1.GetChecker().Color != i_PlayerColor))
                        {
                            o_ResDestanation.Add(new Point(x, y));
                            o_ResDestanation.Add(new Point(x + 2, y - 2));
                        }
                    }

                    if ((x + 2 < matrixSize) && (y + 2 < matrixSize))
                    {
                        checkSquare1 = i_Matrix.GetSquare(x + 1, y + 1);
                        checkSquare2 = i_Matrix.GetSquare(x + 2, y + 2);

                        if (checkSquare1.GetChecker() != null && checkSquare2.GetChecker() == null && (checkSquare1.GetChecker().Color != i_PlayerColor))
                        {
                            o_ResDestanation.Add(new Point(x, y));
                            o_ResDestanation.Add(new Point(x + 2, y + 2));
                        }
                    }
                }

                checkSquare1 = i_Matrix.GetSquare(x, y);

                if ((i_PlayerColor == (char)eCheckerGame.BlackPlayer) || (checkSquare1.GetChecker().IsKing))
                {
                    if ((y + 2 < matrixSize) && (x - 2 >= 0))
                    {
                        checkSquare1 = i_Matrix.GetSquare(x - 1, y + 1);
                        checkSquare2 = i_Matrix.GetSquare(x - 2, y + 2);
                        if (checkSquare1.GetChecker() != null && checkSquare2.GetChecker() == null && (checkSquare1.GetChecker().Color != i_PlayerColor))
                        {
                            o_ResDestanation.Add(new Point(x, y));
                            o_ResDestanation.Add(new Point(x - 2, y + 2));
                        }
                    }

                    if ((x - 2 >= 0) && (y - 2 >= 0))
                    {
                        checkSquare1 = i_Matrix.GetSquare(x - 1, y - 1);
                        checkSquare2 = i_Matrix.GetSquare(x - 2, y - 2);
                        if (checkSquare1.GetChecker() != null && checkSquare2.GetChecker() == null && (checkSquare1.GetChecker().Color != i_PlayerColor))
                        {
                            o_ResDestanation.Add(new Point(x, y));
                            o_ResDestanation.Add(new Point(x - 2, y - 2));
                        }
                    }
                }
            }
        }
예제 #3
0
 public bool ComparePoints(Point i_CmpTo)
 {
     return((m_X == i_CmpTo.GetX()) && (m_Y == i_CmpTo.GetY()));
 }