relocating

This commit is contained in:
Brian Buller 2018-12-03 19:49:23 +00:00
parent 3eba9665fd
commit fc49bd9c94

View File

@ -23,15 +23,17 @@ func main() {
serial: Atoi(os.Args[1]), serial: Atoi(os.Args[1]),
fuelLevels: make(map[string]int), fuelLevels: make(map[string]int),
} }
fmt.Println(timeMachine.calcSquareFuelLevel(90, 269, 16))
os.Exit(0)
highest := MinInt highest := MinInt
highestX, highestY := 0, 0 highestX, highestY := 0, 0
highestSize := 1 highestSize := 1
for size := 1; size <= 300; size++ { for size := 1; size <= 20; size++ {
fmt.Println(size) fmt.Println(size)
for i := 0; i < 300-size; i++ { for i := 0; i < 300-size; i++ {
for j := 0; j < 300-size; j++ { for j := 0; j < 300-size; j++ {
w := timeMachine.findSquareFuelLevel(i, j, size) w := timeMachine.getSquareLevel(i, j, size)
if w > highest { if w > highest {
highestX, highestY = i, j highestX, highestY = i, j
highest = w highest = w
@ -97,7 +99,7 @@ func (t *TimeMachine) calcFuelLevel(x, y int) int {
return ret return ret
} }
func (t *TimeMachine) findSquareFuelLevel(x, y, size int) int { func (t *TimeMachine) calcSquareFuelLevel(x, y, size int) int {
var ret int var ret int
for i := 0; i < size; i++ { for i := 0; i < size; i++ {
for j := 0; j < size; j++ { for j := 0; j < size; j++ {