Piotr Czajkowski 3 órája
szülő
commit
63fdaf7e4c
1 módosított fájl, 4 hozzáadás és 4 törlés
  1. 4 4
      02/code.go

+ 4 - 4
02/code.go

@@ -49,9 +49,9 @@ func part2(program []byte, distances map[byte]map[byte]int) int {
 		moves[program[i]]++
 	}
 
-	for current != 0 {
+	for {
 		var next byte
-		var max int
+		var maximum int
 
 		distancesFromCurrent := distances[current]
 		for j := range path {
@@ -59,8 +59,8 @@ func part2(program []byte, distances map[byte]map[byte]int) int {
 				continue
 			}
 
-			if distancesFromCurrent[path[j]] > max {
-				max = distancesFromCurrent[path[j]]
+			if distancesFromCurrent[path[j]] > maximum {
+				maximum = distancesFromCurrent[path[j]]
 				next = path[j]
 			}
 		}