Пример #1
0
    private bool IsElementAvailable(int column, int row, int round, int number, DirectionEnum direction)
    {
        var position = PositionHelper.GetNextPosition(column, row, direction);
        var element  = GetBoardElement(position);
        var wall     = GetWall(position, DirectionHelper.GetReverseDirection(direction));

        if (
            wall != null ||
            (element.ContainsSnakeStep && element.Round == round) ||
            (element.ContainsTarget && element.Round == round && !TargetHelper.CanGetTargetElement(number))
            )
        {
            return(false);
        }

        return(true);
    }
Пример #2
0
    private bool IsTargetReached(int row, int column, int currentNumber, DirectionEnum direction)
    {
        var nextBoardElement = GetNextBoardElement(row, column, direction);

        return(nextBoardElement.ContainsTarget && TargetHelper.CanGetTargetElement(currentNumber));
    }