示例#1
0
def generate_ships():
    """This generates ships non-strategically for testing purposes."""
    # Let's get some ships
    ships = []
    ships.append(Ship("M", 5, 5, "H"))
    ships.append(Ship.random_ship("D"))
    ships.append(Ship.random_ship("D"))
    ships.append(Ship.random_ship("P"))
    ships.append(Ship.random_ship("P"))
    return ships
示例#2
0
文件: logic.py 项目: shunfu/mm19-3
    def setup(self):
        print "Init ships"
        ships = []
        main_ship = Ship.random_ship("M")

        for i in range (8):
            temp_ship = Ship.random_ship("D")
            while not self.ship_space_free(temp_ship):
                temp_ship = Ship.random_ship("D")
            ships.append(temp_ship)

        for i in range(10):
            temp_ship = Ship.random_ship("P")
            while not self.ship_space_free(temp_ship):
                temp_ship = Ship.random_ship("P")
            ships.append(temp_ship)

        return (main_ship, ships)