static void Main(string[] args) { InputGetter input = new InputGetter("input.txt"); ProgramFramework framework = new ProgramFramework(); framework.InputHandler = input.GetStringsFromInput; framework.Part1Handler = Part1; framework.Part2Handler = Part2; framework.RunProgram(); }
public void Run() { _seatMap = InputGetter.GetFromLinesAsString(11); var result1 = PartOne(); Console.WriteLine(result1); _seatMap = InputGetter.GetFromLinesAsString(11); var result2 = PartTwo(); Console.WriteLine(result2); }
static void Main() { var input = InputGetter.ReadInputAsLines <string>(2020, 7).Result; var solutionPart1 = Part1Solution(input); Console.WriteLine(solutionPart1); var solutionPart2 = Part2Solution(input); Console.WriteLine(solutionPart2); }
public void Run() { var input = InputGetter.GetFromLinesAsString(7); PopulateBagRules(input); var result1 = PartOne(); Console.WriteLine(result1); var result2 = PartTwo(); Console.WriteLine(result2); }
static void Main(string[] args) { var inputLines = InputGetter.ReadInputAsLines(2019, 6).Result; var part1Solution = Part1Solution(inputLines); System.Console.WriteLine(part1Solution); var part2Solution = Part2Solution(inputLines); System.Console.WriteLine(part2Solution); }
public static void Execute() { var input = InputGetter.GetInputForDay(10); var grid = PrepareGrid(input); var best = FindAsteroidWithMostVisibleOthers(grid); Console.WriteLine(best.VisibleOthers); var shotsFired = DestroyAsteroidsInOrder(grid, best.Asteroid); Console.WriteLine(shotsFired[199].Location); }
public static void Execute() { Console.CursorVisible = false; var input = InputGetter.GetTransformedSplitInputForDay(15, new[] { ',' }, InputTransformDay15.ParseItems).ToArray(); Part1(ref input); /*Console.Clear(); * Part2(ref input);*/ Console.CursorVisible = true; }
static void Main(string[] args) { var input = InputGetter.ReadInputAsString(2019, 8).Result; // var input = "123456789012"; var part1Solution = Part1Solution(input, 25, 6); System.Console.WriteLine(part1Solution); // var testInput = "0222112222120000"; // Part2Solution(testInput, 2, 2); Part2Solution(input, 25, 6); }
static void Main() { var input = InputGetter.ReadInputAsLines <string>(2020, 11).Result; // part1 var solutionPart1 = Part2Solution(input, 4, SetSeatRefs); Console.WriteLine(solutionPart1); // part1 var solutionPart2 = Part2Solution(input, 5, SetSeatRefs2); Console.WriteLine(solutionPart2); }
static void Main(string[] args) { var inputLines = InputGetter.ReadInputAsString(2019, 4).Result; var codes = inputLines.Split('-').Select(int.Parse).ToList(); var part1Solution = Part1Solution(codes); System.Console.WriteLine(part1Solution); var part2Solution = Part2Solution(codes); System.Console.WriteLine(part2Solution); }
static void Main() { var input = InputGetter.ReadInputAsLines <string>(2020, 13).Result.ToList(); // part1 var solutionPart1 = Part1Solution(input); Console.WriteLine(solutionPart1); // part2 var solutionPart2 = Part2Solution(input); Console.WriteLine(solutionPart2); }
static void Main() { var input = InputGetter.ReadInputAsLines <int>(2020, 10).Result; // part1 var solutionPart1 = Part1Solution(input); Console.WriteLine(solutionPart1); // part2 var solutionPart2 = Part2Solution(input); Console.WriteLine(solutionPart2); }
static void Main() { InputGetter.ReadInputAsString(2019, 1).Wait(); var inputLines = InputGetter.ReadInputAsLines(2019, 1).Result; // Part 1 var day1Solution = Day1Solution(inputLines); Console.WriteLine(day1Solution); // Part 2 var day2solution = Day2Solution(inputLines); Console.WriteLine(day2solution); }
public void Run() { var input = InputGetter.GetFromLinesAsLong(10); var sortedInput = input.ToList(); sortedInput.Sort(); sortedInput.Add(sortedInput.Max() + 3); //device sortedInput.Insert(0, 0); //charging port var result1 = PartOne(sortedInput); Console.WriteLine(result1); var result2 = PartTwo(sortedInput); Console.WriteLine(result2); }
// Use this for initialization void Start() { mainInitPos = transform.position; cameraInitPos = Camera.main.transform.position; inputGetter = FindObjectOfType <InputGetter> (); nodeHandler = GetComponent <NodeHandler> (); GameInfoManager.LoadGameInfo(); movers.SetActive(false); ChangePlace(GameInfoManager.gameInfo.places[0].name); }
public static void Execute() { var moons = InputGetter.GetTransformedSplitInputForDay(12, new[] { '\n' }, Moon.Parse).ToArray(); var original = InputGetter.GetTransformedSplitInputForDay(12, new[] { '\n' }, Moon.Parse).ToArray(); long xPeriod = 0, yPeriod = 0, zPeriod = 0; for (long count = 1; xPeriod == 0 || yPeriod == 0 || zPeriod == 0; count++) { Step(moons); if (count == 1000) { Console.WriteLine(GetTotalEnergy(moons)); } if (xPeriod == 0 && moons[0].Velocity.X == 0 && moons[0].Position.X == original[0].Position.X && moons[1].Velocity.X == 0 && moons[1].Position.X == original[1].Position.X && moons[2].Velocity.X == 0 && moons[2].Position.X == original[2].Position.X && moons[3].Velocity.X == 0 && moons[3].Position.X == original[3].Position.X) { xPeriod = count; Console.WriteLine("X period = " + count); } if (yPeriod == 0 && moons[0].Velocity.Y == 0 && moons[0].Position.Y == original[0].Position.Y && moons[1].Velocity.Y == 0 && moons[1].Position.Y == original[1].Position.Y && moons[2].Velocity.Y == 0 && moons[2].Position.Y == original[2].Position.Y && moons[3].Velocity.Y == 0 && moons[3].Position.Y == original[3].Position.Y) { yPeriod = count; Console.WriteLine("Y period = " + count); } if (zPeriod == 0 && moons[0].Velocity.Z == 0 && moons[0].Position.Z == original[0].Position.Z && moons[1].Velocity.Z == 0 && moons[1].Position.Z == original[1].Position.Z && moons[2].Velocity.Z == 0 && moons[2].Position.Z == original[2].Position.Z && moons[3].Velocity.Z == 0 && moons[3].Position.Z == original[3].Position.Z) { zPeriod = count; Console.WriteLine("Z period = " + count); } } var lcmXY = lcm(xPeriod, yPeriod); Console.WriteLine(lcm(lcmXY, zPeriod)); }
public GameBoy(string biosFile, string romFile, SpeedupFlags speedupFlags = SpeedupFlags.None) { ROM = new ROM(romFile); Debug.Assert(ROM.HeaderChecksumMatches(), "Cartridge header checksum mismatch!"); Handle = Libgambatte.gambatte_create(); Debug.Assert(Libgambatte.gambatte_loadbios(Handle, biosFile, 0x900, 0x31672598) == 0, "Unable to load BIOS!"); Debug.Assert(Libgambatte.gambatte_load(Handle, romFile, LoadFlags.GbaFlag | LoadFlags.GcbMode | LoadFlags.ReadOnlySav) == 0, "Unable to load ROM!"); VideoBuffer = new byte[160 * 144 * 4]; AudioBuffer = new byte[(SamplesPerFrame + 2064) * 2 * 2]; // Stereo 16-bit samples InputGetter = () => CurrentJoypad; Libgambatte.gambatte_setinputgetter(Handle, InputGetter); string symPath = "symfiles/" + Path.GetFileNameWithoutExtension(romFile) + ".sym"; if (File.Exists(symPath)) { SYM = new SYM(symPath); ROM.Symbols = SYM; } SetSpeedupFlags(speedupFlags); StateSize = Libgambatte.gambatte_savestate(Handle, null, 160, null); SaveStateLabels = new Dictionary <string, int>(); byte[] state = SaveState(); ByteStream data = new ByteStream(state); data.Seek(3); data.Seek(data.u24be()); while (data.Position < state.Length) { string label = ""; byte character; while ((character = data.u8()) != 0x00) { label += Convert.ToChar(character); } int size = data.u24be(); SaveStateLabels[label] = (int)data.Position; data.Seek(size); } }
static void Main(string[] args) { // InputGetter.ReadInputAsString(2019, 2).Wait(); var inputLine = InputGetter.ReadInputAsString(2019, 5).Result; var input = inputLine.Split(',').ToList(); var program = input.Select(int.Parse).ToList(); // arrange part 1 var initialInput = 1; var part1Input = program.Select(ding => ding).ToList(); var part1Solution = Part1Solution(part1Input, initialInput); System.Console.WriteLine(part1Solution); // arrange part 2 initialInput = 5; var part2Input = program.Select(ding => ding).ToList(); var part2Solution = Part2Solution(part2Input, initialInput); System.Console.WriteLine(part2Solution); }
public GameBoy(string biosFile, string romFile, string savFile = null, SpeedupFlags speedupFlags = SpeedupFlags.None) { ROM = new ROM(romFile); Debug.Assert(ROM.HeaderChecksumMatches(), "Cartridge header checksum mismatch!"); string romName = Path.GetFileNameWithoutExtension(romFile); if (savFile == null || savFile == "") { File.Delete("roms/" + romName + ".sav"); } else { File.WriteAllBytes("roms/" + romName + ".sav", File.ReadAllBytes(savFile)); } Handle = Libgambatte.gambatte_create(); Debug.Assert(Libgambatte.gambatte_loadbios(Handle, biosFile, 0x900, 0x31672598) == 0, "Unable to load BIOS!"); Debug.Assert(Libgambatte.gambatte_load(Handle, romFile, LoadFlags.GbaFlag | LoadFlags.GcbMode | LoadFlags.ReadOnlySav) == 0, "Unable to load ROM!"); VideoBuffer = new byte[160 * 144 * 4]; AudioBuffer = new byte[(SamplesPerFrame + 2064) * 2 * 2]; // Stereo 16-bit samples InputGetter = () => CurrentJoypad; Libgambatte.gambatte_setinputgetter(Handle, InputGetter); string symPath = "symfiles/" + romName + ".sym"; if (File.Exists(symPath)) { SYM = new SYM(symPath); ROM.Symbols = SYM; } SetSpeedupFlags(speedupFlags); StateSize = Libgambatte.gambatte_savestate(Handle, null, 160, null); }
public static void Execute() { var input = InputGetter.GetTransformedSplitInputForDay(11, new[] { ',' }, InputTransformDay11.ParseItems).ToArray(); Part1(input.ToArray()).GetAwaiter().GetResult(); }
public Day10() { _lstInputs = InputGetter.GetAllLinesString($"./Inputs/{GetType().Name}.txt").ToList(); }
static void Main(string[] args) { var getter = new InputGetter(); var queryLib = new QueryLibrary(); bool shopping = true; do { Console.WriteLine("What would you like to do?"); Console.WriteLine("1. Place an order (You need to provide Customer ID and Store ID)."); Console.WriteLine("2. Add a new customer."); Console.WriteLine("3. Search customers by name (first and last)."); Console.WriteLine("4. Display all order history items of a store location (By store ID)."); Console.WriteLine("5. Display all order history items of a customer (By customer ID)."); Console.WriteLine("6. Display all store locations."); Console.WriteLine("7. Display all customers."); Console.WriteLine("8. Display all order history items."); Console.WriteLine("9. Quit"); int action = getter.GetInputInt("Input a number: "); switch (action) { case 1: Customer customer = null; while (customer == null) { int cid = getter.GetInputInt("Input the customer's ID: "); customer = queryLib.GetCustomer(cid); } Console.WriteLine("Hello " + customer.FirstName + " " + customer.LastName); Store store = null; while (store == null) { int storeID = getter.GetInputInt("Input the store's ID: "); store = queryLib.GetStore(storeID); } Console.WriteLine("Welcome to " + store.Name); queryLib.PrintStoreProducts(store); var cart = queryLib.CreateShoppingCart(store); queryLib.PlaceOrder(store, customer, cart); break; case 2: string first = getter.GetInputString("Please enter the new customer's first name: "); string last = getter.GetInputString("Please enter the new customer's last name: "); int cnum = getter.GetInputInt("Please enter the new customer's card number: "); queryLib.AddCustomer(first, last, cnum); break; case 3: Customer cFind = null; while (cFind == null) { string fname = getter.GetInputString("Please enter the customer's first name: "); string lname = getter.GetInputString("Please enter the customer's last name: "); cFind = queryLib.GetCustomer(fname, lname); } Console.WriteLine("Here's your customer's information."); Console.WriteLine("ID: " + cFind.Id + ", Name: " + cFind.FirstName + " " + cFind.LastName + ", Card Number: " + cFind.CardNumber); break; case 4: Store location = null; while (location == null) { int sid = getter.GetInputInt("Please enter the store's ID: "); location = queryLib.GetStore(sid); } queryLib.StoreOrderHistory(location); break; case 5: Customer valuedCustomer = null; while (valuedCustomer == null) { int vid = getter.GetInputInt("Please enter the customer's ID: "); valuedCustomer = queryLib.GetCustomer(vid); } queryLib.CustomerOrderHistory(valuedCustomer); break; case 6: var storeLocs = queryLib.GetAllStoreLocations(); foreach (var sl in storeLocs) { Console.WriteLine(sl); } break; case 7: var customers = queryLib.GetAllCustomers(); foreach (var item in customers) { Console.WriteLine("Customer ID: " + item.Id + ", First Name: " + item.FirstName + ", Last Name: " + item.LastName + ", Card Number: " + item.CardNumber); } break; case 8: var orderHistoryItems = queryLib.GetAllOrderHistoryItems(); foreach (var item in orderHistoryItems) { Console.WriteLine("Order ID: " + item.Id + ", Store ID: " + item.StoreId + ", Customer ID: " + item.CustomerId + " Order Date: " + item.OrderDate + ", Total: $" + item.Total); } break; default: shopping = false; break; } Console.WriteLine(); }while (shopping); }
public static extern void gambatte_setinputgetter(IntPtr gb, InputGetter inputgetter);
public void LoadInput() { ExpenseCalculator = new ExpenseCalculator(InputGetter.ReadInputLinesInt(1)); }
public static extern void gambatte_setinputgetter(IntPtr core, InputGetter getinput);
public Day02() { _lstPasswords = InputGetter.GetAllLinesString($"./Inputs/{GetType().Name}.txt").ToList(); }
public Day01() { _lstExpenses = InputGetter.GetAllLinesInt($"./Inputs/{GetType().Name}.txt").ToList(); }
void Awake() { drivetrainScript = target.GetComponent <Drivetrain>(); raycastLayers = ~ignoreLayers; //If curveFOV hasn't assigned in inspector //if (curveFOV == null || curveFOV.length == 0) { curveFOV = new AnimationCurve(); curveFOV.AddKey(0.0f, 55.0f); curveFOV.AddKey(1.0f, 72.0f); } //if (FOVAffectCamDistance == null || FOVAffectCamDistance.length == 0) { FOVAffectCamDistance = new AnimationCurve(); FOVAffectCamDistance.AddKey(0.0f, 0.0f); FOVAffectCamDistance.AddKey(1.0f, -2.0f); } //if (PitchCurve == null || PitchCurve.length == 0) { PitchCurve = new AnimationCurve(); PitchCurve.AddKey(0.0f, 0.0f); PitchCurve.AddKey(0.1f, 8.0f); PitchCurve.AddKey(1.0f, 1.0f); Keyframe key = new Keyframe(0.1f, 8.0f); key.tangentMode = 21; key.inTangent = 0; key.outTangent = 0; PitchCurve.MoveKey(1, key); } mainCamera = CreateCamera(); accelKeyGetter = () => Input.GetKey(KeyCode.UpArrow); brakeKeyGetter = () => Input.GetKey(KeyCode.DownArrow); if (fMinTargetAngle_y < 0.0f) { fMinTargetAngle_y += 360f; } //Find MainCamera if (!multiCameraTest) { foreach (GameObject obj in GameObject.FindGameObjectsWithTag("MainCamera")) { if (obj.activeInHierarchy == true && obj.GetComponent <Camera>()) { SceneMainCamera = obj; } } } else { /* * SceneMainCamera = new GameObject("MultiCameraTest_" + name); * SceneMainCamera.AddComponent<Camera>(); * if (CameraManager.MultiTestCameraInstances == null) * CameraManager.MultiTestCameraInstances = new List<CarCamera>(); * CameraManager.MultiTestCameraInstances.Add(this); */ } MethodInfo minfo = typeof(CarCamera).GetMethod("switchCounterUpdate_" + switchCriteria.ToString("F"), BindingFlags.NonPublic | BindingFlags.Instance); switchCounterUpdater = (SwitchCounterUpdater)Delegate.CreateDelegate(typeof(SwitchCounterUpdater), this, minfo, false); }
// Use this for initialization void Start() { inputGetter = GameObject.FindGameObjectWithTag("InputManager").GetComponent <InputGetter>(); }
public virtual void Start() { baseRotationSpeed = rotationSpeed; inputGetter = GameObject.FindGameObjectWithTag("InputManager").GetComponent <InputGetter>(); }