My Day13, my coroutine/Channel IntCode implementat...
# advent-of-code
j
My Day13, my coroutine/Channel IntCode implementation is holding up fairly well, though it requires a bit too much boilerplate right now to setup the channels etc. https://github.com/jorispz/aoc-2019/blob/master/src/commonMain/kotlin/day13/p13.kt I have somewhat lost interest in doing the performance measurements for JS and native, I'll do them at some point and update the README in Github then.
t
Nice!
Mine ended up looking similar except I just throw away the read for
y
. 🙂
j
Lol yeah good point.
What pleasantly surprised me is that I didn't have to initialize the
var ballPosition: Int
on line 54. The compiler was smart enough to figure out it would never be null in practice. I ❤️ Kotlin
Or 'used before initialization' I should probably say
t
Yeah, mine is similar. It's like voodoo. It feels wrong to not init it though.
k
The only place you use ball pos is on line 71 and you set the value on line 70. So it's quite clear that it will be set. You don't even need the var
j
Yeah that's right, it's a leftover from an earlier iteration