mirror of
https://github.com/jjaldridge2009/Project_Xs.git
synced 2024-10-05 14:57:12 +02:00
implement reidentify for non manual
This commit is contained in:
parent
3f649bfc2f
commit
0d04e41aa1
@ -1,5 +1,6 @@
|
||||
{
|
||||
"SysDVR": true,
|
||||
"image": "./munchlax/eye.png",
|
||||
"view": [470, 430, 50, 60]
|
||||
"view": [470, 430, 50, 60],
|
||||
"reidentify": ""
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"SysDVR": true,
|
||||
"image": "./trainer/cave/eye.png",
|
||||
"view": [620, 340, 20, 20]
|
||||
"view": [620, 340, 20, 20],
|
||||
"reidentify": "0x37a35d28 0x488e6831 0xb7f56519 0x79a3b387"
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
"SysDVR": true,
|
||||
"image": "./munchlax/eye.png",
|
||||
"view": [470, 430, 50, 60]
|
||||
"view": [470, 430, 50, 60],
|
||||
"reidentify": ""
|
||||
}
|
@ -89,7 +89,6 @@ def tracking_blink(img, roi_x, roi_y, roi_w, roi_h, th = 0.9, size = 40, sysdvr
|
||||
max_loc = (max_loc[0] + roi_x,max_loc[1] + roi_y)
|
||||
bottom_right = (max_loc[0] + w, max_loc[1] + h)
|
||||
cv2.rectangle(frame,max_loc, bottom_right, 255, 2)
|
||||
|
||||
cv2.imshow("view", frame)
|
||||
keypress = cv2.waitKey(1)
|
||||
if keypress == ord('q'):
|
||||
|
43
src/wild.py
43
src/wild.py
@ -20,9 +20,10 @@ def expr():
|
||||
|
||||
state = prng.getState()
|
||||
print(hex(state[0]<<32|state[1]), hex(state[2]<<32|state[3]))
|
||||
print("state(32bit 32bit 32bit 32bit)")
|
||||
print(*[hex(s) for s in state])
|
||||
|
||||
advances = 0
|
||||
|
||||
for _ in range(1000):
|
||||
advances += 1
|
||||
r = prng.next()
|
||||
@ -33,34 +34,16 @@ def expr():
|
||||
next_time = waituntil - time.perf_counter() or 0
|
||||
time.sleep(next_time)
|
||||
|
||||
def firstspecify():
|
||||
player_eye = cv2.imread("./trainer/ruins/eye.png", cv2.IMREAD_GRAYSCALE)
|
||||
if player_eye is None:
|
||||
print("path is wrong")
|
||||
return
|
||||
blinks, intervals, offset_time = rngtool.tracking_blink(player_eye, 910, 485, 50, 60)
|
||||
prng = rngtool.recov(blinks, intervals)
|
||||
|
||||
waituntil = time.perf_counter()
|
||||
diff = round(waituntil-offset_time)
|
||||
prng.getNextRandSequence(diff)
|
||||
|
||||
state = prng.getState()
|
||||
print("state(64bit 64bit)")
|
||||
print(hex(state[0]<<32|state[1]), hex(state[2]<<32|state[3]))
|
||||
print("state(32bit 32bit 32bit 32bit)")
|
||||
print(*[hex(s) for s in state])
|
||||
|
||||
def reidentify():
|
||||
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 config["reidentify"].split()]
|
||||
print("base state:", [hex(x) for x in state])
|
||||
|
||||
player_eye = cv2.imread("./trainer/ruins/eye.png", cv2.IMREAD_GRAYSCALE)
|
||||
player_eye = cv2.imread(config["image"], cv2.IMREAD_GRAYSCALE)
|
||||
if player_eye is None:
|
||||
print("path is wrong")
|
||||
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, *config["view"], sysdvr=config["SysDVR"], size=20)
|
||||
reidentified_rng = rngtool.reidentifyByBlinks(Xorshift(*state), observed_blinks)
|
||||
|
||||
waituntil = time.perf_counter()
|
||||
@ -73,18 +56,11 @@ def reidentify():
|
||||
print("state(32bit 32bit 32bit 32bit)")
|
||||
print(*[hex(s) for s in state])
|
||||
|
||||
#timecounter reset
|
||||
advances = 0
|
||||
wild_prng = Xorshift(*reidentified_rng.getState())
|
||||
isUnown = True
|
||||
wild_prng.getNextRandSequence(2+isUnown)
|
||||
|
||||
advances = 0
|
||||
|
||||
while True:
|
||||
advances += 1
|
||||
r = reidentified_rng.next()
|
||||
wild_r = wild_prng.next()
|
||||
|
||||
waituntil += 1.018
|
||||
|
||||
@ -94,4 +70,9 @@ def reidentify():
|
||||
time.sleep(next_time)
|
||||
|
||||
if __name__ == "__main__":
|
||||
expr()
|
||||
# inp = input("Find State or Reidentify? (S/R): ")
|
||||
inp = "R"
|
||||
if inp == "R":
|
||||
reidentify()
|
||||
else:
|
||||
expr()
|
@ -1,11 +1,7 @@
|
||||
import rngtool
|
||||
import cv2
|
||||
import time
|
||||
import json
|
||||
from xorshift import Xorshift
|
||||
|
||||
config = json.load(open("config.json"))
|
||||
|
||||
def reidentify():
|
||||
t0 = int(input("input state[0] (state 0/1): 0x"),16)
|
||||
t1 = int(input("input state[1] (state 0/1): 0x"),16)
|
||||
|
Loading…
Reference in New Issue
Block a user