Files
advent-of-code-2022/day14/ex2/main.go
2022-12-14 15:33:49 +01:00

27 lines
398 B
Go

package main
import (
"aoc2022/day14/common"
"bufio"
"fmt"
"os"
)
func main() {
rockStructures := common.Parse(*bufio.NewScanner(os.Stdin))
tileMap := common.NewMap()
for _, rockStructure := range rockStructures {
tileMap.AddRockStructure(rockStructure)
}
tileMap.AddFloor()
units := 0
for !tileMap.IsSourceBlocked() {
tileMap.DropSand()
units++
}
fmt.Println(units)
}