Fix 2020 Day 3

Fixed a bug in the CoordByteMap during 2021 day 9
This commit is contained in:
Brian Buller 2021-12-09 08:06:18 -06:00
parent 37fce967da
commit 80c89aee26
1 changed files with 2 additions and 2 deletions

View File

@ -28,8 +28,8 @@ func countTrees(field h.CoordByteMap, x, y int) int {
trees := 0
pos := h.Coordinate{X: x, Y: y}
for pos.Y < field.Height {
if pos.X > field.Width {
pos.X = pos.X - field.Width - 1
if pos.X >= field.Width {
pos.X = pos.X - field.Width
}
if field.Get(pos) == '#' {
trees++