Closed dgets closed 5 years ago
As can be seen in the following log snippet, after any one of the ships is set to dropoff
, and is flagged in the logs as returning to the shipyard, the ship no longer gets marked as doing anything in the logs, just that it's being processed, and then it's done being processed. Thus, it is likely that the way the ShipHistory
is being set is not matching the conditionals the next time through the loop checking for how to process the ship.
INFO:root:=============== TURN 102 ================ INFO:root: - updating 'me' INFO:root: - updating 'game_map' INFO:root: - initializing 'command_queue' DEBUG:root: - me.get_ships() dump: [Ship(id=0, Position(16, 12), cargo=1000 hal ite), Ship(id=6, Position(26, 13), cargo=644 halite)] INFO:root: - processing ship.id: 0 INFO:root: - ship.id: 0 returning to shipyard at Position(23, 16) INFO:root: - processing ship.id: 6 INFO:root: - ship.id: 6 continuing mining @ Position(26, 13) INFO:root: - updating frame INFO:root:=============== TURN 103 ================ INFO:root: - updating 'me' INFO:root: - updating 'game_map' INFO:root: - initializing 'command_queue' DEBUG:root: - me.get_ships() dump: [Ship(id=0, Position(17, 12), cargo=978 hali te), Ship(id=6, Position(26, 13), cargo=651 halite)] INFO:root: - processing ship.id: 0 DEBUG:root: - found and processed ship: 0 INFO:root: - processing ship.id: 6 INFO:root: - ship.id: 6 continuing mining @ Position(26, 13) INFO:root: - updating frame INFO:root:=============== TURN 104 ================ INFO:root: - updating 'me' INFO:root: - updating 'game_map' INFO:root: - initializing 'command_queue' DEBUG:root: -* me.get_ships() dump: [Ship(id=0, Position(17, 12), cargo=1000 hal ite), Ship(id=6, Position(26, 13), cargo=656 halite)] INFO:root: - processing ship.id: 0 DEBUG:root: - found and processed ship: 0 INFO:root: - processing ship.id: 6 INFO:root: - ship.id: 6 continuing mining @ Position(26, 13)
Strike that note of hope; no dropoff was made, upon further inspection (re: commit message for 31286cb).
Well, I'm going to DROP the BONE for the night, and pick this up again tomorrow. My brain is getting a little too frazzled right now. I'm starting to think (we'll see if I concur with myself tomorrow) that, perhaps, the best way to go about this is to rewrite the core algorithm in nightMiner.py
. I think that at some point the indent levels got screwed up, thus blowing my alleged 'logic' out of the water. I added so many different test cases trying to get that working without paying attention to the indent levels enough that it's definitely turning into spaghetti there.
There is, however, the option of potentially going back to the last good master commit (# a4a190f7), and pruning out all of the crap that's been added since then that is completely superfluous (ie everything new related to determining whether or not we're trying to dropoff
or in_transit
for a dropoff).
This may be a more relevant log snippet, as I took the time to identify here the turn where ships started going idle. It's interesting to note that they are, indeed, still mining (presumably until the MapCell
that they're on is devoid of halite), though they never move from that spot again. Perhaps the problem is that a) logging isn't catching when they're executing stay_still()
for mining, and b) that proper checking is not completed to verify that they're on an empty cell and need to relocate in the conditionals. Log follows (turn 011 is good, turn 012 has a ship go idle, turn 013 has all ships idle [continues throughout the remainder of the log]).
INFO:root:=============== TURN 011 ================ INFO:root: - updating 'me' INFO:root: - updating 'game_map' INFO:root: - initializing 'command_queue' DEBUG:root: - me.get_ships() dump: [Ship(id=4, Position(23, 14), cargo=8 halite ), Ship(id=0, Position(21, 20), cargo=26 halite), Ship(id=2, Position(25, 14), c argo=106 halite)] INFO:root: - processing ship.id: 4 INFO:root: - ship.id: 4 scooting to Position(23, 13) INFO:root: - processing ship.id: 0 INFO:root: - ship.id: 0 scooting to Position(21, 21) INFO:root: - processing ship.id: 2 INFO:root: - ship.id: 2 scooting to Position(25, 13) INFO:root: - pruning current_assignments, if necessary DEBUG:root: - tmp_ship dump: Ship(id=4, Position(23, 14), cargo=8 halite) DEBUG:root: - ship_history dump: 0 DEBUG:root: - tmp_ship dump: Ship(id=0, Position(21, 20), cargo=26 halite) DEBUG:root: - ship_history dump: 0 DEBUG:root: - tmp_ship dump: Ship(id=2, Position(25, 14), cargo=106 halite) DEBUG:root: - ship_history dump: 0 INFO:root: - pruning current_assignments, if necessary DEBUG:root: - tmp_ship dump: Ship(id=4, Position(23, 14), cargo=8 halite) DEBUG:root: - ship_history dump: 2 DEBUG:root: - tmp_ship dump: Ship(id=0, Position(21, 20), cargo=26 halite) DEBUG:root: - ship_history dump: 2 DEBUG:root: - tmp_ship dump: Ship(id=2, Position(25, 14), cargo=106 halite) DEBUG:root: - ship_history dump: 2 INFO:root: - pruning current_assignments, if necessary DEBUG:root: - tmp_ship dump: Ship(id=4, Position(23, 14), cargo=8 halite) DEBUG:root: - ship_history dump: 4 DEBUG:root: - tmp_ship dump: Ship(id=0, Position(21, 20), cargo=26 halite) DEBUG:root: - ship_history dump: 4 DEBUG:root: - tmp_ship dump: Ship(id=2, Position(25, 14), cargo=106 halite) DEBUG:root: - ship_history dump: 4 INFO:root: - updating frame INFO:root:=============== TURN 012 ================ INFO:root: - updating 'me' INFO:root: - updating 'game_map' INFO:root: - initializing 'command_queue' DEBUG:root: - me.get_ships() dump: [Ship(id=2, Position(25, 13), cargo=82 halit e), Ship(id=4, Position(23, 14), cargo=54 halite), Ship(id=0, Position(21, 20), cargo=96 halite)] INFO:root: - processing ship.id: 2 DEBUG:root: - found and processed ship: 2 INFO:root: - processing ship.id: 4 INFO:root: - ship.id: 4 scooting to Position(23, 13) INFO:root: - processing ship.id: 0 INFO:root: - ship.id: 0 scooting to Position(21, 21) INFO:root: - pruning current_assignments, if necessary DEBUG:root: - tmp_ship dump: Ship(id=2, Position(25, 13), cargo=82 halite) DEBUG:root: - ship_history dump: 0 DEBUG:root: - tmp_ship dump: Ship(id=4, Position(23, 14), cargo=54 halite) DEBUG:root: - ship_history dump: 0 DEBUG:root: - tmp_ship dump: Ship(id=0, Position(21, 20), cargo=96 halite) DEBUG:root: - ship_history dump: 0 INFO:root: - pruning current_assignments, if necessary DEBUG:root: - tmp_ship dump: Ship(id=2, Position(25, 13), cargo=82 halite) DEBUG:root: - ship_history dump: 2 DEBUG:root: - tmp_ship dump: Ship(id=4, Position(23, 14), cargo=54 halite) DEBUG:root: - ship_history dump: 2 DEBUG:root: - tmp_ship dump: Ship(id=0, Position(21, 20), cargo=96 halite) DEBUG:root: - ship_history dump: 2 INFO:root: - pruning current_assignments, if necessary DEBUG:root: - tmp_ship dump: Ship(id=2, Position(25, 13), cargo=82 halite) DEBUG:root: - ship_history dump: 4 DEBUG:root: - tmp_ship dump: Ship(id=4, Position(23, 14), cargo=54 halite) DEBUG:root: - ship_history dump: 4 DEBUG:root: - tmp_ship dump: Ship(id=0, Position(21, 20), cargo=96 halite) DEBUG:root: - ship_history dump: 4 INFO:root: - updating frame INFO:root:=============== TURN 013 ================ INFO:root: - updating 'me' INFO:root: - updating 'game_map' INFO:root: - initializing 'command_queue' DEBUG:root: -* me.get_ships() dump: [Ship(id=0, Position(21, 21), cargo=76 halite), Ship(id=4, Position(23, 13), cargo=41 halite), Ship(id=2, Position(25, 13), cargo=150 halite)] INFO:root: - processing ship.id: 0 DEBUG:root: - found and processed ship: 0 INFO:root: - processing ship.id: 4 DEBUG:root: - found and processed ship: 4 INFO:root: - processing ship.id: 2 DEBUG:root: - found and processed ship: 2 INFO:root: - pruning current_assignments, if necessary DEBUG:root: - tmp_ship dump: Ship(id=0, Position(21, 21), cargo=76 halite) DEBUG:root: - ship_history dump: 0 DEBUG:root: - tmp_ship dump: Ship(id=4, Position(23, 13), cargo=41 halite) DEBUG:root: - ship_history dump: 0 DEBUG:root: - tmp_ship dump: Ship(id=2, Position(25, 13), cargo=150 halite) DEBUG:root: - ship_history dump: 0 INFO:root: - pruning current_assignments, if necessary DEBUG:root: - tmp_ship dump: Ship(id=0, Position(21, 21), cargo=76 halite) DEBUG:root: - ship_history dump: 2 DEBUG:root: - tmp_ship dump: Ship(id=4, Position(23, 13), cargo=41 halite) DEBUG:root: - ship_history dump: 2 DEBUG:root: - tmp_ship dump: Ship(id=2, Position(25, 13), cargo=150 halite) DEBUG:root: - ship_history dump: 2 INFO:root: - pruning current_assignments, if necessary DEBUG:root: - tmp_ship dump: Ship(id=0, Position(21, 21), cargo=76 halite) DEBUG:root: - ship_history dump: 4 DEBUG:root: - tmp_ship dump: Ship(id=4, Position(23, 13), cargo=41 halite) DEBUG:root: - ship_history dump: 4 DEBUG:root: - tmp_ship dump: Ship(id=2, Position(25, 13), cargo=150 halite) DEBUG:root: - ship_history dump: 4 INFO:root: - updating frame INFO:root:=============== TURN 014 ================
When the modularization took place in commit 2938c18b (nightMiner.py), something in the conditionals (I assume) got mangled when I was undoing some bogus changes. Now the ships are freezing instead of dropping off their halite at the shipyard.