def test_to_np_many(self): """Actions to a numpy array""" actions = [ PlayerAction(1, 3, 5, 0), PlayerAction(4, 0, 5, 0), PlayerAction(8, 0, 0, 0), PlayerAction(5, 0, 0, 0) ] arr = np.array([1, 3, 5, 0, 4, 0, 5, 0, 8, 0, 0, 0, 5, 0, 0, 0], dtype=np.uint8) self.assertTrue((PlayerActionTools.to_np_many(actions) == arr).all())
def display(game, actions): """Print a game to the console""" lst = [str(i) for i in PlayerActionTools.to_np_many(actions)] print(",".join(lst)) for line in game.to_str(): print(line)