using System.Collections;
using System.Collections.Generic;
public static void Main()
var values = Combinatorics.Sequences(10);
var test = new TestConfiguration();
var d = test.GetRandomizedConfigurations().ToList();
foreach (var variation in d)
Console.WriteLine($"aws sns publish --topic-arn arn:aws:sns:us-west-2:342551781816:spyfu-cloud-serp-SF21270-AggressiveKeywordSchedulerTopic-YWQJSP076C2M --message \"{{ \\\"QueuePrefix\\\": \\\"spyfu-cloud-serp-SF21270-BatchedKeywordsQueue-1AU3ITL5M5RD\\\", \\\"Aggressiveness\\\": 500, \\\"LambdaFunctionName\\\": \\\"spyfu-cloud-serp-SF21270-KeywordSchedulerFunction-1T9H0ZU2Z5ZZN\\\", \\\"LambdaAlias\\\": \\\"$LATEST\\\", \\\"WorkPerWorker\\\": 1, \\\"ChildConfig\\\": {{ \\\"TestConfiguration\\\": {JsonSerializer.Serialize(variation).Replace("\"", "\\\"")}, \\\"NumberOfLambdasToLaunch\\\": 1, \\\"RequestBatchSize\\\": 1000, \\\"KeywordBatchSize\\\": 25, \\\"CountryCode\\\": \\\"US\\\", \\\"QueueUrl\\\": \\\"https://sqs.us-west-2.amazonaws.com/342551781816/spyfu-cloud-serp-SF21270-BatchedKeywordsQueue-1AU3ITL5M5RD\\\", \\\"IsTest\\\": true }}, \\\"WatchesInputOrOutputQueue\\\": 1, \\\"MaximumQueueThreshold\\\": 1000 }}\"\nTIMEOUT /T 45 /NOBREAK");
public class TestConfiguration
public bool IsJSEnabled { get; set; } = false;
public bool UsesGeoLocation { get; set; } = true;
public bool UsesRLZ { get; set; } = false;
public bool UsesAQS { get; set; } = false;
public bool HasNum { get; set; } = true;
public bool UsesCountry { get; set; } = true;
public bool HasLanguageInfo { get; set; } = true;
public bool UsesSourceId { get; set; } = true;
public bool UsesInputEncoding { get; set; } = true;
public bool StopsAutoCorrect { get; set; } = true;
public bool MostAdsKeywords { get; set; } = true;
public IEnumerable<TestConfiguration> GetRandomizedConfigurations()
Func<int, bool> getBool = (int val) => val == 1;
var sequences = Combinatorics.Sequences(10).ToList();
var bitArraySource = new[] { IsJSEnabled, UsesGeoLocation, UsesRLZ, UsesAQS, HasNum, UsesCountry, HasLanguageInfo, UsesSourceId, UsesInputEncoding, StopsAutoCorrect };
Func<IEnumerable<int>, int, bool> rowHasNChanges = (IEnumerable<int> row, int changes) => {
for (var i = 0; i < row.Count(); i++)
if (bitArraySource[i] != getBool(row.ElementAt(i)))
countOfChanged = countOfChanged + 1;
if (countOfChanged > changes)
return countOfChanged == changes;
return sequences.Where(row => rowHasNChanges(row, 2))
var bitArray = new BitArray(row.Select(bit => getBool(bit)).ToArray());
return new TestConfiguration
IsJSEnabled = bitArray[0],
UsesGeoLocation = bitArray[1],
UsesCountry = bitArray[5],
HasLanguageInfo = bitArray[6],
UsesSourceId = bitArray[7],
UsesInputEncoding = bitArray[8],
StopsAutoCorrect = bitArray[9],
private BitArray GetBitArray()
var bitArraySourceNullable = new[] { IsJSEnabled, UsesGeoLocation, UsesRLZ, UsesAQS, HasNum, UsesCountry, HasLanguageInfo, UsesSourceId, UsesInputEncoding, StopsAutoCorrect };
var bitArraySource = bitArraySourceNullable.Select(bit => bit).ToArray();
return new BitArray(bitArraySource);
public static TestConfiguration FromBitArray(BitArray bitArray)
return new TestConfiguration
IsJSEnabled = bitArray[0],
UsesGeoLocation = bitArray[1],
UsesCountry = bitArray[5],
HasLanguageInfo = bitArray[6],
UsesSourceId = bitArray[7],
UsesInputEncoding = bitArray[8],
StopsAutoCorrect = bitArray[9],
GetBitArray().CopyTo(result, 0);
public static TestConfiguration FromInt(int numeral)
var bitArray = new BitArray(new[] { numeral });
return FromBitArray(bitArray);