示例#1
0
def test_spawning_random_boards():
    board0 = Board.init_random((100, 100), 5)
    assert np.argwhere(board0.as_array()).shape == (5, 2)

    board1 = Board.init_random((4, 4), 2)
    assert np.argwhere(board1.as_array()).shape == (2, 2)

    board2 = Board.init_random((5, 5), 0)
    assert np.argwhere(board2.as_array()).shape == (0, 2)
示例#2
0
文件: environment.py 项目: kvalv/2048
 def reset(self):
     self.t = 0
     self._step_counter = 0
     self.board = Board.init_random(shape=self.env_config["board_shape"],
                                    n_tiles=2)
     return self.board