Exemplo n.º 1
0
Arquivo: test.py Projeto: nip009/2048
 def test_goDown_no_move_possible_means_nothing_changed(self):
     grid = [[0 for i in range(4)] for j in range(4)]
     grid[0] = [2, 32, 512, 8]
     grid[1] = [4, 64, 1024, 16]
     grid[2] = [8, 128, 2, 32]
     grid[3] = [16, 256, 4, 16]
     result = goDown(grid)
     self.assertEqual(result, grid)
Exemplo n.º 2
0
Arquivo: test.py Projeto: nip009/2048
 def test_goDown_merge_equal(self):
     grid = [[0 for i in range(4)] for j in range(4)]
     grid[0] = [2, 0, 2, 16]
     grid[1] = [2, 4, 4, 0]
     grid[2] = [0, 4, 4, 16]
     grid[3] = [0, 0, 0, 0]
     result = goDown(grid)
     self.assertEqual(
         result, [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 2, 0], [4, 8, 8, 32]])
Exemplo n.º 3
0
Arquivo: test.py Projeto: nip009/2048
 def test_goDown_goes_all_the_way_down(self):
     grid = [[0 for i in range(4)] for j in range(4)]
     grid[0] = [2, 0, 0, 0]
     grid[1] = [0, 4, 8, 0]
     grid[2] = [0, 0, 0, 16]
     grid[3] = [0, 0, 0, 0]
     result = goDown(grid)
     self.assertEqual(
         result, [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [2, 4, 8, 16]])
Exemplo n.º 4
0
Arquivo: test.py Projeto: nip009/2048
 def test_goDown_stay_the_same(self):
     grid = [[0 for i in range(4)] for j in range(4)]
     grid[0] = [0, 0, 0, 0]
     grid[1] = [0, 0, 0, 0]
     grid[2] = [0, 0, 0, 0]
     grid[3] = [2, 4, 8, 16]
     result = goDown(grid)
     self.assertEqual(
         result, [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [2, 4, 8, 16]])
Exemplo n.º 5
0
Arquivo: test.py Projeto: nip009/2048
 def test_goDown_sample_4(self):
     grid = [[0 for i in range(4)] for j in range(4)]
     grid[0] = [2, 0, 0, 2]
     grid[1] = [4, 16, 8, 2]
     grid[2] = [2, 64, 32, 4]
     grid[3] = [1024, 1024, 64, 0]
     result = goDown(grid)
     self.assertEqual(
         result,
         [[2, 0, 0, 0], [4, 16, 8, 0], [2, 64, 32, 4], [1024, 1024, 64, 4]])
Exemplo n.º 6
0
Arquivo: test.py Projeto: nip009/2048
 def test_goDown_grid3(self):
     result = goDown(grid3)
     self.assertEqual(
         result,
         [[0, 0, 2, 0], [0, 4, 8, 0], [0, 16, 4, 8], [512, 8, 512, 512]])
Exemplo n.º 7
0
Arquivo: test.py Projeto: nip009/2048
 def test_goDown_grid2(self):
     result = goDown(grid2)
     self.assertEqual(
         result,
         [[2, 0, 0, 8], [4, 0, 0, 4], [16, 2, 8, 16], [32, 32, 32, 32]])
Exemplo n.º 8
0
Arquivo: test.py Projeto: nip009/2048
 def test_goDown_grid1(self):
     result = goDown(grid1)
     self.assertEqual(
         result,
         [[2, 2, 0, 0], [4, 16, 8, 0], [2, 64, 32, 2], [1024, 1024, 64, 4]])