This commit is contained in:
David Daily 2020-12-01 19:16:57 -06:00
parent 635e02a515
commit 374dfcbc1d

26
2020/day1.ahk Normal file
View File

@ -0,0 +1,26 @@
#SingleInstance, Force
answer := 2020
vals := [puzzle input in comma delimited form here]
p1 := False
p2 := False
Loop {
Random, a, vals.MinIndex(), vals.MaxIndex()
Random, b, vals.MinIndex(), vals.MaxIndex()
Random, c, vals.MinIndex(), vals.MaxIndex()
; Part 1:
x := vals[a]+vals[b]
; Part 2:
y := vals[a]+vals[b]+vals[c]
If (InStr(x, answer) and p1 = False){
MsgBox,, Part 1, % vals[a] "+" vals[b] "=" x "`n" vals[a] "x" vals[b] "=" vals[a]*vals[b]
p1 := True
}
If (InStr(y, answer) and p2 = False){
MsgBox,, Part 2, % vals[a] "+" vals[b] "+" vals[c] "=" y "`n" vals[a] "x" vals[b] "x" vals[c] "=" vals[a]*vals[b]*vals[c]
p2 := True
}
If (p1 and p2){
Break
}
}