Exemplo n.º 1
0
 def test_newlarge4dgame(self):
     """ Testing new_game on a large 4-D board """
     with open("test_outputs/test_newlarge4dgame.json") as f:
         expected = json.load(f)
     with open("test_inputs/test_newlarge4dgame.json") as f:
         inputs = json.load(f)
     result = lab.nd_new_game(inputs["dimensions"], inputs["bombs"])
     self.assertEqual(result, expected)
Exemplo n.º 2
0
 def test_integration3(self):
     """ dig and render, repeatedly, on a large board"""
     with open("test_outputs/test_integration3.json") as f:
         expected = json.load(f)
     with open("test_inputs/test_integration3.json") as f:
         inputs = json.load(f)
     g = lab.nd_new_game(inputs['dimensions'], inputs['bombs'])
     for location, results in zip(inputs['digs'], expected):
         squares_revealed, game, rendered, rendered_xray = results
         res = lab.nd_dig(g, location)
         self.assertEqual(res, squares_revealed)
         self.assertEqual(g, game)
         self.assertEqual(lab.nd_render(g), rendered)
         self.assertEqual(lab.nd_render(g, True), rendered_xray)
Exemplo n.º 3
0
def ui_new_game(d):
    r = lab.nd_new_game([d["num_rows"], d["num_cols"]], d["bombs"])
    return r
Exemplo n.º 4
0
def nd_new_game(dims, bombs):
    return lab.nd_new_game(dims, map(tuple, bombs))
Exemplo n.º 5
0
def nd_new_game(dims, bombs):
    return lab.nd_new_game(dims, bombs)