Piotr Czajkowski hace 3 horas
padre
commit
63fdaf7e4c
Se han modificado 1 ficheros con 4 adiciones y 4 borrados
  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]
 			}
 		}