From: Scott Worley Date: Thu, 3 Nov 2011 21:58:27 +0000 (-0700) Subject: Fix flight plan logic (destination, not origin) X-Git-Url: http://git.scottworley.com/planeteer/commitdiff_plain/7b5d9d135761c478762c98b5afb46500ad883de2?hp=f800f7321ec66dbd0cfab7934cb5003944d6250a Fix flight plan logic (destination, not origin) --- diff --git a/planeteer.go b/planeteer.go index 3dd2037..d5c359a 100644 --- a/planeteer.go +++ b/planeteer.go @@ -276,10 +276,11 @@ func FillCellByArriving(data planet_data, dims []int, table []State, addr []int) /* Travel here via a hidey hole */ if addr[Fuel]+1 < dims[Fuel] { hole_index := (dims[Fuel] - 1) - (addr[Fuel] + 1) - if hole_index < len(flight_plan()) { + if hole_index < len(flight_plan()) && addr[Location] == data.p2i[flight_plan()[hole_index]] { other[Fuel] = addr[Fuel] + 1 - other[Location] = data.p2i[flight_plan()[hole_index]] - UpdateCell(table, my_index, EncodeIndex(dims, other), 0) + for other[Location] = 0; other[Location] < dims[Location]; other[Location]++ { + UpdateCell(table, my_index, EncodeIndex(dims, other), 0) + } other[Location] = addr[Location] other[Fuel] = addr[Fuel] }