Ver código fonte

Skip over lots of things for more speed.

master
Chris Smith 4 anos atrás
pai
commit
2bdf0cfbb0
Acessado por: Chris Smith <chris@chameth.com> ID da chave GPG: 3A2D4BBDC4A3C9A9
1 arquivos alterados com 6 adições e 0 exclusões
  1. 6
    0
      19/main.go

+ 6
- 0
19/main.go Ver arquivo

17
 
17
 
18
 	sum := 0
18
 	sum := 0
19
 	lastStart := 0
19
 	lastStart := 0
20
+	lastWidth := 0
20
 	for y := 0; ; y++ {
21
 	for y := 0; ; y++ {
21
 		first := 0
22
 		first := 0
22
 
23
 
25
 			if *vm.RunForInput(x, y) == 1 {
26
 			if *vm.RunForInput(x, y) == 1 {
26
 				if first == 0 {
27
 				if first == 0 {
27
 					first = x
28
 					first = x
29
+					if y > 50 {
30
+						x += lastWidth
31
+					}
28
 				}
32
 				}
29
 				if x < 50 && y < 50 {
33
 				if x < 50 && y < 50 {
30
 					sum++
34
 					sum++
45
 					endPositions[endIndex] = x
49
 					endPositions[endIndex] = x
46
 					endIndex = (endIndex + 1) % shipSize
50
 					endIndex = (endIndex + 1) % shipSize
47
 				}
51
 				}
52
+
53
+				lastWidth = x - first - 1
48
 				break
54
 				break
49
 			}
55
 			}
50
 		}
56
 		}

Carregando…
Cancelar
Salvar