Exemplo n.º 1
0
 def test_is_not_occupied(self):
     """Case for seeing if a cell is not occupied by a worker."""
     board = Board([[0, 4]], {
         self.workers[0]: (0, 0),
         self.workers[1]: (1, 1)
     })
     self.assertEqual(board.worker_position(self.workers[1]), (1, 1))
     self.assertFalse(board.is_occupied((1, 2)))
Exemplo n.º 2
0
    def test_move_worker_on_worker(self):
        """Case for moving a worker onto another worker."""
        board = Board([[0, 1]], {
            self.workers[0]: (0, 0),
            self.workers[1]: (1, 1)
        })

        self.assertEqual(board.worker_position(self.workers[0]), (0, 0))
        self.assertEqual(board.worker_position(self.workers[1]), (1, 1))
        self.assertTrue(
            board.is_occupied(board.worker_position(self.workers[1])))
        board.move_worker(self.workers[0], Direction.SOUTHEAST)
        self.assertEqual(board.worker_position(self.workers[0]),
                         board.worker_position(self.workers[1]))
Exemplo n.º 3
0
 def test_build_floor_on_worker(self):
     """Case for building a floor on top of another worker."""
     board = Board(workers={
         self.workers[0]: (0, 0),
         self.workers[1]: (1, 1)
     })
     self.assertEqual(
         board.get_height(board.worker_position(self.workers[0]),
                          Direction.SOUTHEAST), 0)
     board.build_floor(self.workers[0], Direction.SOUTHEAST)
     self.assertTrue(board.is_occupied((1, 1)))
     self.assertEqual(
         board.get_height(board.worker_position(self.workers[0]),
                          Direction.SOUTHEAST), 1)
Exemplo n.º 4
0
 def test_is_occupied(self):
     """Base case for seeing if a cell is occupied by a worker."""
     board = Board([[0, 4]], {self.workers[0]: (0, 0)})
     self.assertEqual(board.worker_position(self.workers[0]), (0, 0))
     self.assertTrue(board.is_occupied((0, 0)))