public RightTurn(CounterSettings settings) { tiles = new List <Tile>(); height = settings.BitsRequiredToEncodeUpToBaseValueInBinary * 4; SetUp(); }
public PreReaderRight(CounterSettings settings, bool carry) { height = settings.BitsRequiredToEncodeUpToBaseValueInBinary * 4; tiles = new List <Tile>(); signal = carry ? Signals.Carry : Signals.NoCarry; SetUp(); }
public PreReaderLeft(CounterSettings settings, bool isFirst) { height = settings.BitsRequiredToEncodeUpToBaseValueInBinary * 4; tiles = new List <Tile>(); signal = isFirst ? Signals.First : Signals.Nth; SetUp(); }
public Seed(CounterSettings settings) { height = settings.BitsRequiredToEncodeUpToBaseValueInBinary * 4 + 1; digits = settings.BinaryStringsForSeed.Count; StartingValues = settings.BinaryStringsForSeed; SetUp(); Start = Tiles.First(); }
public static void Main(string[] args) { while (true) { Console.WriteLine("Base value?"); var input = Console.ReadLine(); bool IsExitCommand() => input == "-e" || string.IsNullOrEmpty(input); if (int.TryParse(input, out var baseK) && baseK >= 2 && baseK <= 36) { Console.WriteLine("Stopping value?"); input = Console.ReadLine(); if (int.TryParse(input, out var stoppingValue)) { var settings = new CounterSettings(baseK, stoppingValue); TileGenerator.Write(settings); continue; } if (IsExitCommand()) { break; } Error($"Error parsing {input}... make sure the stopping value is a number"); continue; } if (IsExitCommand()) { break; } Error($"Error parsing {input}... make sure the base is a number between 2 and 36."); } }
public static void Write(CounterSettings settings) { var tiles = new HashSet <Tile>(); var seed = new Seed(settings); tiles.UnionWith(seed.Tiles); var rightWall = new RightWall(settings); tiles.UnionWith(rightWall.Tiles); var leftWall = new LeftWall(settings); tiles.UnionWith(leftWall.Tiles); var rightTurn = new RightTurn(settings); tiles.UnionWith(rightTurn.Tiles); var rightPreReaderRightCarry = new PreReaderRight(settings, true); tiles.UnionWith(rightPreReaderRightCarry.Tiles); var rightPreReaderRightNoCarry = new PreReaderRight(settings, false); tiles.UnionWith(rightPreReaderRightNoCarry.Tiles); var leftPreReaderFirst = new PreReaderLeft(settings, true); tiles.UnionWith(leftPreReaderFirst.Tiles); var leftPreReaderNth = new PreReaderLeft(settings, false); tiles.UnionWith(leftPreReaderNth.Tiles); var readerTiles = AddReaders(settings.BinaryDigitPatterns, settings.BaseK); tiles.UnionWith(readerTiles); var hookTiles = AddHooks(settings.BinaryDigitPatterns); tiles.UnionWith(hookTiles); var writerTiles = AddWriters(settings.BinaryDigitPatterns, Convert.ToInt32(settings.StoppingValue)); tiles.UnionWith(writerTiles); tiles.UnionWith(GetAllGadgets()); var tileSetName = $"base-{settings.BaseK}-counter-to-{settings.StoppingValue}"; var options = new TdpOptions(tileSetName, seed.Start.Name); var path = Utils.GetPath(); tiles = tiles.DistinctBy(t => t.Name).ToHashSet(); WriteOptions($"{path}{tileSetName}.tdp", options); WriteDefinitions($"{path}{tileSetName}.tds", tiles); }
public RightWall(CounterSettings settings) { height = settings.BitsRequiredToEncodeUpToBaseValueInBinary; tiles = new List <Tile>(); SetUp(); }
public LeftWall(CounterSettings settings) { bits = settings.BitsRequiredToEncodeUpToBaseValueInBinary; tiles = new List <Tile>(); Setup(); }