-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathALEPlayer.py
More file actions
35 lines (28 loc) · 824 Bytes
/
ALEPlayer.py
File metadata and controls
35 lines (28 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import time
from random import randrange
import random
import BaseROM
from ALEWrapper import ALEWrapper
class ALEPlayer:
ale = None
reward = 0
actions = []
actionHistory = []
time = None
depth = 0
originalState = None
rom = None
def __init__(self, rom: BaseROM):
self.rom = rom
self.ale = ALEWrapper()
self.ale.set_repeat_action()
self.ale.set_seed(random.randint(0, 99999))
self.ale.load_rom(rom)
self.actions = self.ale.get_minimal_actions()
self.originalState = self.ale.copy_system_state()
def __str__(self):
return "reward: {}, depth: {}, gameover: {}, state: {}".format(self.reward, self.depth, self.isGameOver(False), self.originalState)
def act(self):
return
def run(self):
return