Piotr Czajkowski 3 часов назад
Родитель
Сommit
63fdaf7e4c
1 измененных файлов с 4 добавлено и 4 удалено
  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]]++
 		moves[program[i]]++
 	}
 	}
 
 
-	for current != 0 {
+	for {
 		var next byte
 		var next byte
-		var max int
+		var maximum int
 
 
 		distancesFromCurrent := distances[current]
 		distancesFromCurrent := distances[current]
 		for j := range path {
 		for j := range path {
@@ -59,8 +59,8 @@ func part2(program []byte, distances map[byte]map[byte]int) int {
 				continue
 				continue
 			}
 			}
 
 
-			if distancesFromCurrent[path[j]] > max {
-				max = distancesFromCurrent[path[j]]
+			if distancesFromCurrent[path[j]] > maximum {
+				maximum = distancesFromCurrent[path[j]]
 				next = path[j]
 				next = path[j]
 			}
 			}
 		}
 		}