Пример #1
0
 def set_up(self, alliance=(1, 2), cloak=False, map_name="jl1_extended"):
     self.w = World([])
     self.w.introduction = []
     self.w.load_and_build_map(Map("soundrts/tests/%s.txt" % map_name))
     if cloak:
         self.w.unit_class("new_flyingmachine").dct["is_a_cloaker"] = True
     self.w.populate_map([DummyClient(), DummyClient()], alliance)
     self.cp, self.cp2 = self.w.players
Пример #2
0
 def set_up(self, alliance=(1, 2), cloak=False):
     w = World([])
     w.introduction = []
     w.load_and_build_map(Map("soundrts/tests/jl1.txt"))
     w.players_starts[1][1].append(("b4", w.unit_class("lumbermill")))
     cl = DummyClient()
     cl2 = DummyClient()
     w.populate_map([cl, cl2], alliance)
     cp, self.cp2 = w.players
     return w, cl, cp
Пример #3
0
 def testSyncError(self):
     c = Coordinator(None, None, None)
     c.world = World([])
     c.world.load_and_build_map(Map("multi/m2.txt"))
     c.world.update()
     c.get_sync_debug_msg_1()
     c.get_sync_debug_msg_2()
     c.world.update()
     c.get_sync_debug_msg_1()
     c.get_sync_debug_msg_2()
Пример #4
0
 def set_up(self, alliance=(1, 2), cloak=False, map_name="jl1_extended"):
     w = World([])
     w.introduction = []
     w.load_and_build_map(Map("soundrts/tests/%s.txt" % map_name))
     if cloak:
         w.unit_class("new_flyingmachine").dct["is_a_cloaker"] = True
     cl = DummyClient()
     cl2 = DummyClient()
     w.populate_map([cl, cl2], alliance)
     cp, self.cp2 = w.players
     return w, cl, cp
Пример #5
0
def test_is_ok_for_warehouse():
    w = World([])
    c = Computer(w, DummyClient())
    a1 = Square(w, 0, 0, 12)
    assert a1.name == "a1"
    assert not c.is_ok_for_warehouse(a1, 0)
    a1.objects.append(Deposit(0))
    assert c.is_ok_for_warehouse(a1, 0)
    a1.objects.append(Warehouse([1]))
    assert c.is_ok_for_warehouse(a1, 0)
    a1.objects.append(Warehouse([0]))
    assert not c.is_ok_for_warehouse(a1, 0)
Пример #6
0
 def set_up(self,
            alliance=(1, 2),
            cloak=False,
            map_name="jl1_extended",
            ai=("easy", "easy")):
     self.w = World([])
     self.w.load_and_build_map(Map("soundrts/tests/%s.txt" % map_name))
     if cloak:
         self.w.unit_class("new_flyingmachine").dct["is_a_cloaker"] = True
     cp = DummyClient(ai[0])
     cp2 = DummyClient(ai[1])
     cp.alliance, cp2.alliance = alliance
     self.w.populate_map([cp, cp2], random_starts=False)
     self.cp, self.cp2 = self.w.players
     self.cp.is_perceiving = is_perceiving_method(self.cp)
     self.cp2.is_perceiving = is_perceiving_method(self.cp2)
     self.w._update_buckets()
Пример #7
0
def world():
    w = World([])
    w.load_and_build_map(Map("soundrts/tests/jl1_cyclic.txt"))
    return w
Пример #8
0
def world():
    w = World([])
    w.load_and_build_map(Map("soundrts/tests/height.txt"))
    return w
Пример #9
0
 def setUp(self):
     self.w = World([])
     self.w.load_and_build_map(Map("multi/m2.txt"))
     self.w2 = World([])
     self.w2.load_and_build_map(Map("multi/jl2.txt"))
Пример #10
0
 def testCheckString(self):
     World([]).get_digest()
     self.assertEqual(self.w.get_digest(), self.w.get_digest())
     self.assertNotEqual(self.w.get_digest(), self.w2.get_digest())
     self.w.get_objects_string()