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)
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)
def ui_new_game(d): r = lab.nd_new_game([d["num_rows"], d["num_cols"]], d["bombs"]) return r
def nd_new_game(dims, bombs): return lab.nd_new_game(dims, map(tuple, bombs))
def nd_new_game(dims, bombs): return lab.nd_new_game(dims, bombs)