2018-12-17 22:53:07 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2019-11-07 16:23:29 +00:00
|
|
|
inp := StdinToStringSlice()
|
|
|
|
m := NewMap(inp)
|
|
|
|
m.Flood()
|
|
|
|
fmt.Println("# Part 1")
|
|
|
|
fmt.Printf("Water Spots: %d\n", m.Count(KindWater|KindFlow))
|
|
|
|
fmt.Println("# Part 2")
|
|
|
|
fmt.Printf("Water Spots: %d\n", m.Count(KindWater))
|
2018-12-17 22:53:07 +00:00
|
|
|
}
|
|
|
|
|
2019-11-07 16:23:29 +00:00
|
|
|
func StdinToStringSlice() []string {
|
2018-12-17 22:53:07 +00:00
|
|
|
var input []string
|
|
|
|
scanner := bufio.NewScanner(os.Stdin)
|
|
|
|
for scanner.Scan() {
|
|
|
|
input = append(input, scanner.Text())
|
|
|
|
}
|
|
|
|
return input
|
|
|
|
}
|