forked from LouisMLettry/ISChess
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParallelPlayer.py
More file actions
executable file
·32 lines (22 loc) · 968 Bytes
/
Copy pathParallelPlayer.py
File metadata and controls
executable file
·32 lines (22 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import numpy as np
from PyQt6 import QtCore
class ParallelTurn(QtCore.QThread):
""" Thread wrapper """
def __init__(self, ai_func, player_sequence, board, time_budget, tile_width, tile_height):
super().__init__()
self.ai_func = ai_func
self.board = board
self.player_sequence = player_sequence
self.time_budget = time_budget
self.team = int(player_sequence[0])
self.color = player_sequence[1]
self.board_orientation = int(player_sequence[2])
self.tile_width = tile_width
self.tile_height = tile_height
self.next_move = ((0,0), (0,0))
def run(self):
self.next_move = self.ai_func(self.player_sequence,
np.copy(self.board),
self.time_budget,
tile_width=self.tile_width,
tile_height=self.tile_height)