Commit 29be6a54 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Use a fixed delay instead of looking at moves, gives some hickups but seems to work better overall

parent d37e7b76
...@@ -80,10 +80,11 @@ if __name__ == '__main__': ...@@ -80,10 +80,11 @@ if __name__ == '__main__':
press_keys(win, solution.keys()) press_keys(win, solution.keys())
keys_delay = len(solution.moves) * 2 * KEY_DELAY #keys_delay = len(solution.moves) * 2 * KEY_DELAY
moves_delay = max(0, solution.delay() - keys_delay) #moves_delay = max(0, solution.delay() - keys_delay)
vprint('wait for', moves_delay, 'ms') #vprint('wait for', moves_delay, 'ms')
time.sleep(moves_delay / 1000) #time.sleep(moves_delay / 1000)
time.sleep(0.070)
elif state.nrows() - 2 <= MAX_SPEED_ROWS: elif state.nrows() - 2 <= MAX_SPEED_ROWS:
vprint('no moves, speed up') vprint('no moves, speed up')
press_keys(win, 'l') press_keys(win, 'l')
......
...@@ -90,7 +90,8 @@ class State: ...@@ -90,7 +90,8 @@ class State:
def score(self, points, moves, prev): def score(self, points, moves, prev):
prev_colsize = prev.nrows() - 2 prev_colsize = prev.nrows() - 2
delay = moves_delay(moves) #delay = moves_delay(moves)
delay = len(moves)
# Don't care about defragging for few rows, just score points quickly. # Don't care about defragging for few rows, just score points quickly.
# This saves computation time which in turn makes for nice combos when # This saves computation time which in turn makes for nice combos when
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment