Beispiel #1
0
 def allowed_actions(self, tmp_board=None, tmp_current_position=None):
     """
     @param tmp_board: state of game field
     @param tmp_current_position: starting position for a move
     @return: all posible lines we can put on the field in that partial move
     """
     if tmp_board is not None and tmp_current_position is not None:
         neighbours = get_neighbours(tmp_current_position)
         allowed = [get_move(tmp_current_position, x) for x in neighbours]
         allowed = [x for x in allowed if tmp_board[x[0], x[1]] == 0]
     else:
         neighbours = get_neighbours(self.current_position)
         allowed = [get_move(self.current_position, x) for x in neighbours]
         allowed = [x for x in allowed if self.board[x[0], x[1]] == 0]
     return allowed
Beispiel #2
0
    def add_line_to_move(self, point):
        # print(point)
        self.env.make_move([[game_state_utils.get_move(point, self.board.current_point)], point, 0])

        # print(self.env.gameState.get_move((2,6), (1,5)))

        # self.board.last_move.append((self.board.current_point, point))
        # print("env current: ", self.env.currentPlayer)
        self.board.implement_move([(self.board.current_point, point)], point, self.get_allowable_points(), self.env.currentPlayer)
        if len(self.get_allowable_points()) == 7:
            self.make_move()
Beispiel #3
0
 def test_get_move_slope(self):
     game = Game()
     line = (43, 3)
     self.assertEqual(get_move((11, 3), (10, 4)), line)
Beispiel #4
0
 def test_get_move_horizontal(self):
     game = Game()
     line = (44, 3)
     self.assertEqual(get_move((11, 3), (11, 4)), line)
Beispiel #5
0
 def test_get_move_vertical(self):
     game = Game()
     line = (41, 3)
     self.assertEqual(get_move((10, 3), (11, 3)), line)