/// <summary> /// Entry Point for the Challenge /// </summary> /// <param name="args">Command line Arguments</param> public static void Main(string[] args) { string[] lines = File.ReadAllLines(args[0]); foreach (var line in lines) { var display = new SegmentDisplay(); display.Display(line); } }
private void UpdateSegment(GameObject segment, int digit) { bool[] states = SegmentDisplay.getStatesForDigit(digit); Material[] segmentMaterial = segment.GetComponent <Renderer>().materials; for (int i = 0; i < segmentMaterial.Length; i++) { segmentMaterial[i] = states[i] ? SegmentOnMaterial : SegmentOffMaterial; } segment.GetComponent <Renderer>().materials = segmentMaterial; }
private IEnumerator ClearCorrectNumbers(SegmentDisplay display) { yield return(new WaitUntil(() => !coroutineInProgress)); SetSpecificDisplayOneColor(display, Color.black); yield return(new WaitForSeconds(.2f)); SetSpecificDisplayOneColor(display, Color.green); yield return(new WaitForSeconds(.1f)); SetSpecificDisplayOneColor(display, Color.black); coroutineInProgress = false; }
public int Run(string input = Input) { var memory = Input.Split(',').Select(s => BigInteger.Parse(s)).ToArray(); memory[0] = 2; // to play for free! var cpu = new IntCodeStateMachine(memory); var scoreView = new ScoreView(); var gameView = new SegmentDisplay(scoreView, new ConsoleGameView()); var gameInput = new AiGameInput(cpu); var game = new ArcadeProgram(cpu, gameView, gameInput); cpu.RunAll(); Console.Clear(); return(scoreView.FinalScore); }
public static void UpdateSegment(GameObject segment, int digit, Material onMatieral, Material offMaterial) { int previousDigit = SegmentPreviousDigit.GetOrDefault(segment, -1); if (digit != previousDigit || previousDigit == -1) { bool[] currentStates = previousDigit == -1 ? null : SegmentDisplay.getStatesForDigit(previousDigit); bool[] digitStates = SegmentDisplay.getStatesForDigit(digit); Material[] segmentMaterial = segment.GetComponent <Renderer>().materials; for (int i = 0; i < segmentMaterial.Length; i++) { if (currentStates == null || digitStates[i] != currentStates[i]) { segmentMaterial[i] = digitStates[i] ? onMatieral : offMaterial; } } segment.GetComponent <Renderer>().materials = segmentMaterial; } SegmentPreviousDigit[segment] = digit; }
void SetSpecificDisplayOneColor(SegmentDisplay display, Color color) { display.SetColor(color); }
private static Boolean KawigiEdit_RunTest(int testNum, int p0, Boolean hasAnswer, int p1) { Console.Write("Test " + testNum + ": [" + p0); Console.WriteLine("]"); SegmentDisplay obj; int answer; obj = new SegmentDisplay(); DateTime startTime = DateTime.Now; answer = obj.howManyNumbers(p0); DateTime endTime = DateTime.Now; Boolean res; res = true; Console.WriteLine("Time: " + (endTime - startTime).TotalSeconds + " seconds"); if (hasAnswer) { Console.WriteLine("Desired answer:"); Console.WriteLine("\t" + p1); } Console.WriteLine("Your answer:"); Console.WriteLine("\t" + answer); if (hasAnswer) { res = answer == p1; } if (!res) { Console.WriteLine("DOESN'T MATCH!!!!"); } else if ((endTime - startTime).TotalSeconds >= 2) { Console.WriteLine("FAIL the timeout"); res = false; } else if (hasAnswer) { Console.WriteLine("Match :-)"); } else { Console.WriteLine("OK, but is it right?"); } Console.WriteLine(""); return res; }
public override void SetFont(SpriteFont font) { SegmentDisplay.SetFont(font); }
public override void SetTextures(Texture2D onTexture, Texture2D offTexture) { SegmentDisplay.SetTextures(onTexture, offTexture); }
public override void Draw(SpriteBatch spriteBatch) { SegmentDisplay.Draw(spriteBatch); }
public ConfigurationFibonacci(ReadonlyMemory memory, RandomAccessMemory ram, SegmentDisplay segmentDisplay, Accumulator accumulator) : base(memory) { RAM = ram; SegmentDisplay = segmentDisplay; Accumulator = accumulator; }