planetwars-python-kit icon indicating copy to clipboard operation
planetwars-python-kit copied to clipboard

map57.txt starts me with no planets

Open damag opened this issue 15 years ago • 2 comments

Hi, when testing with map57.txt, this framework is starting me with no planets in universe.my_planets, even though the map obviously starts me with one when I look at the text file.

I created a bot that just logs the planets:

from planetwars import BaseBot, Game
from logging import getLogger

log = getLogger(__name__)

class Bot(BaseBot):
    def do_turn(self):
        log.debug(self.universe.planets)
        log.debug(self.universe.my_planets)
        log.debug(self.universe.enemy_planets)

Game(Bot)

And the log file shows that my home planet is missing from the start:

2010-09-14 00:56:25,181 INFO: ----------- GAME START -----------
2010-09-14 00:56:25,182 INFO: === TURN START === (Turn no: 1)
2010-09-14 00:56:25,183 DEBUG: Planets([<P(18)@(2.60x3.38) #52 +1>, <P(19)@(19.72x19.95) #52 +1>, <P(21)@(15.85x11.72) #23 +2>, <P(17)@(4.07x10.79) #89 +5>, <P(0)@(11.16x11.67) #24 +4>, <P(1)@(4.12x5.52) #10 +5>, <P(2)@(18.20x17.82) #100 +5>, <P(20)@(6.47x11.61) #23 +2>, <P(3)@(16.64x22.20) #66 +5>, <P(4)@(5.68x1.13) #66 +5>, <P(5)@(21.13x17.81) #88 +3>, <P(6)@(1.19x5.52) #88 +3>, <P(7)@(20.25x2.06) #90 +1>, <P(8)@(2.07x21.27) #90 +1>, <P(9)@(19.09x10.16) #71 +4>, <P(10)@(3.23x13.17) #71 +4>, <P(11)@(21.95x14.06) #10 +3>, <P(12)@(22.32x23.33) #22 +1>, <P(13)@(0.00x0.00) #22 +1>, <P(14)@(16.94x9.80) #10 +1>, <P(15)@(5.38x13.53) #10 +1>, <P(16)@(18.25x12.54) #89 +5>])
2010-09-14 00:56:25,183 DEBUG: Planets([])
2010-09-14 00:56:25,183 DEBUG: Planets([<P(2)@(18.20x17.82) #100 +5>])
2010-09-14 00:56:25,183 INFO: ### TURN END ### (time taken: 0.0008 s)

Any idea why this is happening? When I look at the full list of planets and their locations, it seems that P(1) should be mine, but it is starting it with 10 ships instead of 100? Is the line being parsed wrong?

damag avatar Sep 13 '10 23:09 damag

Also, map98.txt does the same thing but with an empty enemy_planets instead:

2010-09-14 01:26:31,054 INFO: ----------- GAME START -----------
2010-09-14 01:26:31,056 INFO: === TURN START === (Turn no: 1)
2010-09-14 01:26:31,056 DEBUG: Planets([<P(18)@(5.46x2.87) #38 +4>, <P(19)@(1.99x0.10) #42 +5>, <P(21)@(7.52x6.96) #41 +3>, <P(17)@(18.12x20.05) #38 +4>, <P(0)@(11.79x11.46) #65 +1>, <P(1)@(0.01x0.00) #100 +5>, <P(2)@(23.57x22.92) #42 +5>, <P(20)@(16.06x15.96) #41 +3>, <P(3)@(3.66x8.08) #85 +4>, <P(4)@(19.93x14.84) #85 +4>, <P(5)@(0.00x8.90) #19 +4>, <P(6)@(23.59x14.02) #19 +4>, <P(7)@(13.91x11.17) #70 +5>, <P(8)@(9.68x11.76) #70 +5>, <P(9)@(16.23x12.83) #63 +1>, <P(10)@(7.36x10.10) #63 +1>, <P(11)@(16.97x3.21) #64 +1>, <P(12)@(6.61x19.71) #64 +1>, <P(13)@(21.36x13.38) #54 +4>, <P(14)@(2.23x9.55) #54 +4>, <P(15)@(6.43x4.09) #69 +2>, <P(16)@(17.15x18.83) #69 +2>])
2010-09-14 01:26:31,056 DEBUG: Planets([<P(1)@(0.01x0.00) #100 +5>])
2010-09-14 01:26:31,056 DEBUG: Planets([])
2010-09-14 01:26:31,057 INFO: ### TURN END ### (time taken: 0.0009 s)

damag avatar Sep 13 '10 23:09 damag

Maybe it's a problem with line endings... I'll check that tomorrow.

ulope avatar Sep 14 '10 00:09 ulope