Skip to content

Commit

Permalink
19
Browse files Browse the repository at this point in the history
Signed-off-by: Robbe Pincket <7889478+Kroppeb@users.noreply.github.com>
  • Loading branch information
Kroppeb committed Dec 19, 2019
1 parent 3f92a4f commit c06f317
Show file tree
Hide file tree
Showing 15 changed files with 381 additions and 23 deletions.
204 changes: 204 additions & 0 deletions leaderboard/resources/19
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
First hundred users to get both stars on Day 19:

1) Dec 19 00:08:44 Fengyang Wang (AoC++)
2) Dec 19 00:09:25 Andrey Anurin
3) Dec 19 00:09:52 Tom Holmes
4) Dec 19 00:09:58 Jennifer Zhou
5) Dec 19 00:10:28 (anonymous user #843950)
6) Dec 19 00:10:47 orez-
7) Dec 19 00:11:15 Kevin Sun
8) Dec 19 00:11:38 awychong
9) Dec 19 00:11:52 AleksMat
10) Dec 19 00:12:54 Tomas Rokicki
11) Dec 19 00:13:02 Robert Xiao
12) Dec 19 00:13:14 Nathan Fenner (AoC++)
13) Dec 19 00:13:26 etotheipi1
14) Dec 19 00:13:53 tdeo
15) Dec 19 00:15:06 msg555
16) Dec 19 00:15:09 George Hotz (AoC++)
17) Dec 19 00:15:18 (anonymous user #204385)
18) Dec 19 00:15:45 ttalvitie
19) Dec 19 00:15:59 tckmn
20) Dec 19 00:16:05 Peter Han
21) Dec 19 00:16:24 ephemient (AoC++)
22) Dec 19 00:16:33 zielmicha
23) Dec 19 00:17:13 (anonymous user #380)
24) Dec 19 00:17:35 void
25) Dec 19 00:17:38 VeeArr (AoC++)
26) Dec 19 00:18:05 jorendorff (AoC++)
27) Dec 19 00:18:10 David Wahler (AoC++)
28) Dec 19 00:18:12 Matt Bradley
29) Dec 19 00:18:15 petertseng
30) Dec 19 00:18:25 Tom Sirgedas
31) Dec 19 00:18:25 Chad Keever
32) Dec 19 00:18:38 betaveros (AoC++)
33) Dec 19 00:18:44 pbfy0
34) Dec 19 00:18:50 D. Salgado
35) Dec 19 00:18:53 mikecheb
36) Dec 19 00:19:01 tomtheisen
37) Dec 19 00:19:15 nshepperd
38) Dec 19 00:19:25 gengkev (AoC++)
39) Dec 19 00:19:40 Craig Gidney
40) Dec 19 00:19:44 drougge (AoC++)
41) Dec 19 00:19:48 Mårten Selin (AoC++)
42) Dec 19 00:19:51 Mathias Bæk Tejs Knudsen
43) Dec 19 00:20:05 jebouin
44) Dec 19 00:20:10 Samu Jussila
45) Dec 19 00:20:12 Anish (AoC++)
46) Dec 19 00:20:54 seligman99 (AoC++)
47) Dec 19 00:21:08 mcpower
48) Dec 19 00:21:10 Daniel Guerber
49) Dec 19 00:21:15 Robert Tupelo-Schneck
50) Dec 19 00:21:17 Thomas Sewell
51) Dec 19 00:21:37 Winston Ewert
52) Dec 19 00:21:43 bluepichu
53) Dec 19 00:22:27 Cyprien Mangin
54) Dec 19 00:22:39 Matt Gruskin
55) Dec 19 00:22:40 Matthew Reeder
56) Dec 19 00:22:42 Guillaume AMBAL
57) Dec 19 00:22:46 ExpHP
58) Dec 19 00:22:48 ismailkuruca
59) Dec 19 00:22:49 (anonymous user #748532)
60) Dec 19 00:22:52 glguy (AoC++) (Sponsor)
61) Dec 19 00:23:00 Joseph Marinier
62) Dec 19 00:23:02 (anonymous user #756470)
63) Dec 19 00:23:04 Green Lightning (AoC++)
64) Dec 19 00:23:08 coolcomputery
65) Dec 19 00:23:12 Arnavion
66) Dec 19 00:23:31 Yoshiap
67) Dec 19 00:23:32 tbodt
68) Dec 19 00:23:51 Erik Amirell Eklöf
69) Dec 19 00:23:56 Joel Jonsson (AoC++)
70) Dec 19 00:24:00 mingmingrr
71) Dec 19 00:24:03 (anonymous user #646668)
72) Dec 19 00:24:09 Jan Kuipers
73) Dec 19 00:24:15 Ethan Morgan (AoC++)
74) Dec 19 00:24:29 stenzek
75) Dec 19 00:24:41 ruuddotorg
76) Dec 19 00:24:42 Colton Pauderis (AoC++)
77) Dec 19 00:24:54 0e4ef622
78) Dec 19 00:24:59 alexanderhaupt
79) Dec 19 00:25:00 KungA
80) Dec 19 00:25:00 drrelyea
81) Dec 19 00:25:04 Adam Gausmann
82) Dec 19 00:25:06 yuhan0
83) Dec 19 00:25:16 Dodomix
84) Dec 19 00:25:22 (anonymous user #436600)
85) Dec 19 00:25:27 Martin Camacho (AoC++)
86) Dec 19 00:25:28 (anonymous user #44119)
87) Dec 19 00:25:34 Joe Fowler
88) Dec 19 00:25:42 Ranjithkumar Rajagopalan
89) Dec 19 00:25:47 Jakub Michálek
90) Dec 19 00:26:05 barkefors (AoC++)
91) Dec 19 00:26:06 Max Jäger (AoC++)
92) Dec 19 00:26:39 Shuang Du
93) Dec 19 00:26:44 Kevin Yap (AoC++)
94) Dec 19 00:26:50 bwakell
95) Dec 19 00:26:52 (anonymous user #198392)
96) Dec 19 00:27:04 Troels Bjerre Lund
97) Dec 19 00:27:31 arrowbounce
98) Dec 19 00:27:31 msullivan (AoC++)
99) Dec 19 00:27:46 Stefano Rivera
100) Dec 19 00:27:59 Areus Seiru
First hundred users to get the first star on Day 19:

