Fix 2020 Day 3
Fixed a bug in the CoordByteMap during 2021 day 9
This commit is contained in:
parent
37fce967da
commit
80c89aee26
@ -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++
|
||||
|
Loading…
Reference in New Issue
Block a user