예제 #1
0
 def testDestroyElements(self):
     levels = Levels("data/levels", window=WindowMock())
     l = levels.next_level()
     batch = pyglet.graphics.Batch()
     l.elements.extend(
         Universe.create_elements(l.space, ["O2(g)", "O2(g)", "CH4(g)"],
                                  batch, None))
예제 #2
0
 def testDestroyElements(self):
     levels = Levels("data/levels", window=WindowMock())
     l = levels.next_level()
     batch = pyglet.graphics.Batch()
     l.elements.extend(Universe.create_elements(l.space,
                                                ["O2(g)", "O2(g)", "CH4(g)"],
                                                batch, None))
예제 #3
0
    def testLevels(self):
        levels = Levels("data/levels", window=WindowMock())
        l = levels.next_level()
        expected = ['H+(g)', 'O(g)', 'O(g)', 'H+(g)', 'P(g)', 'F(g)', 'Al(s)']
        self.assertEqual(l.cml.molecules, expected)
        self.assertEqual(l.cml.victory_condition, ["H2O"])
        self.assertEqual(l.cml.objective, "Create a water molecule")
        self.assertEqual(l.cml.hint, "H + H + O => H2O")
        self.assertEqual(l.victory(), False)
        batch = pyglet.graphics.Batch()
        l.elements.extend(
            Universe.create_elements(l.space, "H2O(g)", batch, None))
        victory_effect = l.hud.horizontal.victory
        victory_effect.put_element(l.elements.pop())
        self.assertEqual(l.victory(), True)

        l = levels.next_level()
        expected = [
            'H+(g)', 'O(g)', 'O(g)', 'H+(g)', 'OH-(aq)', 'CO2(g)', 'CH4(g)'
        ]
        self.assertEqual(l.cml.molecules, expected)
        self.assertEqual(l.cml.victory_condition, ['CO', 'H2', 'H2', 'H2'])
        self.assertEqual(l.cml.objective, "Create a CO and 3 H2 molecules")
        self.assertEqual(l.cml.hint, "H2O + CH4 + Heat => CO + 3H2")
        levels.current_level = 1000
        l = levels.next_level()
        self.assertEqual(l, None)
예제 #4
0
    def testLevels(self):
        levels = Levels("data/levels", window=WindowMock())
        l = levels.next_level()
        expected = ['H+(g)', 'O(g)', 'O(g)', 'H+(g)', 'P(g)', 'F(g)', 'Al(s)']
        self.assertEqual(l.cml.molecules, expected)
        self.assertEqual(l.cml.victory_condition, ["H2O"])
        self.assertEqual(l.cml.objective, "Create a water molecule")
        self.assertEqual(l.cml.hint, "H + H + O => H2O")
        self.assertEqual(l.victory(), False)
        batch = pyglet.graphics.Batch()
        l.elements.extend(Universe.create_elements(l.space, "H2O(g)", batch, None))
        victory_effect = l.hud.horizontal.victory
        victory_effect.put_element(l.elements.pop())
        self.assertEqual(l.victory(), True)

        l = levels.next_level()
        expected = ['H+(g)', 'O(g)', 'O(g)', 'H+(g)', 'OH-(aq)', 'CO2(g)', 'CH4(g)']
        self.assertEqual(l.cml.molecules, expected)
        self.assertEqual(l.cml.victory_condition, ['CO', 'H2', 'H2', 'H2'])
        self.assertEqual(l.cml.objective, "Create a CO and 3 H2 molecules")
        self.assertEqual(l.cml.hint, "H2O + CH4 + Heat => CO + 3H2")
        levels.current_level = 1000
        l = levels.next_level()
        self.assertEqual(l, None)
예제 #5
0
파일: Levels.py 프로젝트: Norberg/molecule
 def create_elements(self, elements, pos=None):
     self.elements.extend(Universe.create_elements(self.space, elements, self.batch, pos))
예제 #6
0
파일: Levels.py 프로젝트: Norberg/molecule
 def init_elements(self):
     self.elements = Universe.create_elements(self.space, self.cml.molecules, self.batch)
예제 #7
0
 def create_elements(self, elements, pos=None):
     self.elements.extend(
         Universe.create_elements(self.space, elements, self.batch, pos))
예제 #8
0
 def init_elements(self):
     self.elements = Universe.create_elements(self.space,
                                              self.cml.molecules,
                                              self.batch)