added farm bot

fixed magic needles
This commit is contained in:
2022-10-05 13:01:33 +02:00
parent 728baa010b
commit 8aa44a7f90
24 changed files with 511 additions and 0 deletions

39
farm/main_farm.py Normal file
View File

@@ -0,0 +1,39 @@
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()