Compare commits
1 Commits
master
...
day-5-map-
Author | SHA1 | Date | |
---|---|---|---|
b4db9ef306 |
@ -42,12 +42,12 @@ type point struct {
|
||||
}
|
||||
|
||||
type grid struct {
|
||||
m map[point]int
|
||||
m map[int]int
|
||||
}
|
||||
|
||||
func (g *grid) AddLine(start, end point, includeHorizontal bool) {
|
||||
for _, p := range LineFromPoints(start, end, includeHorizontal) {
|
||||
g.m[p]++
|
||||
g.m[p.x+p.y*1000]++
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ func partOne() {
|
||||
scanner := makeScanner(false)
|
||||
|
||||
grid := &grid{
|
||||
m: map[point]int{},
|
||||
m: make(map[int]int, 1000),
|
||||
}
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
@ -129,7 +129,7 @@ func partTwo() {
|
||||
scanner := makeScanner(false)
|
||||
|
||||
grid := &grid{
|
||||
m: map[point]int{},
|
||||
m: make(map[int]int, 1000),
|
||||
}
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
|
Loading…
Reference in New Issue
Block a user