From 06340c0d2491c57f5ce825b86d4827e72e79065e Mon Sep 17 00:00:00 2001 From: niart120 <38847256+niart120@users.noreply.github.com> Date: Wed, 5 Jan 2022 00:16:17 +0900 Subject: [PATCH 1/3] Update stationary.py correct implemetation (thank you lincoln!) --- src/stationary.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stationary.py b/src/stationary.py index 07bb8c7..7eaebd7 100644 --- a/src/stationary.py +++ b/src/stationary.py @@ -115,12 +115,12 @@ def stationary_timeline(): #whiteout time.sleep(2) waituntil = time.perf_counter() - print("entered the stationary symbol room") + print("enter the stationary symbol room") queue = [] heapq.heappush(queue, (waituntil+1.017,0)) - #blink_int = reidentified_rng.range(100.0, 370.0)/30 - 0.048 - blink_int = reidentified_rng.rangefloat(100.0, 370.0)/30 - 0.048 + #blink_int = reidentified_rng.range(3.0, 12.0) + 0.3 + blink_int = reidentified_rng.rangefloat(3,12) + 0.3 heapq.heappush(queue, (waituntil+blink_int,1)) while queue: @@ -135,8 +135,8 @@ def stationary_timeline(): print(f"advances:{advances}, blink:{hex(r&0xF)}") heapq.heappush(queue, (w+1.017, 0)) else: - #blink_int = reidentified_rng.range(100.0, 370.0)/30 - 0.048 - blink_int = reidentified_rng.rangefloat(100.0, 370.0)/30 - 0.048 + #blink_int = reidentified_rng.range(3.0, 12.0) + 0.3 + blink_int = reidentified_rng.rangefloat(3,12) + 0.3 heapq.heappush(queue, (w+blink_int, 1)) print(f"advances:{advances}, interval:{blink_int}") From 404a89533c7a1e00994515a8ebe70d262b549705 Mon Sep 17 00:00:00 2001 From: niart120 <38847256+niart120@users.noreply.github.com> Date: Sun, 9 Jan 2022 02:09:23 +0900 Subject: [PATCH 2/3] bugfix fixed to get enough blink to recover --- src/calc.py | 6 +++--- src/rngtool.py | 5 +++-- src/tidsid.py | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/calc.py b/src/calc.py index 367dff6..ee0201b 100644 --- a/src/calc.py +++ b/src/calc.py @@ -45,12 +45,11 @@ def getS_munchlax(intervals): t = getTrans() t_ = getTrans() - s = np.zeros((128,128),"uint8") + s = np.zeros((144,128),"uint8") safe_intervals = [] - for i in range(32): + for i in range(36): #intervals[-1]を挿入した際のインデックスが奇数だと危険な値の可能性がある is_carriable = bisect(section,intervals[-1])%2==1 - while is_carriable: #スキップする t = t@t_%2 @@ -86,6 +85,7 @@ def gauss_jordan(mat,observed:list): res[j],res[pivot] = res[pivot],res[j] if isfound: pivot += 1 + for i in range(c): check = 1<<(c-i-1) assert bitmat[i]&check>0 diff --git a/src/rngtool.py b/src/rngtool.py index 5c64347..25235c6 100644 --- a/src/rngtool.py +++ b/src/rngtool.py @@ -33,7 +33,7 @@ def tracking_blink(img, roi_x, roi_y, roi_w, roi_h, th = 0.9, size = 40)->Tuple[ state = IDLE blinks = [] intervals = [] - prev_time = 0 + prev_time = time.perf_counter() prev_roi = None debug_txt = "" @@ -115,7 +115,8 @@ def tracking_poke_blink(img, roi_x, roi_y, roi_w, roi_h, size = 60)->Tuple[List[ if (roi==prev_roi).all(): continue prev_roi = roi - + cv2.imshow("",roi) + cv2.waitKey(1) res = cv2.matchTemplate(roi,eye,cv2.TM_CCOEFF_NORMED) _, match, _, _ = cv2.minMaxLoc(res) diff --git a/src/tidsid.py b/src/tidsid.py index 771b53d..97916f4 100644 --- a/src/tidsid.py +++ b/src/tidsid.py @@ -29,7 +29,7 @@ def expr(): if munch_eye is None: print("path is wrong") return - gombe_intervals = rngtool.tracking_poke_blink(munch_eye, 730, 670, 50, 60) + gombe_intervals = rngtool.tracking_poke_blink(munch_eye, 730, 670, 50, 60, 64) interval_prng = rngtool.recovByMunchlax(gombe_intervals) state = interval_prng.getState() @@ -38,14 +38,14 @@ def expr(): #timecounter reset advances = 0 id_prng = Xorshift(*interval_prng.getState()) - id_prng.getNextRandSequence(1) + id_prng.next() waituntil = time.perf_counter() #ID予測開始 while True: advances += 1 - r = interval_prng.next() - interval = randrange(r, 100, 370)/30 - 0.048 + interval = interval_prng.rangefloat(3.0,12.0) + 0.285 + #interval = interval_prng.range(3.0,12.0) + 0.285 waituntil += interval id_r = id_prng.next() From 5fbfcba2b5c6c8769f56c8d628606a42d7ad612f Mon Sep 17 00:00:00 2001 From: niart120 <38847256+niart120@users.noreply.github.com> Date: Sun, 9 Jan 2022 02:09:49 +0900 Subject: [PATCH 3/3] Update stationary.py changed pokemon blink interval constant --- src/stationary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stationary.py b/src/stationary.py index 7eaebd7..b3d77b2 100644 --- a/src/stationary.py +++ b/src/stationary.py @@ -135,8 +135,8 @@ def stationary_timeline(): print(f"advances:{advances}, blink:{hex(r&0xF)}") heapq.heappush(queue, (w+1.017, 0)) else: - #blink_int = reidentified_rng.range(3.0, 12.0) + 0.3 - blink_int = reidentified_rng.rangefloat(3,12) + 0.3 + #blink_int = reidentified_rng.range(3.0, 12.0) + 0.285 + blink_int = reidentified_rng.rangefloat(3,12) + 0.285 heapq.heappush(queue, (w+blink_int, 1)) print(f"advances:{advances}, interval:{blink_int}")