def right(self): if random.randrange(0, 3) == 1: press_key(W) else: release_key(W) press_key(D) release_key(A) release_key(S)
def reset(self): shift = 0x2A f = 0x21 # r = 0x13 release_key(W) release_key(A) release_key(D) press_key(shift) press_key(f) release_key(shift) release_key(f) self.reward -= 1. self.current_screen = None self.done = True for i in list(range(2))[::-1]: print(i + 1) time.sleep(1)
def reverse(self): press_key(S) release_key(A) release_key(W) release_key(D)
def straight(self): press_key(W) release_key(A) release_key(D) release_key(S)