https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
advent-of-code
  • t

    todd.ginsberg

    12/18/2018, 1:08 AM
    Recursion, extension functions, and operators to the rescue! https://todd.ginsberg.com/post/advent-of-code/2018/day17/
    k
    3 replies · 2 participants
  • m

    Marcin Wisniowski

    12/18/2018, 7:31 AM
    My video visualization for Day 18 in thread (SPOILER)
    👍 2
    r
    4 replies · 2 participants
  • l

    littlelightcz

    12/18/2018, 12:27 PM
    First part was a variation on the "Game of life" and Part B I did with a little of math magic inspired by @andyb's thoughts from one of the previous days 🙂
    Day_18.kt
    a
    g
    7 replies · 3 participants
  • t

    todd.ginsberg

    12/18/2018, 9:59 PM
    So one of my bad habits is to read AoC at some point in the middle of the night if I happen to wake up. It comes out at 11pm, so I don’t compete. Anyway. I read today’s and thought “oh this is a game of life. I can do that” and went back to sleep. But then I had this dream where I solved yesterday’s water drop puzzle by inferring transform rules. I’m not going to do it but it sure is an interesting idea. Not sure if it is possible though.
    a
    k
    +1
    8 replies · 4 participants
  • t

    todd.ginsberg

    12/19/2018, 4:51 PM
    Meh. I'm not a fan of the "reverse engineer this machine code" puzzles.
    l
    g
    +3
    7 replies · 6 participants
  • o

    orangy

    12/19/2018, 6:19 PM
    TWIMC: I’m hacking together a Gradle plugin with multiplatform benchmarks (JMH on the JVM, benchmark.js in node, something not yet decided in Native, if possible). Decided to test-drive it in smaller audience here (compared to #multiplatform). If you’re interested, send me your mpp project link to play with in the thread
    j
    7 replies · 2 participants
  • j

    Joris PZ

    12/20/2018, 6:54 AM
    Dammit, another map!!?! I wish I hadn't decided to put all my code in a single package, I'm running out of pseudonyms for grids and positions....
    l
    1 reply · 2 participants
  • m

    Marcin Wisniowski

    12/20/2018, 11:19 AM
    My video visualization of Day 20 in thread
    p
    k
    6 replies · 3 participants
  • t

    todd.ginsberg

    12/20/2018, 8:04 PM
    Here's mine. I'll write it up later. I already had a
    Point
    class that I just reused.
    class Day20(rawInput: String) {
    
        private val grid: Map<Point, Int> = parseGrid(rawInput)
    
        fun solvePart1(): Int =
            grid.maxBy { it.value }!!.value
    
        fun solvePart2(): Int =
            grid.count { it.value >= 1000 }
    
    
        private fun parseGrid(input: String): Map<Point, Int> {
            val grid = mutableMapOf(startingPoint to 0)
            val stack = ArrayDeque<Point>()
            var current = startingPoint
            input.forEach {
                when (it) {
                    '(' -> stack.push(current)
                    ')' -> current = stack.pop()
                    '|' -> current = stack.peek()
                    in movementRules -> {
                        // If we are moving to a spot we haven't seen before, we can
                        // record this as a new distance.
                        val nextDistance = grid.getValue(current) + 1
                        current = movementRules.getValue(it).invoke(current)
                        if (current !in grid) grid[current] = nextDistance
                    }
                }
            }
            return grid
        }
    
        companion object {
            private val startingPoint = Point(0, 0)
            private val movementRules = mapOf(
                'N' to Point::up,
                'S' to Point::down,
                'E' to Point::right,
                'W' to Point::left
            )
        }
    }
    k
    7 replies · 2 participants
  • k

    karelpeeters

    12/21/2018, 12:27 AM
    @SiebelsTim @todd.ginsberg Why should that input return
    4
    ? The question is
    How many rooms have a shortest path from your current location that pass through at least 1000 doors?
    s
    3 replies · 2 participants
  • m

    Marcin Wisniowski

    12/21/2018, 7:13 AM
    Integer underflow in time itself you say.
    k
    4 replies · 2 participants
  • a

    andyb

    12/21/2018, 8:27 AM
    A bit disappointed with Day 20 of AoC. The Stack + Dynamic Programming approach to parse the Path only works if you assume that each subpath returns the branch point, that sounds like a massive assumption to me. I spent ages attempting to parse the path using a recursive descent parser to generate the maze (& still failed 😭). Day 21 is back to Elf Assembly Language & the problem statement seems a bit vague which has not really lightened my mood.
    k
    s
    7 replies · 3 participants
  • r

    Rostyslav

    12/21/2018, 10:47 AM
    My solutions for Day 21: https://github.com/Rtchaik/AoC2018/blob/master/src/advent2018/day21/solution21.kt https://github.com/Rtchaik/AoC2018/blob/master/src/advent2018/day21/solution21manual.kt First I did Day 21 manually and later I've understood that it could be made programmatically with minor modification of Day 19 ☹️
    j
    k
    3 replies · 3 participants
  • s

    SiebelsTim

    12/21/2018, 1:39 PM
    I simply ran the program until it hits the instruction with register 0 and look into register 3. Part 2 runs the program until it hits a cycle at that instruction. Most code is from day 19
    Day_21.kt
    👍 1
    a
    4 replies · 2 participants
  • g

    Gerard Klijs

    12/22/2018, 5:33 PM
    I have an off by one in my data, but the example is fine. Earlier I had 43 in the example, since I didn't use the different geologic index to calculate the points 'behind' it.
    k
    11 replies · 2 participants
  • j

    Joris PZ

    12/22/2018, 8:45 PM
    Took a while to make the solution finish under a second, including a whole new debugging phase. But I'm reasonably happy with the code: https://github.com/jorispz/aoc-2018/blob/master/src/commonMain/kotlin/P22.kt Times (first/best of 25): JVM
    1036/159 ms
    , JS
    1876/1058 ms
    . Native did not finish with exit code -1073741819, which seems to be some sort of access violation
    k
    2 replies · 2 participants
  • a

    andyb

    12/22/2018, 8:45 PM
    Nope that hasn't fixed it 😞. Something slightly off in my logic
    j
    6 replies · 2 participants
  • o

    orangy

    12/22/2018, 11:22 PM
    What do you need to represent?
    k
    16 replies · 2 participants
  • t

    todd.ginsberg

    12/23/2018, 5:27 PM
    Surely somebody collects all of the AoC inputs and the answers. Anybody know where to find that?
    j
    1 reply · 2 participants
  • n

    n3o59hf

    12/23/2018, 11:53 PM
    I am also one of lucky ones that got right answer by relying on data being "good" ( https://www.reddit.com/r/adventofcode/comments/a8s17l/2018_day_23_solutions/ecdbr1i ). Would be interesting to get some input that fails to produce correct answer.
    👍 1
    s
    1 reply · 2 participants
  • k

    karelpeeters

    12/24/2018, 1:23 PM
    Today was pretty cool, a bit similar to day 15 but without a grid. I got a lot of use out of
    sortedBy
    ,
    sumBy
    ,
    filter
    ,
    maxWith
    ,
    takeIf
    etc! (spoiler in thread)
    m
    s
    11 replies · 3 participants
  • t

    todd.ginsberg

    12/24/2018, 10:08 PM
    Eh. I caught the fact that fights can end in ties but I can't get the answer to part 2. Seems like WAY lower boost than the example data.
    k
    6 replies · 2 participants
  • r

    Rostyslav

    12/25/2018, 5:34 AM
    Day 25 is extremely easy. https://github.com/Rtchaik/AoC2018/blob/master/src/advent2018/day25/solution25.kt So we did it! 🙂 Merry Christmas!
    n
    1 reply · 2 participants
  • o

    orangy

    12/25/2018, 6:56 PM
    📣 Please post your repos in this thread so we can collect them and analyse 🙂 If you don’t mind…
    k
    t
    +6
    15 replies · 9 participants
  • t

    todd.ginsberg

    01/14/2019, 6:17 PM
    I love all of the things people do with the puzzles after it’s all over. Amazing.
    👍 1
    i
    k
    2 replies · 3 participants
  • k

    karelpeeters

    10/30/2019, 10:37 PM
    2^5 days!
    🎉 2
    p
    1 reply · 2 participants
  • t

    todd.ginsberg

    10/31/2019, 8:09 PM
    Plus my daughter is home from college (yay!) so we will probably have extra plans in there, whereas December last year was just another month.
    k
    1 reply · 2 participants
  • j

    Joris PZ

    10/31/2019, 8:16 PM
    I'm very proud that my company is formally sponsoring AoC this year! It's been a lot of fun participating with colleagues on a private leaderboard, so it's good we get to do something in return. Not sure if I'm gonna do Kotlin again this year. On the one hand it's a nice chance to try something new, on the other hand writing Kotlin is just so enjoyable... 🙂
    :kotlin: 1
    👍 6
    k
    t
    3 replies · 3 participants
  • k

    karelpeeters

    11/22/2019, 10:18 PM
    I feel like this countdown is getting faster somehow.
    😁 4
    🤔 2
    m
    3 replies · 2 participants
  • k

    Kroppeb

    11/28/2019, 5:46 PM
    Less then 2^64 hours
    m
    1 reply · 2 participants
Powered by Linen
Title
k

Kroppeb

11/28/2019, 5:46 PM
Less then 2^64 hours
m

mickeelm

11/28/2019, 5:54 PM
I guess that's technically the truth! 😃
View count: 3