fix: remove row and col loops
This commit is contained in:
+2
-7
@@ -17,17 +17,12 @@ func SolvePartOne(filePath string) int {
|
|||||||
|
|
||||||
var startPosition position.Position
|
var startPosition position.Position
|
||||||
|
|
||||||
for row := range grid.NumberOfRows() - 1 {
|
for p, v := range grid.Positions() {
|
||||||
for col := range grid.NumberOfColumns() - 1 {
|
|
||||||
current := position.From(row, col)
|
|
||||||
v := grid.GetValueAt(current)
|
|
||||||
|
|
||||||
if v == StartCharacter {
|
if v == StartCharacter {
|
||||||
startPosition = current
|
startPosition = p
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if startPosition == nil {
|
if startPosition == nil {
|
||||||
panic("unable to find start location")
|
panic("unable to find start location")
|
||||||
|
|||||||
Reference in New Issue
Block a user