mirror of
https://github.com/jjaldridge2009/Project_Xs.git
synced 2024-08-16 05:49:39 +02:00
implement reidentify for non manual
This commit is contained in:
parent
3f649bfc2f
commit
0d04e41aa1
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"SysDVR": true,
|
"SysDVR": true,
|
||||||
"image": "./munchlax/eye.png",
|
"image": "./munchlax/eye.png",
|
||||||
"view": [470, 430, 50, 60]
|
"view": [470, 430, 50, 60],
|
||||||
|
"reidentify": ""
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"SysDVR": true,
|
"SysDVR": true,
|
||||||
"image": "./trainer/cave/eye.png",
|
"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,
|
"SysDVR": true,
|
||||||
"image": "./munchlax/eye.png",
|
"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)
|
max_loc = (max_loc[0] + roi_x,max_loc[1] + roi_y)
|
||||||
bottom_right = (max_loc[0] + w, max_loc[1] + h)
|
bottom_right = (max_loc[0] + w, max_loc[1] + h)
|
||||||
cv2.rectangle(frame,max_loc, bottom_right, 255, 2)
|
cv2.rectangle(frame,max_loc, bottom_right, 255, 2)
|
||||||
|
|
||||||
cv2.imshow("view", frame)
|
cv2.imshow("view", frame)
|
||||||
keypress = cv2.waitKey(1)
|
keypress = cv2.waitKey(1)
|
||||||
if keypress == ord('q'):
|
if keypress == ord('q'):
|
||||||
|
41
src/wild.py
41
src/wild.py
@ -20,9 +20,10 @@ def expr():
|
|||||||
|
|
||||||
state = prng.getState()
|
state = prng.getState()
|
||||||
print(hex(state[0]<<32|state[1]), hex(state[2]<<32|state[3]))
|
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
|
advances = 0
|
||||||
|
|
||||||
for _ in range(1000):
|
for _ in range(1000):
|
||||||
advances += 1
|
advances += 1
|
||||||
r = prng.next()
|
r = prng.next()
|
||||||
@ -33,34 +34,16 @@ def expr():
|
|||||||
next_time = waituntil - time.perf_counter() or 0
|
next_time = waituntil - time.perf_counter() or 0
|
||||||
time.sleep(next_time)
|
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():
|
def reidentify():
|
||||||
print("input xorshift state(state[0] state[1] state[2] state[3])")
|
state = [int(x,0) for x in config["reidentify"].split()]
|
||||||
state = [int(x,0) for x in input().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:
|
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, *config["view"], sysdvr=config["SysDVR"], 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()
|
||||||
@ -73,18 +56,11 @@ def reidentify():
|
|||||||
print("state(32bit 32bit 32bit 32bit)")
|
print("state(32bit 32bit 32bit 32bit)")
|
||||||
print(*[hex(s) for s in state])
|
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
|
advances = 0
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
advances += 1
|
advances += 1
|
||||||
r = reidentified_rng.next()
|
r = reidentified_rng.next()
|
||||||
wild_r = wild_prng.next()
|
|
||||||
|
|
||||||
waituntil += 1.018
|
waituntil += 1.018
|
||||||
|
|
||||||
@ -94,4 +70,9 @@ def reidentify():
|
|||||||
time.sleep(next_time)
|
time.sleep(next_time)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
# inp = input("Find State or Reidentify? (S/R): ")
|
||||||
|
inp = "R"
|
||||||
|
if inp == "R":
|
||||||
|
reidentify()
|
||||||
|
else:
|
||||||
expr()
|
expr()
|
@ -1,11 +1,7 @@
|
|||||||
import rngtool
|
import rngtool
|
||||||
import cv2
|
|
||||||
import time
|
import time
|
||||||
import json
|
|
||||||
from xorshift import Xorshift
|
from xorshift import Xorshift
|
||||||
|
|
||||||
config = json.load(open("config.json"))
|
|
||||||
|
|
||||||
def reidentify():
|
def reidentify():
|
||||||
t0 = int(input("input state[0] (state 0/1): 0x"),16)
|
t0 = int(input("input state[0] (state 0/1): 0x"),16)
|
||||||
t1 = int(input("input state[1] (state 0/1): 0x"),16)
|
t1 = int(input("input state[1] (state 0/1): 0x"),16)
|
||||||
|
Loading…
Reference in New Issue
Block a user