Exemple #1
0
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
Exemple #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)
Exemple #3
0
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]
Exemple #4
0
def nd_dig(game, *args):
    result = lab.nd_dig(game, *args)
    return [result, game]
Exemple #5
0
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]