Ejemplo n.º 1
0
    public static int GetOutsideNumber(DominoController domino, Model.PositionInHistory position)
    {
        switch (position)
        {
        case Model.PositionInHistory.Left:
            if (domino.direction == DominoController.Direction.Horizontal)
            {
                return(domino.leftValue);
            }
            else
            {
                return(domino.upperValue);
            }

        case Model.PositionInHistory.Right:
            if (domino.direction == DominoController.Direction.Horizontal)
            {
                return(domino.rightValue);
            }
            else
            {
                return(domino.upperValue);
            }

        case Model.PositionInHistory.Upper:
            if (domino.direction == DominoController.Direction.Vertical)
            {
                return(domino.upperValue);
            }
            else
            {
                return(domino.leftValue);
            }

        case Model.PositionInHistory.Lower:
            if (domino.direction == DominoController.Direction.Vertical)
            {
                return(domino.lowerValue);
            }
            else
            {
                return(domino.leftValue);
            }
        }
        return(-1);
    }
Ejemplo n.º 2
0
    public static int GetNextOutsideNumber(DominoController chosenDomino, DominoController chosenPlace, Model.PositionInHistory position)
    {
        switch (position)
        {
        case Model.PositionInHistory.Left:
            if (chosenPlace.direction == DominoController.Direction.Horizontal)
            {
                int value = chosenPlace.leftValue;
                if (chosenDomino.upperValue == chosenDomino.lowerValue && chosenDomino.upperValue == value)
                {
                    return(value);
                }
                else if (chosenDomino.upperValue == value)
                {
                    return(chosenDomino.lowerValue);
                }
                else
                {
                    return(chosenDomino.upperValue);
                }
            }
            else
            {
                int value = chosenPlace.upperValue;
                if (chosenDomino.upperValue == value)
                {
                    return(chosenDomino.lowerValue);
                }
                else
                {
                    return(chosenDomino.upperValue);
                }
            }

        case Model.PositionInHistory.Right:
            if (chosenPlace.direction == DominoController.Direction.Horizontal)
            {
                int value = chosenPlace.rightValue;
                if (chosenDomino.upperValue == chosenDomino.lowerValue && chosenDomino.upperValue == value)
                {
                    return(value);
                }
                else if (chosenDomino.upperValue == value)
                {
                    return(chosenDomino.lowerValue);
                }
                else
                {
                    return(chosenDomino.upperValue);
                }
            }
            else
            {
                int value = chosenPlace.upperValue;
                if (chosenDomino.upperValue == value)
                {
                    return(chosenDomino.lowerValue);
                }
                else
                {
                    return(chosenDomino.upperValue);
                }
            }

        case Model.PositionInHistory.Upper:
            if (chosenPlace.direction == DominoController.Direction.Vertical)
            {
                int value = chosenPlace.upperValue;
                if (chosenDomino.upperValue == chosenDomino.lowerValue && chosenDomino.upperValue == value)
                {
                    return(value);
                }
                else if (chosenDomino.upperValue == value)
                {
                    return(chosenDomino.lowerValue);
                }
                else
                {
                    return(chosenDomino.upperValue);
                }
            }
            else
            {
                int value = chosenPlace.leftValue;
                if (chosenDomino.upperValue == value)
                {
                    return(chosenDomino.lowerValue);
                }
                else
                {
                    return(chosenDomino.upperValue);
                }
            }

        case Model.PositionInHistory.Lower:
            if (chosenPlace.direction == DominoController.Direction.Vertical)
            {
                int value = chosenPlace.lowerValue;
                if (chosenDomino.upperValue == chosenDomino.lowerValue && chosenDomino.upperValue == value)
                {
                    return(value);
                }
                else if (chosenDomino.upperValue == value)
                {
                    return(chosenDomino.lowerValue);
                }
                else
                {
                    return(chosenDomino.upperValue);
                }
            }
            else
            {
                int value = chosenPlace.leftValue;
                if (chosenDomino.upperValue == value)
                {
                    return(chosenDomino.lowerValue);
                }
                else
                {
                    return(chosenDomino.upperValue);
                }
            }
        }
        return(-1);
    }