def integration_test_nd(game, coords): results = [] for coord in coords: results.append([("dig", lab.nd_dig(game, coord)), ("board", deepcopy(game)), ("render", lab.nd_render(game)), ("render/xray", lab.nd_render(game, True))]) return results
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_dig(d): game, row, col = d["game"], d["row"], d["col"] nb_dug = lab.nd_dig(game, [row, col]) status = game['state'] return [game, status, nb_dug]
def nd_dig(game, *args): result = lab.nd_dig(game, *args) return [result, game]
def nd_dig(game, args): result = lab.nd_dig(game, args) # capture both the number of tiles revealed and the updated game state return [result, game]