public static GameDiagonal RotateCCW(GameDiagonal input)
    {
        if (input == Nil)
        {
            return(Nil);
        }
        if (input == All)
        {
            return(All);
        }

        GameDiagonal output = Nil;

        if (input.Test(GameDiagonal.NorthWest))
        {
            output |= GameDiagonal.SouthWest;
        }
        if (input.Test(GameDiagonal.NorthEast))
        {
            output |= GameDiagonal.SouthEast;
        }
        if (input.Test(GameDiagonal.SouthEast))
        {
            output |= GameDiagonal.NorthEast;
        }
        if (input.Test(GameDiagonal.SouthWest))
        {
            output |= GameDiagonal.NorthWest;
        }
        return(output);
    }
    public static GameDiagonal RandomSingle(this GameDiagonal input)
    {
        List <GameDiagonal> options = new List <GameDiagonal>();

        if (input.Test(GameDiagonal.NorthWest))
        {
            options.Add(GameDiagonal.NorthWest);
        }
        if (input.Test(GameDiagonal.NorthEast))
        {
            options.Add(GameDiagonal.NorthEast);
        }
        if (input.Test(GameDiagonal.SouthEast))
        {
            options.Add(GameDiagonal.SouthEast);
        }
        if (input.Test(GameDiagonal.SouthWest))
        {
            options.Add(GameDiagonal.SouthWest);
        }
        if (options.Count == 0)
        {
            return(GameDiagonalHelper.Nil);
        }
        return(options[Random.Range(0, options.Count)]);
    }
    public static List <GameDiagonal> ToList(this GameDiagonal input)
    {
        List <GameDiagonal> results = new List <GameDiagonal>();

        if (input.Test(GameDiagonal.NorthWest))
        {
            results.Add(GameDiagonal.NorthWest);
        }
        if (input.Test(GameDiagonal.NorthEast))
        {
            results.Add(GameDiagonal.NorthEast);
        }
        if (input.Test(GameDiagonal.SouthEast))
        {
            results.Add(GameDiagonal.SouthEast);
        }
        if (input.Test(GameDiagonal.SouthWest))
        {
            results.Add(GameDiagonal.SouthWest);
        }
        return(results);
    }
    public static int Count(this GameDiagonal input)
    {
        int total = 0;

        if (input.Test(GameDiagonal.NorthWest))
        {
            total++;
        }
        if (input.Test(GameDiagonal.NorthEast))
        {
            total++;
        }
        if (input.Test(GameDiagonal.SouthEast))
        {
            total++;
        }
        if (input.Test(GameDiagonal.SouthWest))
        {
            total++;
        }
        return(total);
    }
    public static int CountContains(this GameDiagonal input, params GameDiagonal[] tests)
    {
        int count = 0;

        foreach (GameDiagonal test in tests)
        {
            if (input.Test(test))
            {
                count++;
            }
        }
        return(count);
    }