Ejemplo n.º 1
0
    def test_more_than_4_scan(self):
        self.game_board.board = np.array(
            [
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0],
                [1, 1, 1, 1, 1, 1, 1],
            ])

        self.assertTrue(self.game_board.scan(3, 5, 1))
Ejemplo n.º 2
0
    def test_vertical_scan(self):
        self.game_board.board = np.array(
            [
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 1, 0, 0, 0],
                [0, 0, 0, 1, 0, 0, 0],
                [0, 0, 0, 1, 0, 0, 0],
                [0, 0, 0, 1, 0, 0, 0],
            ])

        self.assertTrue(self.game_board.scan(3, 5, 1))
Ejemplo n.º 3
0
    def test_diagonal2_scan(self):
        self.game_board.board = np.array(
            [
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0],
                [1, 0, 0, 0, 0, 0, 0],
                [0, 1, 0, 0, 0, 0, 0],
                [0, 0, 1, 0, 0, 0, 0],
                [0, 0, 0, 1, 0, 0, 0],
            ])

        self.assertTrue(self.game_board.scan(3, 5, 1))
Ejemplo n.º 4
0
    def test_winnig_move(self):
        board = np.array(
            [
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 0, 0, 0, 0],
                [0, 0, 0, 3, 0, 0, 0],
                [0, 0, 0, 3, 0, 0, 0],
                [0, 0, 0, 3, 0, 0, 0],
            ])

        col, minimax_score = self.ai.minimax(
            board, cf.MINIMAX_DEPTH, -np.inf, np.inf, True)

        self.assertEqual(minimax_score, cf.FINAL_SCORE)