mirror of
https://github.com/jjaldridge2009/Project_Xs.git
synced 2024-10-05 14:57:12 +02:00
Update wild.py
This commit is contained in:
parent
774996f9ae
commit
e86faca452
18
src/wild.py
18
src/wild.py
@ -4,12 +4,14 @@ import cv2
|
|||||||
import time
|
import time
|
||||||
from xorshift import Xorshift
|
from xorshift import Xorshift
|
||||||
|
|
||||||
|
imgpath = "./trainer/trophygarden/eye.png"
|
||||||
|
|
||||||
def expr():
|
def expr():
|
||||||
player_eye = cv2.imread("./trainer/ruins/eye.png", cv2.IMREAD_GRAYSCALE)
|
player_eye = cv2.imread(imgpath, cv2.IMREAD_GRAYSCALE)
|
||||||
if player_eye is None:
|
if player_eye is None:
|
||||||
print("path is wrong")
|
print("path is wrong")
|
||||||
return
|
return
|
||||||
blinks, intervals, offset_time = rngtool.tracking_blink(player_eye, 910, 485, 50, 60)
|
blinks, intervals, offset_time = rngtool.tracking_blink(player_eye, 930, 510, 30, 30)
|
||||||
prng = rngtool.recov(blinks, intervals)
|
prng = rngtool.recov(blinks, intervals)
|
||||||
|
|
||||||
waituntil = time.perf_counter()
|
waituntil = time.perf_counter()
|
||||||
@ -39,11 +41,11 @@ def expr():
|
|||||||
time.sleep(next_time)
|
time.sleep(next_time)
|
||||||
|
|
||||||
def firstspecify():
|
def firstspecify():
|
||||||
player_eye = cv2.imread("./trainer/ruins/eye.png", cv2.IMREAD_GRAYSCALE)
|
player_eye = cv2.imread(imgpath, cv2.IMREAD_GRAYSCALE)
|
||||||
if player_eye is None:
|
if player_eye is None:
|
||||||
print("path is wrong")
|
print("path is wrong")
|
||||||
return
|
return
|
||||||
blinks, intervals, offset_time = rngtool.tracking_blink(player_eye, 910, 485, 50, 60)
|
blinks, intervals, offset_time = rngtool.tracking_blink(player_eye, 930, 510, 30, 30)
|
||||||
prng = rngtool.recov(blinks, intervals)
|
prng = rngtool.recov(blinks, intervals)
|
||||||
|
|
||||||
waituntil = time.perf_counter()
|
waituntil = time.perf_counter()
|
||||||
@ -60,16 +62,16 @@ def reidentify():
|
|||||||
print("input xorshift state(state[0] state[1] state[2] state[3])")
|
print("input xorshift state(state[0] state[1] state[2] state[3])")
|
||||||
state = [int(x,0) for x in input().split()]
|
state = [int(x,0) for x in input().split()]
|
||||||
|
|
||||||
player_eye = cv2.imread("./trainer/ruins/eye.png", cv2.IMREAD_GRAYSCALE)
|
player_eye = cv2.imread(imgpath, cv2.IMREAD_GRAYSCALE)
|
||||||
if player_eye is None:
|
if player_eye is None:
|
||||||
print("path is wrong")
|
print("path is wrong")
|
||||||
return
|
return
|
||||||
|
|
||||||
observed_blinks, _, offset_time = rngtool.tracking_blink(player_eye, 910, 485, 50, 60,size=20)
|
observed_blinks, _, offset_time = rngtool.tracking_blink(player_eye, 930, 505, 30, 30,size=20)
|
||||||
reidentified_rng = rngtool.reidentifyByBlinks(Xorshift(*state), observed_blinks)
|
reidentified_rng = rngtool.reidentifyByBlinks(Xorshift(*state), observed_blinks)
|
||||||
|
|
||||||
waituntil = time.perf_counter()
|
waituntil = time.perf_counter()
|
||||||
diff = round(waituntil-offset_time)+1
|
diff = -((waituntil-offset_time)//(-1))
|
||||||
reidentified_rng.getNextRandSequence(diff)
|
reidentified_rng.getNextRandSequence(diff)
|
||||||
|
|
||||||
state = reidentified_rng.getState()
|
state = reidentified_rng.getState()
|
||||||
@ -81,7 +83,7 @@ def reidentify():
|
|||||||
#timecounter reset
|
#timecounter reset
|
||||||
advances = 0
|
advances = 0
|
||||||
wild_prng = Xorshift(*reidentified_rng.getState())
|
wild_prng = Xorshift(*reidentified_rng.getState())
|
||||||
isUnown = True
|
isUnown = False
|
||||||
wild_prng.getNextRandSequence(2+isUnown)
|
wild_prng.getNextRandSequence(2+isUnown)
|
||||||
|
|
||||||
advances = 0
|
advances = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user