39 lines
842 B
Python
39 lines
842 B
Python
from Field_Representation import Field
|
|
from time import time
|
|
import cv2 as cv
|
|
import keyboard
|
|
|
|
def run():
|
|
field = Field()
|
|
loop_time_p = time()
|
|
pause = True
|
|
|
|
while True:
|
|
if keyboard.is_pressed('p') == True:
|
|
pause = True
|
|
print('q pressed')
|
|
elif keyboard.is_pressed('o') == True:
|
|
pause = False
|
|
print('o pressed')
|
|
|
|
if pause:
|
|
# cv.waitKey(500)
|
|
if (time() - loop_time_p) >= 5:
|
|
loop_time_p = time()
|
|
print("pausing")
|
|
continue
|
|
|
|
|
|
cords, screenshot = field.get_current_board_state()
|
|
field.analyse_boardstate(cords)
|
|
print(cords)
|
|
cv.waitKey(1000)
|
|
|
|
|
|
#cv.imshow("screenshot", screenshot)
|
|
#cv.waitKey(150)
|
|
#print(cords)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run() |