This commit is contained in:
2022-12-14 15:33:49 +01:00
parent c40dee10cc
commit 53da8720bd
4 changed files with 195 additions and 2 deletions

26
day14/ex2/main.go Normal file
View File

@@ -0,0 +1,26 @@
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)
}