ulope / planetwars-python-kit

An python interface to the second Google AI-Contest (PlanetWars) at http://ai-contest.com
16 stars 12 forks source link

Fleet is missing destination #7

Closed tobiassjosten closed 14 years ago

tobiassjosten commented 14 years ago

I'm getting an error message saying NoneType has no attribute 'id'. It's coming from universe.py and I've tracked down the cause to a missing (None) fleet.destination property. Maybe this is related to the recent changes to fleets?

Here's my log, with an added log.debug(fleet) just after that "# Ugh.." comment. As you can see, most fleets are working as intended but one lacks destination:

2010-09-16 22:21:33,285 INFO: === TURN START === (Turn no: 408)
2010-09-16 22:21:33,285 INFO: ### TURN END ### (time taken: 0.0001 s)
2010-09-16 22:21:33,285 DEBUG: <F(221512238) #84 <P(14) #256 +1> -> <P(10) #933 +4> ETA 1>
2010-09-16 22:21:33,307 INFO: === TURN START === (Turn no: 409)
2010-09-16 22:21:33,307 INFO: ### TURN END ### (time taken: 0.0001 s)
2010-09-16 22:21:33,307 DEBUG: <F(221512238) #84 <P(14) #257 +1> -> <P(10) #937 +4> ETA 0>
2010-09-16 22:21:33,320 INFO: === TURN START === (Turn no: 410)
2010-09-16 22:21:33,320 INFO: ### TURN END ### (time taken: 0.0000 s)
2010-09-16 22:21:33,343 INFO: === TURN START === (Turn no: 411)
2010-09-16 22:21:33,343 INFO: ### TURN END ### (time taken: 0.0001 s)
2010-09-16 22:21:33,343 DEBUG: <F(255722076) #203 <P(12) #200 +1> -> None ETA 14>
2010-09-16 22:21:33,343 CRITICAL: Error in game engine! Report at http://github.com/ulope/planetwars-python-kit/issues
Traceback (most recent call last):
  File "/home/tobias/projects/plaguebot/planetwars/game.py", line 97, in main
    self.turn_done()
  File "/home/tobias/projects/plaguebot/planetwars/game.py", line 125, in turn_done
    self.universe.turn_done()
  File "/home/tobias/projects/plaguebot/planetwars/universe.py", line 203, in turn_done
    new_id = _make_id(fleet.owner.id, fleet.ship_count, fleet.source.id, fleet.destination.id, fleet.trip_length, fleet.turns_remaining)
AttributeError: 'NoneType' object has no attribute 'id'
2010-09-16 22:21:33,344 INFO: ########### GAME END ########### (Turn count: 411)
tobiassjosten commented 14 years ago

This error only shows when using the starter pack tools from the ai-challenge.com website. When I ran my bot with the tools from that Google code page, checked out from SVN, it worked fine. So, issue dismissed.

ulope commented 14 years ago

It might also be that you pass None to send_fleet somewhere.