1) Dec 19 00:01:03 betaveros (AoC++)
2) Dec 19 00:01:26 Sophie Alpert (AoC++)
3) Dec 19 00:01:41 tckmn
4) Dec 19 00:01:43 etotheipi1
5) Dec 19 00:01:44 nthistle
6) Dec 19 00:01:54 mikecheb
7) Dec 19 00:01:56 (anonymous user #44119)
8) Dec 19 00:01:57 glguy (AoC++) (Sponsor)
9) Dec 19 00:01:58 msullivan (AoC++)
10) Dec 19 00:02:02 David Wahler (AoC++)
11) Dec 19 00:02:02 tbodt
12) Dec 19 00:02:06 Waffle 3z
13) Dec 19 00:02:09 Andrey Anurin
14) Dec 19 00:02:10 Colton Pauderis (AoC++)
15) Dec 19 00:02:11 Fengyang Wang (AoC++)
16) Dec 19 00:02:12 Barret Rennie
17) Dec 19 00:02:13 Robert Xiao
18) Dec 19 00:02:14 sguest (AoC++)
19) Dec 19 00:02:15 J.C. Moyer
20) Dec 19 00:02:16 Doug Strain
21) Dec 19 00:02:17 Sam Cappleman-Lynes
22) Dec 19 00:02:18 George Hotz (AoC++)
23) Dec 19 00:02:18 Matt Gruskin
24) Dec 19 00:02:20 iTODDLERS-BTFO
25) Dec 19 00:02:21 (anonymous user #198392)
26) Dec 19 00:02:22 Ethan Morgan (AoC++)
27) Dec 19 00:02:26 Michael Goldwasser
28) Dec 19 00:02:28 Lovemathboy H
29) Dec 19 00:02:30 MarshallOfSound
30) Dec 19 00:02:31 0e4ef622
31) Dec 19 00:02:32 Nathan Fenner (AoC++)
32) Dec 19 00:02:32 Tom Holmes
33) Dec 19 00:02:34 Bartosz Szreder
34) Dec 19 00:02:35 jhawthorn (AoC++)
35) Dec 19 00:02:35 PaulTaykalo
36) Dec 19 00:02:35 João Caldeira
37) Dec 19 00:02:36 zielmicha
38) Dec 19 00:02:40 Daniel Rejment
39) Dec 19 00:02:41 Martin Camacho (AoC++)
40) Dec 19 00:02:42 hughcoleman
41) Dec 19 00:02:43 mcpower
42) Dec 19 00:02:43 yuhan0
43) Dec 19 00:02:44 Patrick Hogg
44) Dec 19 00:02:44 (anonymous user #380)
45) Dec 19 00:02:44 arrowbounce
46) Dec 19 00:02:46 Craig Gidney
47) Dec 19 00:02:47 Thomas Steinke (AoC++)
48) Dec 19 00:02:47 coolcomputery
49) Dec 19 00:02:47 nshepperd
50) Dec 19 00:02:48 Patrick Johannessen (AoC++)
51) Dec 19 00:02:50 Peter Han
52) Dec 19 00:02:50 kentonlam
53) Dec 19 00:02:51 Jonathan Paulson
54) Dec 19 00:02:52 joefarebrother
55) Dec 19 00:02:52 seligman99 (AoC++)
56) Dec 19 00:02:52 mebeim (AoC++)
57) Dec 19 00:02:53 VeeArr (AoC++)
58) Dec 19 00:02:53 (anonymous user #403690)
59) Dec 19 00:02:53 orez-
60) Dec 19 00:02:54 petertseng
61) Dec 19 00:02:56 gwillen
62) Dec 19 00:02:56 Jonathan Rupp
63) Dec 19 00:02:57 AleksMat
64) Dec 19 00:02:57 Niak
65) Dec 19 00:02:59 Joel Jonsson (AoC++)
66) Dec 19 00:03:01 grekiki
67) Dec 19 00:03:02 Jouni K. Seppänen (AoC++) (Sponsor)
68) Dec 19 00:03:04 Kaynato
69) Dec 19 00:03:09 D. Salgado
70) Dec 19 00:03:09 Chris Mohr (AoC++)
71) Dec 19 00:03:09 Guillaume AMBAL
72) Dec 19 00:03:11 stringham
73) Dec 19 00:03:12 dan144
74) Dec 19 00:03:12 kjsatz
75) Dec 19 00:03:13 val tron
76) Dec 19 00:03:15 Kroppeb
77) Dec 19 00:03:17 Kai Si
78) Dec 19 00:03:18 Max Murin
79) Dec 19 00:03:19 James Arruda
80) Dec 19 00:03:24 sorawee
81) Dec 19 00:03:24 Mathias Bæk Tejs Knudsen
82) Dec 19 00:03:25 Andrew Magee
83) Dec 19 00:03:26 Brian Bucklew (AoC++)
84) Dec 19 00:03:28 Yoshiap
85) Dec 19 00:03:29 (anonymous user #18180)
86) Dec 19 00:03:30 Ryan Norris
87) Dec 19 00:03:32 (anonymous user #230381)
88) Dec 19 00:03:32 Jennifer Zhou
89) Dec 19 00:03:33 Edward Keyes
90) Dec 19 00:03:33 Matthew Merrill
91) Dec 19 00:03:35 ngn
92) Dec 19 00:03:35 (anonymous user #390615)
93) Dec 19 00:03:35 schn27
94) Dec 19 00:03:36 jorendorff (AoC++)
95) Dec 19 00:03:36 vash3r
96) Dec 19 00:03:36 leijurv (AoC++)
97) Dec 19 00:03:37 (anonymous user #406833)
98) Dec 19 00:03:38 randName
99) Dec 19 00:03:39 Måns Magnusson
100) Dec 19 00:03:40 (anonymous user #628737)
2 changes: 1 addition & 1 deletion leaderboard/src/Calculator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fun get(day: Int): Map<String, Int> {
}

fun main() {
val days = (1..18).map(::get)
val days = (1..19).map(::get)
val inter = days.fold(mutableListOf<Map<String,Int>>()){o,n->
o.add(when(val l = o.lastOrNull()){
null -> n
Expand Down
1 change: 1 addition & 0 deletions resources/19
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
109,424,203,1,21101,11,0,0,1105,1,282,21102,18,1,0,1106,0,259,1201,1,0,221,203,1,21102,1,31,0,1105,1,282,21101,38,0,0,1106,0,259,20102,1,23,2,21201,1,0,3,21101,1,0,1,21102,57,1,0,1105,1,303,1201,1,0,222,21001,221,0,3,20101,0,221,2,21102,1,259,1,21101,0,80,0,1105,1,225,21101,76,0,2,21102,1,91,0,1106,0,303,2102,1,1,223,21002,222,1,4,21102,1,259,3,21101,0,225,2,21102,225,1,1,21102,1,118,0,1105,1,225,21001,222,0,3,21102,1,54,2,21102,1,133,0,1106,0,303,21202,1,-1,1,22001,223,1,1,21101,148,0,0,1106,0,259,1202,1,1,223,21001,221,0,4,20101,0,222,3,21101,14,0,2,1001,132,-2,224,1002,224,2,224,1001,224,3,224,1002,132,-1,132,1,224,132,224,21001,224,1,1,21101,0,195,0,106,0,108,20207,1,223,2,20101,0,23,1,21101,0,-1,3,21102,1,214,0,1105,1,303,22101,1,1,1,204,1,99,0,0,0,0,109,5,1202,-4,1,249,22102,1,-3,1,21201,-2,0,2,21202,-1,1,3,21101,0,250,0,1106,0,225,22101,0,1,-4,109,-5,2105,1,0,109,3,22107,0,-2,-1,21202,-1,2,-1,21201,-1,-1,-1,22202,-1,-2,-2,109,-3,2105,1,0,109,3,21207,-2,0,-1,1206,-1,294,104,0,99,21201,-2,0,-2,109,-3,2105,1,0,109,5,22207,-3,-4,-1,1206,-1,346,22201,-4,-3,-4,21202,-3,-1,-1,22201,-4,-1,2,21202,2,-1,-1,22201,-4,-1,1,22101,0,-2,3,21102,1,343,0,1106,0,303,1106,0,415,22207,-2,-3,-1,1206,-1,387,22201,-3,-2,-3,21202,-2,-1,-1,22201,-3,-1,3,21202,3,-1,-1,22201,-3,-1,2,22102,1,-4,1,21101,0,384,0,1105,1,303,1106,0,415,21202,-4,-1,-4,22201,-4,-3,-4,22202,-3,-2,-2,22202,-2,-4,-4,22202,-3,-2,-3,21202,-4,-1,-2,22201,-3,-2,1,21202,1,1,-4,109,-5,2106,0,0
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions src/solutions/day 16.kt → solutions/src/solutions/day 16.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package solutions

import coroutines.parallelMap
import helpers.*
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.asFlow
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.math.*

private fun part1(data: Digits) = runBlocking {
Expand Down
6 changes: 0 additions & 6 deletions src/solutions/day 17.kt → solutions/src/solutions/day 17.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
package solutions

import coroutines.parallelMap
import grid.entityGrid
import helpers.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.channels.toList
import kotlinx.coroutines.flow.asFlow
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.math.*

val mov = listOf("A,B,A,B,A,C,B,C,A,C","L,6,R,12,L,6","R,12,L,10,L,4,L,6","L,10,L,10,L,4,L,6","n","").joinToString(separator = "\n")

Expand Down
42 changes: 34 additions & 8 deletions src/solutions/day 18.kt → solutions/src/solutions/day 18.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
package solutions

import com.sun.jmx.remote.internal.ArrayQueue
import coroutines.parallelMap
import grid.entityGrid
import helpers.*
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.asFlow
import helpers.Point
import helpers.getLines
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.math.*
import kotlin.collections.List
import kotlin.collections.MutableSet
import kotlin.collections.associateWith
import kotlin.collections.component1
import kotlin.collections.component2
import kotlin.collections.component3
import kotlin.collections.component4
import kotlin.collections.contains
import kotlin.collections.count
import kotlin.collections.emptyList
import kotlin.collections.emptySet
import kotlin.collections.filter
import kotlin.collections.filterValues
import kotlin.collections.getOrPut
import kotlin.collections.isNotEmpty
import kotlin.collections.iterator
import kotlin.collections.map
import kotlin.collections.mutableMapOf
import kotlin.collections.mutableSetOf
import kotlin.collections.set
import kotlin.collections.sorted
import kotlin.collections.toList
import kotlin.collections.toMutableMap
import kotlin.collections.toMutableSet
import kotlin.collections.toSet

data class Step(val pos: Robots, val distance: Int, val keys: Int)
data class Robots(val a: Point, val b: Point, val c: Point, val d: Point) {
Expand Down Expand Up @@ -121,7 +144,10 @@ private fun part1(data: List<List<Char>>) {
}

private fun part2(data: List<List<Char>>) = runBlocking {

//test
withContext(Dispatchers.Default) {
//test
}
}

fun main() {
Expand Down
92 changes: 92 additions & 0 deletions src/solutions/day 19.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package solutions

import coroutines.parallelMap
import grid.entityGrid
import helpers.*
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.consumeEach
import kotlinx.coroutines.channels.toList
import kotlinx.coroutines.flow.asFlow
import java.util.*
import java.util.concurrent.ConcurrentHashMap
import kotlin.math.*

private fun part1(data: IntCode) = runBlocking {

var c = 0L
for (i in 0..49){
for (j in 0..49) {
runComputer(data).run {
send(i.toLong())
send(j.toLong())
print(output.receive())
}
}
println()
}
println(c)

}

private fun part2(data: IntCode) = runBlocking {
var x = bsFirst() { x ->
println("trying x=$x")
((x/2)..(3*x)/2).find { y ->
runComputer(data).run {
send(x.toLong())
send(y.toLong())
output.receive() > 0L
} &&
runComputer(data).run {
send(x.toLong())
send(y.toLong() + 99)
output.receive() > 0L
}
&&
runComputer(data).run {
send(x.toLong()+99)
send(y.toLong())
output.receive() > 0L
}
&&
runComputer(data).run {
send(x.toLong()+99)
send(y.toLong() + 99)
output.receive() > 0L
}
} != null
}

var y = ((x/2)..(3*x)/2).find { y ->
runComputer(data).run {
send(x.toLong())
send(y.toLong())
output.receive() > 0L
} &&
runComputer(data).run {
send(x.toLong())
send(y.toLong() + 99)
output.receive() > 0L
}
&&
runComputer(data).run {
send(x.toLong()+99)
send(y.toLong())
output.receive() > 0L
}
&&
runComputer(data).run {
send(x.toLong())
send(y.toLong() + 99)
output.receive() > 0L
}
}!!
println(x*10000 + y)
}


fun main() {
val data: IntCode = getIntCode(19)
part1(data)
part2(data)
}
Loading

0 comments on commit c06f317

Please sign in to comment.