27 lines
465 B
Go
27 lines
465 B
Go
package main
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
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))
|
|
}
|
|
|
|
func StdinToStringSlice() []string {
|
|
var input []string
|
|
scanner := bufio.NewScanner(os.Stdin)
|
|
for scanner.Scan() {
|
|
input = append(input, scanner.Text())
|
|
}
|
|
return input
|
|
}
|