From 80c89aee26bb4b12ed6c82643ee482455df94e59 Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Thu, 9 Dec 2021 08:06:18 -0600 Subject: [PATCH] Fix 2020 Day 3 Fixed a bug in the CoordByteMap during 2021 day 9 --- 2020/day03/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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++