diff --git a/2020/day03/main.go b/2020/day03/main.go index ce5c10a..030122f 100644 --- a/2020/day03/main.go +++ b/2020/day03/main.go @@ -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++