diff --git a/fifteen/day_fifteen.go b/fifteen/day_fifteen.go index ece482c..8ce0d43 100644 --- a/fifteen/day_fifteen.go +++ b/fifteen/day_fifteen.go @@ -81,3 +81,13 @@ func PartOne() string { return fmt.Sprintf("The 2020th number is %d", g.valueAt(2020)) } + +// PartTwo What is the 30000000th number given my input +func PartTwo() string { + g := game{} + if err := g.load("fifteen/input.txt"); err != nil { + return err.Error() + } + + return fmt.Sprintf("The 30000000th number is %d", g.valueAt(30000000)) +} diff --git a/fifteen/day_fifteen_test.go b/fifteen/day_fifteen_test.go index 75ab77b..f69a62b 100644 --- a/fifteen/day_fifteen_test.go +++ b/fifteen/day_fifteen_test.go @@ -43,3 +43,18 @@ func Test_get_guess2(t *testing.T) { } } +func Test_get_guess3(t *testing.T) { + g := game{} + if err := g.load("sample.txt"); err != nil { + t.Logf(err.Error()) + t.FailNow() + } + + r := g.valueAt(30000000) + if r != 175594 { + t.Logf("Expected 175594, but got %d", r) + t.FailNow() + } +} + + diff --git a/main.go b/main.go index 4b74d30..7debe32 100644 --- a/main.go +++ b/main.go @@ -65,4 +65,5 @@ func main() { // Day 15 fmt.Println(fifteen.PartOne()) + fmt.Println(fifteen.PartTwo()) }