public void GetCurrentTurnFromComputer(out Position i_SourcePosition, out Position i_TargerPosition, out bool o_IsQuit)
        {
            Dictionary <Position, List <Position> > i_PosibleMoves = LegalMovesCalculator.CalculatePosibleMoves(m_CurrentUserTurn, m_Board, out o_IsQuit);

            Random randKey   = new Random();
            Random randValue = new Random();

            List <Position> notEmptyKeys = new List <Position>();

            foreach (Position key in i_PosibleMoves.Keys)
            {
                if (i_PosibleMoves[key].Count != 0)
                {
                    notEmptyKeys.Add(key);
                }
            }

            Position        currentRandomKey   = notEmptyKeys[(int)randKey.Next(0, notEmptyKeys.Count - 1)];
            List <Position> valuesOfRandKey    = i_PosibleMoves[currentRandomKey];
            Position        currentRandomValue = valuesOfRandKey[randValue.Next(0, valuesOfRandKey.Count - 1)];

            i_SourcePosition = new Position(currentRandomKey.m_Row, currentRandomKey.m_Col);
            i_TargerPosition = new Position(currentRandomValue.m_Row, currentRandomValue.m_Col);
            o_IsQuit         = false;
        }
        public void Move(Position i_CurrentPosition, Position i_DesierdPosition, out bool i_IsMoreEats)
        {
            eCheckerType?value = m_Board.GetCellValue((int)i_CurrentPosition.m_Row, (int)i_CurrentPosition.m_Col);

            i_IsMoreEats = false;
            m_Board.SetBoard((int)i_CurrentPosition.m_Row, (int)i_CurrentPosition.m_Col, null);
            m_Board.SetBoard((int)i_DesierdPosition.m_Row, (int)i_DesierdPosition.m_Col, value);
            ChangeToKingIfNeed(i_DesierdPosition);
            if ((i_CurrentPosition.m_Row - i_DesierdPosition.m_Row > 1) || (i_CurrentPosition.m_Row - i_DesierdPosition.m_Row < -1)) // check for eat
            {
                m_Board.SetBoard((int)(i_CurrentPosition.m_Row + i_DesierdPosition.m_Row) / 2, (int)(i_CurrentPosition.m_Col + i_DesierdPosition.m_Col) / 2, null);

                //check if exist more eats
                Dictionary <Position, List <Position> > moreLegalEat = LegalMovesCalculator.CalculatePosibleMoves(m_CurrentUserTurn, m_Board, out i_IsMoreEats);
                if (i_IsMoreEats)
                {
                    if (moreLegalEat[i_DesierdPosition].Count != 0)
                    {
                        i_IsMoreEats = true;
                    }
                    else
                    {
                        i_IsMoreEats = false;
                    }
                }
            }
        }
        public void HandleStatusGame()
        {
            bool isPosibleEat;
            var  resultCounterPlayerOne = LegalMovesCalculator.CalculatePosibleMoves(eUserTurn.User1, m_Board, out isPosibleEat).Count;
            var  resultCounterPlayerTwo = LegalMovesCalculator.CalculatePosibleMoves(eUserTurn.User2, m_Board, out isPosibleEat).Count;

            if (resultCounterPlayerOne == 0 && resultCounterPlayerTwo > 0)
            {
                m_GameStatus = eGameStatus.PlayerTwoWin;
            }
            else if (resultCounterPlayerTwo == 0 && resultCounterPlayerOne > 0)
            {
                m_GameStatus = eGameStatus.PlayerOneWin;
            }
            else if (resultCounterPlayerOne == 0 && resultCounterPlayerTwo == 0)
            {
                m_GameStatus = eGameStatus.Draw;
            }
        }
        public bool CheckMove(Position i_CurrentPosition, Position i_DesierdPosition)
        {
            bool answer = true;
            bool isMoreEat;

            Dictionary <Position, List <Position> > resultBySourceChecker;

            resultBySourceChecker = LegalMovesCalculator.CalculatePosibleMoves(m_CurrentUserTurn, m_Board, out isMoreEat);

            List <Position> result;

            resultBySourceChecker.TryGetValue(i_CurrentPosition, out result);

            if (result == null || !result.Contains(i_DesierdPosition))
            {
                answer = false;
            }

            return(answer);
        }