public virtual void FindByCartId(string cartId, global::haxe.lang.Function callback) { #line 55 "/my-component/src/shoppingcart/ItemRepository.hx" if (((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, object>)(this.items))))))).exists(cartId)) { #line 56 "/my-component/src/shoppingcart/ItemRepository.hx" callback.__hx_invoke1_o(default(double), ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)((((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, object>)(this.items))))))).@get(cartId)).@value)))))); } else { #line 58 "/my-component/src/shoppingcart/ItemRepository.hx" callback.__hx_invoke1_o(default(double), new global::Array <object>()); } }
public override object __hx_invokeDynamic(object[] dynArgs) { #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" global::haxe.lang.Function tmp = this.fun; #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" object[] ret = new object[(dynArgs as global::System.Array).Length]; #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" { #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" int _g = 0; #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" int _g1 = (dynArgs as global::System.Array).Length; #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" while ((_g < _g1)) { #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" int i = _g++; #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" ret[i] = ((object)(dynArgs[i])); } } #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" object[] dyn = ret; #line 49 "C:\\HaxeToolkit\\haxe\\std\\cs\\internal\\Function.hx" return((object)(tmp.__hx_invoke1_o(default(double), new global::haxe.root.Array(((object[])(dyn)))))); }
public static global::haxe.root.Array filter(object it, global::haxe.lang.Function f) { #line 168 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" global::haxe.root.Array _g = new global::haxe.root.Array(new object[] {}); #line 168 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" { #line 168 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" object x = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 168 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(x, "hasNext", 407283053, null))) { #line 168 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" object x1 = ((object)(global::haxe.lang.Runtime.callField(x, "next", 1224901875, null))); #line 168 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" if (global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), x1))) { #line 168 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" _g.push(x1); } } } #line 168 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" return(_g); }
static Day9() { unchecked { global::solutions.Day9.input = global::sys.io.File.getContent("E:/Mila/Documents/GitHub/adventofcode2020/src/inputs/Day9.txt"); object __temp_stmt2 = null; { global::Array <string> _this = global::haxe.lang.StringExt.split(global::solutions.Day9.input, "\r\n"); global::haxe.lang.Function f = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::haxe._Int64.Int64_Impl_), "parseString", 208459108))); global::Array <long> ret = new global::Array <long>(((long[])(new long[_this.length]))); { int _g = 0; int _g1 = _this.length; while ((_g < _g1)) { int i = _g++; { long val = ((long)(f.__hx_invoke1_o(default(double), ((string)(_this.__a[i]))))); ret.__a[i] = val; } } } __temp_stmt2 = ret; } object __temp_stmt1 = global::Array <object> .__hx_cast <long>(((global::Array)(__temp_stmt2))); global::solutions.Day9.arr = ((global::Array <long>)(__temp_stmt1)); global::solutions.Day9.preambleLength = 25; } }
public static global::Array <A> filter <A>(object it, global::haxe.lang.Function f) { #line 168 "/opt/haxe/std/Lambda.hx" global::Array <A> _g = new global::Array <A>(new A[] {}); #line 168 "/opt/haxe/std/Lambda.hx" { #line 168 "/opt/haxe/std/Lambda.hx" object x = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 168 "/opt/haxe/std/Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(x, "hasNext", 407283053, null))) { #line 168 "/opt/haxe/std/Lambda.hx" A x1 = global::haxe.lang.Runtime.genericCast <A>(global::haxe.lang.Runtime.callField(x, "next", 1224901875, null)); #line 168 "/opt/haxe/std/Lambda.hx" if (global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), x1))) { #line 168 "/opt/haxe/std/Lambda.hx" _g.push(x1); } } } #line 168 "/opt/haxe/std/Lambda.hx" return(_g); }
public static int findIndex <T>(object it, global::haxe.lang.Function f) { unchecked { #line 274 "/opt/haxe/std/Lambda.hx" int i = 0; { #line 275 "/opt/haxe/std/Lambda.hx" object v = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 275 "/opt/haxe/std/Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(v, "hasNext", 407283053, null))) { #line 275 "/opt/haxe/std/Lambda.hx" T v1 = global::haxe.lang.Runtime.genericCast <T>(global::haxe.lang.Runtime.callField(v, "next", 1224901875, null)); if (global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), v1))) { #line 277 "/opt/haxe/std/Lambda.hx" return(i); } #line 278 "/opt/haxe/std/Lambda.hx" ++i; } } #line 280 "/opt/haxe/std/Lambda.hx" return(-1); } #line default }
public virtual void FindByCartIdAndIdx(string cartId, int idx, global::haxe.lang.Function callback) { #line 63 "/my-component/src/shoppingcart/ItemRepository.hx" if (((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, object>)(this.items))))))).exists(cartId)) { #line 64 "/my-component/src/shoppingcart/ItemRepository.hx" if ((((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)((((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, object>)(this.items))))))).@get(cartId)).@value))))).length > idx)) { #line 65 "/my-component/src/shoppingcart/ItemRepository.hx" callback.__hx_invoke1_o(default(double), ((global::shoppingcart.ItemModel)(((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)((((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, object>)(this.items))))))).@get(cartId)).@value)))))[idx]))); return; } } #line 69 "/my-component/src/shoppingcart/ItemRepository.hx" callback.__hx_invoke1_o(default(double), null); }
public override object __hx_invoke1_o(double __fn_float1, object __fn_dyn1) { #line 166 "/my-component/src/maglev/MagLevCs.hx" global::maglev.MagLevArray args = (((__fn_dyn1 == global::haxe.lang.Runtime.undefined)) ? (((global::maglev.MagLevArray)(((object)(__fn_float1))))) : (((global::maglev.MagLevArray)(__fn_dyn1)))); global::haxe.lang.Function y = ((global::haxe.lang.Function)(((object)(this.x)))); #line 168 "/my-component/src/maglev/MagLevCs.hx" object haxeArgs = this._gthis.convertToHaxe(args); object haxeRet = ((object)(y.__hx_invoke1_o(default(double), haxeArgs))); #line 170 "/my-component/src/maglev/MagLevCs.hx" return(global::maglev.MagLevResult.fromResult(this._gthis.convertToMagLev(haxeRet))); }
public virtual void noteLoop(global::haxe.lang.Function action) { unchecked { int i = (this.container.beat.notes.length - 1); while ((i >= 0)) { action.__hx_invoke1_o(default(double), ((global::alphatab.model.Note)(this.container.beat.notes[i--]))); } } }
public static void iter <A>(object it, global::haxe.lang.Function f) { #line 157 "/opt/haxe/std/Lambda.hx" object x = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 157 "/opt/haxe/std/Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(x, "hasNext", 407283053, null))) { #line 157 "/opt/haxe/std/Lambda.hx" A x1 = global::haxe.lang.Runtime.genericCast <A>(global::haxe.lang.Runtime.callField(x, "next", 1224901875, null)); f.__hx_invoke1_o(default(double), x1); } }
public static void iter(object it, global::haxe.lang.Function f) { #line 157 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" object x = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 157 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(x, "hasNext", 407283053, null))) { #line 157 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" object x1 = ((object)(global::haxe.lang.Runtime.callField(x, "next", 1224901875, null))); f.__hx_invoke1_o(default(double), x1); } }
public virtual void Add(global::shoppingcart.CartModel cart, global::haxe.lang.Function callback) { unchecked { #line 30 "/my-component/src/shoppingcart/CartRepository.hx" string cartId = global::Std.@string(this.counter); this.counter += 1; #line 32 "/my-component/src/shoppingcart/CartRepository.hx" cart.id = cartId; this.carts.push(cart); #line 34 "/my-component/src/shoppingcart/CartRepository.hx" callback.__hx_invoke1_o(default(double), cartId); } #line default }
public static global::Array <B> flatMap <A, B>(object it, global::haxe.lang.Function f) { #line 97 "/opt/haxe/std/Lambda.hx" global::Array <object> _g = new global::Array <object>(new object[] {}); #line 97 "/opt/haxe/std/Lambda.hx" { #line 97 "/opt/haxe/std/Lambda.hx" object x = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 97 "/opt/haxe/std/Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(x, "hasNext", 407283053, null))) { #line 97 "/opt/haxe/std/Lambda.hx" A x1 = global::haxe.lang.Runtime.genericCast <A>(global::haxe.lang.Runtime.callField(x, "next", 1224901875, null)); #line 97 "/opt/haxe/std/Lambda.hx" _g.push(((object)(f.__hx_invoke1_o(default(double), x1)))); } } #line 97 "/opt/haxe/std/Lambda.hx" global::Array <B> _g1 = new global::Array <B>(new B[] {}); #line 97 "/opt/haxe/std/Lambda.hx" { #line 97 "/opt/haxe/std/Lambda.hx" object e = ((object)(global::haxe.lang.Runtime.callField(((object)(_g)), "iterator", 328878574, null))); #line 97 "/opt/haxe/std/Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(e, "hasNext", 407283053, null))) { #line 97 "/opt/haxe/std/Lambda.hx" object e1 = ((object)(global::haxe.lang.Runtime.callField(e, "next", 1224901875, null))); #line 97 "/opt/haxe/std/Lambda.hx" { #line 97 "/opt/haxe/std/Lambda.hx" object x2 = ((object)(global::haxe.lang.Runtime.callField(e1, "iterator", 328878574, null))); #line 97 "/opt/haxe/std/Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(x2, "hasNext", 407283053, null))) { #line 97 "/opt/haxe/std/Lambda.hx" B x3 = global::haxe.lang.Runtime.genericCast <B>(global::haxe.lang.Runtime.callField(x2, "next", 1224901875, null)); #line 97 "/opt/haxe/std/Lambda.hx" _g1.push(x3); } } } } #line 97 "/opt/haxe/std/Lambda.hx" return(_g1); }
public global::haxe.root.Array <S> map <S>(global::haxe.lang.Function f) { global::haxe.root.Array <S> ret = new global::haxe.root.Array <S>(new S[] {}); { int _g = 0; global::haxe.root.Array <T> _g1 = this; while ((_g < _g1.length)) { T elt = _g1[_g]; ++_g; ret.push(global::haxe.lang.Runtime.genericCast <S>(f.__hx_invoke1_o(default(double), elt))); } } return(ret); }
public virtual global::haxe.ds.List map(global::haxe.lang.Function f) { #line 234 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" global::haxe.ds.List b = new global::haxe.ds.List(); global::haxe.ds._List.ListNode l = this.h; #line 236 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" while ((l != null)) { #line 237 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" object v = l.item; l = l.next; #line 239 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" b.@add(((object)(f.__hx_invoke1_o(default(double), v)))); } #line 241 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" return(b); }
public global::haxe.root.Array <T> filter(global::haxe.lang.Function f) { global::haxe.root.Array <T> ret = new global::haxe.root.Array <T>(new T[] {}); { int _g = 0; global::haxe.root.Array <T> _g1 = this; while ((_g < _g1.length)) { T elt = _g1[_g]; ++_g; if (global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), elt))) { ret.push(elt); } } } return(ret); }
public global::Array <S> map <S>(global::haxe.lang.Function f) { global::Array <S> ret = new global::Array <S>(((S[])(new S[this.length]))); { int _g = 0; int _g1 = this.length; while ((_g < _g1)) { int i = _g++; { S val = global::haxe.lang.Runtime.genericCast <S>(f.__hx_invoke1_o(default(double), global::haxe.lang.Runtime.genericCast <T>(this.__a[i]))); ret.__a[i] = val; } } } return(ret); }
public global::Array <T> filter(global::haxe.lang.Function f) { global::Array <T> ret = new global::Array <T>(new T[] {}); { int _g = 0; int _g1 = this.length; while ((_g < _g1)) { int i = _g++; T elt = global::haxe.lang.Runtime.genericCast <T>(this.__a[i]); if (global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), elt))) { ret.push(elt); } } } return(ret); }
public static bool @foreach(object it, global::haxe.lang.Function f) { #line 145 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" { #line 145 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" object x = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 145 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(x, "hasNext", 407283053, null))) { #line 145 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" object x1 = ((object)(global::haxe.lang.Runtime.callField(x, "next", 1224901875, null))); if (!(global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), x1)))) { #line 147 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" return(false); } } } #line 148 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" return(true); }
public static global::haxe.lang.Null <T> find <T>(object it, global::haxe.lang.Function f) { #line 256 "/opt/haxe/std/Lambda.hx" { #line 256 "/opt/haxe/std/Lambda.hx" object v = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 256 "/opt/haxe/std/Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(v, "hasNext", 407283053, null))) { #line 256 "/opt/haxe/std/Lambda.hx" T v1 = global::haxe.lang.Runtime.genericCast <T>(global::haxe.lang.Runtime.callField(v, "next", 1224901875, null)); if (global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), v1))) { #line 258 "/opt/haxe/std/Lambda.hx" return(new global::haxe.lang.Null <T>(v1, true)); } } } #line 260 "/opt/haxe/std/Lambda.hx" return(default(global::haxe.lang.Null <T>)); }
public static object find(object it, global::haxe.lang.Function f) { #line 242 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" { #line 242 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" object v = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 242 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(v, "hasNext", 407283053, null))) { #line 242 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" object v1 = ((object)(global::haxe.lang.Runtime.callField(v, "next", 1224901875, null))); if (global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), v1))) { #line 244 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" return(v1); } } } #line 246 "C:\\HaxeToolkit\\haxe\\std\\Lambda.hx" return(null); }
public static bool @foreach <A>(object it, global::haxe.lang.Function f) { #line 145 "/opt/haxe/std/Lambda.hx" { #line 145 "/opt/haxe/std/Lambda.hx" object x = ((object)(global::haxe.lang.Runtime.callField(it, "iterator", 328878574, null))); #line 145 "/opt/haxe/std/Lambda.hx" while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(x, "hasNext", 407283053, null))) { #line 145 "/opt/haxe/std/Lambda.hx" A x1 = global::haxe.lang.Runtime.genericCast <A>(global::haxe.lang.Runtime.callField(x, "next", 1224901875, null)); if (!(global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), x1)))) { #line 147 "/opt/haxe/std/Lambda.hx" return(false); } } } #line 148 "/opt/haxe/std/Lambda.hx" return(true); }
public virtual global::haxe.ds.List filter(global::haxe.lang.Function f) { #line 218 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" global::haxe.ds.List l2 = new global::haxe.ds.List(); global::haxe.ds._List.ListNode l = this.h; #line 220 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" while ((l != null)) { #line 221 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" object v = l.item; l = l.next; #line 223 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" if (global::haxe.lang.Runtime.toBool(f.__hx_invoke1_o(default(double), v))) { #line 224 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" l2.@add(v); } } #line 226 "C:\\HaxeToolkit\\haxe\\std\\haxe\\ds\\List.hx" return(l2); }
public virtual void Add(global::shoppingcart.ItemModel item, global::haxe.lang.Function callback) { #line 17 "/my-component/src/shoppingcart/ItemRepository.hx" if (!(((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, object>)(this.items))))))).exists(item.cartId))) { #line 18 "/my-component/src/shoppingcart/ItemRepository.hx" global::haxe.IMap <string, object> this1 = this.items; #line 18 "/my-component/src/shoppingcart/ItemRepository.hx" string k = item.cartId; #line 18 "/my-component/src/shoppingcart/ItemRepository.hx" global::Array <object> v = new global::Array <object>(); #line 18 "/my-component/src/shoppingcart/ItemRepository.hx" ((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(this1))))).@set(k, v); } #line 20 "/my-component/src/shoppingcart/ItemRepository.hx" int idx = ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)((((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, object>)(this.items))))))).@get(item.cartId)).@value))))).length; item.idx = idx; #line 22 "/my-component/src/shoppingcart/ItemRepository.hx" ((global::Array <object>)(global::Array <object> .__hx_cast <object>(((global::Array)((((global::haxe.ds.StringMap <object>)(global::haxe.ds.StringMap <object> .__hx_cast <object>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, object>)(this.items))))))).@get(item.cartId)).@value))))).push(item); callback.__hx_invoke1_o(((double)(idx)), global::haxe.lang.Runtime.undefined); }
public virtual void loadBinaryAsync(string path, global::haxe.lang.Function success, global::haxe.lang.Function error) { unchecked { try { success.__hx_invoke1_o(default(double), this.loadBinary(path)); } catch (global::System.Exception __temp_catchallException476) { object __temp_catchall477 = __temp_catchallException476; if ((__temp_catchall477 is global::haxe.lang.HaxeException)) { __temp_catchall477 = ((global::haxe.lang.HaxeException)(__temp_catchallException476)).obj; } { object e = __temp_catchall477; error.__hx_invoke1_o(default(double), global::Std.@string(e)); } } } }
public static void solve() { unchecked { global::System.Console.WriteLine(((object)("Solving Day13"))); global::Array <string> arr = global::haxe.lang.StringExt.split(global::solutions.Day13.input, "\r\n"); global::haxe.lang.Null <int> arrivalAtStationTime = global::Std.parseInt(arr[0]); global::Array <string> _this = global::haxe.lang.StringExt.split(arr[1], ","); global::haxe.lang.Function f = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::Std), "parseInt", 1450317436))); global::Array <object> ret = new global::Array <object>(((object[])(new object[_this.length]))); { int _g = 0; int _g1 = _this.length; while ((_g < _g1)) { int i = _g++; { global::haxe.lang.Null <int> val = global::haxe.lang.Null <object> .ofDynamic <int>(f.__hx_invoke1_o(default(double), ((string)(_this.__a[i])))); ret.__a[i] = (val).toDynamic(); } } } global::Array <object> busIds = ret; int nextBusId = 0; int nextBusTime = 999999999; { int _g2 = 0; while ((_g2 < busIds.length)) { global::haxe.lang.Null <int> busId = global::haxe.lang.Null <object> .ofDynamic <int>(busIds[_g2]); ++_g2; if (!(busId.hasValue)) { continue; } int trips = ((arrivalAtStationTime).@value / (busId).@value); if ((((trips * (busId).@value) + (busId).@value) < nextBusTime)) { nextBusTime = ((trips * (busId).@value) + (busId).@value); nextBusId = (busId).@value; } } } global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("a: ", global::haxe.lang.Runtime.toString((nextBusId * ((nextBusTime - (arrivalAtStationTime).@value)))))))); long currTime = ((long)(((int)(((double)(global::haxe.lang.Runtime.toDouble(busIds[0]))))))); long iterator = ((long)(((int)(((double)(global::haxe.lang.Runtime.toDouble(busIds[0]))))))); global::Array <int> busesFound = new global::Array <int>(new int[] { ((int)(global::haxe.lang.Runtime.toInt(busIds[0]))) }); while (true) { currTime = ((long)((((long)(currTime)) + ((long)(iterator))))); bool allSequentialBuses = true; { int _g3 = 0; int _g4 = busIds.length; while ((_g3 < _g4)) { int i1 = _g3++; if ((!(global::haxe.lang.Null <object> .ofDynamic <int>(busIds[i1]).hasValue) || busesFound.contains(((int)(global::haxe.lang.Runtime.toInt(busIds[i1])))))) { continue; } if ((((long)(((((long)((((long)(currTime)) + ((long)(i1)))))) % ((long)(((int)(global::haxe.lang.Runtime.toInt(busIds[i1])))))))) == ((long)(0)))) { busesFound.push(((int)(((double)(global::haxe.lang.Runtime.toDouble(busIds[i1])))))); iterator = (((long)(iterator)) * ((long)(((int)(((double)(global::haxe.lang.Runtime.toDouble(busIds[i1])))))))); } else { allSequentialBuses = false; } } } if (allSequentialBuses) { break; } } global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("b: ", (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(currTime))))))))); } }
public string map(string s, global::haxe.lang.Function f) { unchecked { #line 109 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" int offset = 0; global::System.Text.StringBuilder buf_b = new global::System.Text.StringBuilder(); #line 111 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" while (true) { #line 112 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" if ((offset >= s.Length)) { #line 113 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" break; } else if (!(this.matchSub(s, offset, null))) { #line 115 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" buf_b.Append(((string)(global::haxe.root.Std.@string(global::haxe.lang.StringExt.substr(s, offset, null))))); break; } #line 118 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" object p = this.matchedPos(); buf_b.Append(((string)(global::haxe.root.Std.@string(global::haxe.lang.StringExt.substr(s, offset, (((int)(global::haxe.lang.Runtime.getField_f(p, "pos", 5594516, true))) - ((int)(offset)))))))); #line 120 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" buf_b.Append(((string)(global::haxe.root.Std.@string(global::haxe.lang.Runtime.toString(f.__hx_invoke1_o(default(double), this)))))); if ((((int)(global::haxe.lang.Runtime.getField_f(p, "len", 5393365, true))) == 0)) { #line 122 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" buf_b.Append(((string)(global::haxe.root.Std.@string(global::haxe.lang.StringExt.substr(s, ((int)(global::haxe.lang.Runtime.getField_f(p, "pos", 5594516, true))), 1))))); offset = (((int)(global::haxe.lang.Runtime.getField_f(p, "pos", 5594516, true))) + 1); } else { #line 125 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" offset = (((int)(global::haxe.lang.Runtime.getField_f(p, "pos", 5594516, true))) + ((int)(global::haxe.lang.Runtime.getField_f(p, "len", 5393365, true)))); } #line 111 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" if (!(this.isGlobal)) { #line 111 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" break; } } #line 127 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" if (((!(this.isGlobal) && (offset > 0)) && (offset < s.Length))) { #line 128 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" buf_b.Append(((string)(global::haxe.root.Std.@string(global::haxe.lang.StringExt.substr(s, offset, null))))); } #line 129 "C:\\HaxeToolkit\\haxe\\std\\cs\\_std\\EReg.hx" return(buf_b.ToString()); } #line default }
public static void solve() { unchecked { global::System.Console.WriteLine(((object)("Solving Day16"))); global::Array <string> fieldRulesStr = global::haxe.lang.StringExt.split(global::haxe.lang.StringExt.split(global::solutions.Day16.input, "your ticket:")[0], "\r\n"); fieldRulesStr.@remove(""); fieldRulesStr.@remove(""); global::haxe.ds.StringMap <object> fieldRules = new global::haxe.ds.StringMap <object>(); { int _g = 0; while ((_g < fieldRulesStr.length)) { string line = fieldRulesStr[_g]; ++_g; global::Array <string> lineArr = global::haxe.lang.StringExt.split(line, ":"); string fieldName = lineArr[0]; global::Array <string> rulesArr = global::haxe.lang.StringExt.split(lineArr[1], "or"); global::Array <string> lowRangeStr = global::haxe.lang.StringExt.split(rulesArr[0], "-"); lowRangeStr[0] = lowRangeStr[0].Trim(); lowRangeStr[1] = lowRangeStr[1].Trim(); global::haxe.lang.Function f = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::Std), "parseInt", 1450317436))); global::Array <object> ret = new global::Array <object>(((object[])(new object[lowRangeStr.length]))); { int _g1 = 0; int _g2 = lowRangeStr.length; while ((_g1 < _g2)) { int i = _g1++; { global::haxe.lang.Null <int> val = global::haxe.lang.Null <object> .ofDynamic <int>(f.__hx_invoke1_o(default(double), ((string)(lowRangeStr.__a[i])))); ret.__a[i] = (val).toDynamic(); } } } global::Array <object> lowRange = ret; global::Array <string> _this = global::haxe.lang.StringExt.split(rulesArr[1], "-"); global::haxe.lang.Function f1 = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::Std), "parseInt", 1450317436))); global::Array <object> ret1 = new global::Array <object>(((object[])(new object[_this.length]))); { int _g3 = 0; int _g4 = _this.length; while ((_g3 < _g4)) { int i1 = _g3++; { global::haxe.lang.Null <int> val1 = global::haxe.lang.Null <object> .ofDynamic <int>(f1.__hx_invoke1_o(default(double), ((string)(_this.__a[i1])))); ret1.__a[i1] = (val1).toDynamic(); } } } global::Array <object> highRange = ret1; { global::Array <int> v = ((global::Array <int>)(global::Array <object> .__hx_cast <int>(((global::Array)(lowRange.concat(highRange)))))); fieldRules.@set(fieldName, v); } } } global::Array <string> nearbyTicketsStr = global::haxe.lang.StringExt.split(global::haxe.lang.StringExt.split(global::solutions.Day16.input, "nearby tickets:")[1], "\r\n"); nearbyTicketsStr.@remove(""); { int _g5 = 0; while ((_g5 < nearbyTicketsStr.length)) { string ticket = nearbyTicketsStr[_g5]; ++_g5; global::Array <object> tmp = global::solutions.Day16.nearbyTickets; global::Array <string> _this1 = global::haxe.lang.StringExt.split(ticket, ","); global::haxe.lang.Function f2 = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::Std), "parseInt", 1450317436))); global::Array <object> ret2 = new global::Array <object>(((object[])(new object[_this1.length]))); { int _g6 = 0; int _g7 = _this1.length; while ((_g6 < _g7)) { int i2 = _g6++; { global::haxe.lang.Null <int> val2 = global::haxe.lang.Null <object> .ofDynamic <int>(f2.__hx_invoke1_o(default(double), ((string)(_this1.__a[i2])))); ret2.__a[i2] = (val2).toDynamic(); } } } tmp.push(ret2); } } global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("a: ", global::haxe.lang.Runtime.toString(global::solutions.Day16.calcTicketScanErrorRate(fieldRules, global::solutions.Day16.nearbyTickets)))))); global::Array <string> orderedFields = global::solutions.Day16.determineFieldOrder(fieldRules, global::solutions.Day16.nearbyTickets); long resultB = ((long)(1)); global::Array <string> _this2 = global::haxe.lang.StringExt.split(global::haxe.lang.StringExt.split(global::haxe.lang.StringExt.split(global::solutions.Day16.input, "your ticket:")[1], "\r\n")[1], ","); global::haxe.lang.Function f3 = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::Std), "parseInt", 1450317436))); global::Array <object> ret3 = new global::Array <object>(((object[])(new object[_this2.length]))); { int _g8 = 0; int _g9 = _this2.length; while ((_g8 < _g9)) { int i3 = _g8++; { global::haxe.lang.Null <int> val3 = global::haxe.lang.Null <object> .ofDynamic <int>(f3.__hx_invoke1_o(default(double), ((string)(_this2.__a[i3])))); ret3.__a[i3] = (val3).toDynamic(); } } } global::Array <object> myTicket = ret3; { int _g10 = 0; int _g11 = myTicket.length; while ((_g10 < _g11)) { int i4 = _g10++; if ((global::haxe.lang.StringExt.indexOf(orderedFields[i4], "departure", default(global::haxe.lang.Null <int>)) == 0)) { resultB = ((long)((((long)(resultB)) * ((long)(((int)(global::haxe.lang.Runtime.toInt(myTicket[i4])))))))); } } } global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("b: ", (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(resultB))))))))); } }
public static void solve() { global::System.Console.WriteLine(((object)("Solving Day1"))); global::Array <string> _this = global::haxe.lang.StringExt.split(global::solutions.Day1.input, "\r\n"); global::haxe.lang.Function f = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::Std), "parseInt", 1450317436))); global::Array <object> ret = new global::Array <object>(((object[])(new object[_this.length]))); { int _g = 0; int _g1 = _this.length; while ((_g < _g1)) { int i = _g++; { global::haxe.lang.Null <int> val = global::haxe.lang.Null <object> .ofDynamic <int>(f.__hx_invoke1_o(default(double), ((string)(_this.__a[i])))); ret.__a[i] = (val).toDynamic(); } } } global::Array <int> arr = ((global::Array <int>)(global::Array <object> .__hx_cast <int>(((global::Array)(ret))))); global::solutions.Day1.solve_a(arr); global::solutions.Day1.solve_b(arr); }
public static void solve() { unchecked { global::System.Console.WriteLine(((object)("Solving Day10"))); global::Array <string> _this = global::haxe.lang.StringExt.split(global::solutions.Day10.input, "\r\n"); global::haxe.lang.Function f = ((global::haxe.lang.Function)(new global::haxe.lang.Closure(typeof(global::Std), "parseInt", 1450317436))); global::Array <object> ret = new global::Array <object>(((object[])(new object[_this.length]))); { int _g = 0; int _g1 = _this.length; while ((_g < _g1)) { int i = _g++; { global::haxe.lang.Null <int> val = global::haxe.lang.Null <object> .ofDynamic <int>(f.__hx_invoke1_o(default(double), ((string)(_this.__a[i])))); ret.__a[i] = (val).toDynamic(); } } } global::Array <int> arr = ((global::Array <int>)(global::Array <object> .__hx_cast <int>(((global::Array)(ret))))); global::haxe.ds.IntMap <int> joltageDiffs = new global::haxe.ds.IntMap <int>(); global::Array <int> diffSequence = new global::Array <int>(); arr.sort((((global::solutions.Day10_solve_11__Fun.__hx_current != null)) ? (global::solutions.Day10_solve_11__Fun.__hx_current) : (global::solutions.Day10_solve_11__Fun.__hx_current = ((global::solutions.Day10_solve_11__Fun)(new global::solutions.Day10_solve_11__Fun()))))); int deviceJoltage = (arr[(arr.length - 1)] + 3); { int tmp = arr[0]; { int v = (new global::haxe.lang.Null <int>(((joltageDiffs.@get(tmp)).@value + 1), true)).@value; joltageDiffs.@set(tmp, v); } } diffSequence.push(arr[0]); { int _g2 = 1; int _g3 = arr.length; while ((_g2 < _g3)) { int i1 = _g2++; int diff = (arr[i1] - arr[(i1 - 1)]); { int tmp1 = diff; { int v1 = (new global::haxe.lang.Null <int>(((joltageDiffs.@get(tmp1)).@value + 1), true)).@value; joltageDiffs.@set(tmp1, v1); } } diffSequence.push(diff); } } { int tmp2 = (deviceJoltage - arr[(arr.length - 1)]); { int v2 = (new global::haxe.lang.Null <int>(((joltageDiffs.@get(tmp2)).@value + 1), true)).@value; joltageDiffs.@set(tmp2, v2); } } global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("a: ", global::haxe.lang.Runtime.toString(((joltageDiffs.@get(1)).@value * (joltageDiffs.@get(3)).@value)))))); global::Array <int> lengthsOfRemovableOnes = new global::Array <int>(); int oneCounter = 0; { int _g4 = 0; int _g5 = diffSequence.length; while ((_g4 < _g5)) { int i2 = _g4++; if ((diffSequence[i2] == 1)) { ++oneCounter; } if ((diffSequence[i2] == 3)) { if ((oneCounter > 1)) { lengthsOfRemovableOnes.push((oneCounter - 1)); } oneCounter = 0; } else if ((((i2 + 1) >= diffSequence.length) && (oneCounter > 1))) { lengthsOfRemovableOnes.push((oneCounter - 1)); } } } double resultB = 1.0; { int _g6 = 0; while ((_g6 < lengthsOfRemovableOnes.length)) { int length = lengthsOfRemovableOnes[_g6]; ++_g6; switch (length) { case 1: { resultB *= ((double)(2)); break; } case 2: { resultB *= ((double)(4)); break; } case 3: { resultB *= ((double)(7)); break; } default: { global::System.Console.WriteLine(((object)("Unhandled length in lengthsOfRemovableOnes"))); break; } } } } global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("b: ", global::haxe.lang.Runtime.toString(resultB))))); } }