Skip to content

Commit a2e9abb

Browse files
Simplify state db (#11)
* Simplifying state database * Fixing example formatting * Fixing style * Fixing test
1 parent 370b8ca commit a2e9abb

File tree

563 files changed

+223509
-197925
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

563 files changed

+223509
-197925
lines changed

.jaffarFormatter.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import json
2+
import sys
3+
from pprint import pprint
4+
5+
with open(sys.argv[1]) as f:
6+
d = json.load(f)
7+
if "Engine Configuration" in d:
8+
e = d["Engine Configuration"]
9+
if "State Database" in e:
10+
del d["Engine Configuration"]["State Database"]
11+
d["Engine Configuration"]["State Database"] = dict( { ("Max Size (Mb)", 1000) } )
12+
json_str = json.dumps(d, indent=4)
13+
14+
with open(sys.argv[1], "w") as f:
15+
f.write(json_str)
16+
+100-142
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,103 @@
11
{
2-
"Driver Configuration":
3-
{
4-
"End On First Win State": true,
5-
"Max Steps": 1000,
6-
7-
"Save Intermediate Results":
8-
{
9-
"Enabled": true,
10-
"Frequency (s)": 1.0,
11-
"Best Solution Path": "/tmp/jaffar.best.sol",
12-
"Worst Solution Path": "/tmp/jaffar.worst.sol",
13-
"Best State Path": "/tmp/jaffar.best.state",
14-
"Worst State Path": "/tmp/jaffar.worst.state"
15-
}
16-
},
17-
18-
"Engine Configuration":
19-
{
20-
"State Database":
21-
{
22-
"Type": "Numa Aware",
23-
"Max Size per NUMA Domain (Mb)":
24-
[
25-
50,
26-
50
27-
],
28-
29-
"Scavenger Queues Size": 32,
30-
"Scavenging Depth": 32,
31-
32-
"Compression":
33-
{
34-
"Use Differential Compression": false,
35-
"Max Difference (bytes)": 6000,
36-
"Use Zlib Compression": false
37-
}
38-
},
39-
40-
"Hash Database":
41-
{
42-
"Max Store Count": 2,
43-
"Max Store Size (Mb)": 10000
44-
}
45-
},
46-
47-
"Emulator Configuration":
48-
{
49-
"Emulator Name": "Atari2600Hawk",
50-
"Rom File Path": "../../../extern/jaffarPlus/extern/atari2600Hawk/tests/roms/hellway.a26",
51-
"Rom File SHA1": "8C209A10CCF24194CB888D5E750CF303AD050EF7",
52-
"Initial Sequence File Path": "stage01.a2600hawk.initial.sol",
53-
"Controller 1 Type": "Gamepad",
54-
"Controller 2 Type": "None",
55-
"Disabled State Properties": [ ]
56-
},
57-
58-
"Runner Configuration":
59-
{
60-
"Bypass Hash Calculation": false,
61-
"Frameskip Rate": 0,
62-
"Hash Step Tolerance": 4,
63-
"Show Empty Input Slots": true,
64-
"Show Allowed Inputs": true,
65-
66-
"Store Input History":
67-
{
68-
"Enabled": true,
69-
"Max Size": 1000
70-
},
71-
72-
"Allowed Input Sets":
73-
[
74-
{
75-
"Conditions":
76-
[
77-
],
78-
79-
"Inputs":
80-
[
81-
"|.....|...RB|",
82-
"|.....|..L.B|"
83-
],
84-
85-
"Stop Input Evaluation": false
86-
}
87-
],
88-
89-
"Test Candidate Inputs": false,
90-
"Candidate Input Sets": [ ]
91-
},
92-
93-
"Game Configuration":
94-
{
95-
"Game Name": "A2600 / Hellway",
96-
"Frame Rate": 60.10,
97-
"Last Input Step Reward": 0.0,
98-
99-
"Print Properties":
100-
[
101-
"Score",
102-
"Car State",
103-
"SubDistance"
104-
],
105-
106-
"Hash Properties":
107-
[
108-
"Score",
109-
"Car State"
110-
],
111-
112-
"Rules":
113-
[
114-
{
115-
"Label": 1998,
116-
"Conditions":
117-
[
118-
{ "Property": "Score", "Op": ">=", "Value": 100 }
119-
],
120-
121-
"Satisfies": [ ],
122-
123-
"Actions":
124-
[
125-
{ "Type": "Trigger Win" }
126-
]
2+
"Driver Configuration": {
3+
"End On First Win State": true,
4+
"Max Steps": 1000,
5+
"Save Intermediate Results": {
6+
"Enabled": true,
7+
"Frequency (s)": 1.0,
8+
"Best Solution Path": "/tmp/jaffar.best.sol",
9+
"Worst Solution Path": "/tmp/jaffar.worst.sol",
10+
"Best State Path": "/tmp/jaffar.best.state",
11+
"Worst State Path": "/tmp/jaffar.worst.state"
12+
}
13+
},
14+
"Engine Configuration": {
15+
"Hash Database": {
16+
"Max Store Count": 2,
17+
"Max Store Size (Mb)": 10000
18+
},
19+
"State Database": {
20+
"Max Size (Mb)": 1000
21+
}
22+
},
23+
"Emulator Configuration": {
24+
"Emulator Name": "Atari2600Hawk",
25+
"Rom File Path": "../../../extern/jaffarPlus/extern/atari2600Hawk/tests/roms/hellway.a26",
26+
"Rom File SHA1": "8C209A10CCF24194CB888D5E750CF303AD050EF7",
27+
"Initial Sequence File Path": "stage01.a2600hawk.initial.sol",
28+
"Controller 1 Type": "Gamepad",
29+
"Controller 2 Type": "None",
30+
"Disabled State Properties": []
31+
},
32+
"Runner Configuration": {
33+
"Bypass Hash Calculation": false,
34+
"Frameskip Rate": 0,
35+
"Hash Step Tolerance": 4,
36+
"Show Empty Input Slots": true,
37+
"Show Allowed Inputs": true,
38+
"Store Input History": {
39+
"Enabled": true,
40+
"Max Size": 1000
41+
},
42+
"Allowed Input Sets": [
43+
{
44+
"Conditions": [],
45+
"Inputs": [
46+
"|.....|...RB|",
47+
"|.....|..L.B|"
48+
],
49+
"Stop Input Evaluation": false
50+
}
51+
],
52+
"Test Candidate Inputs": false,
53+
"Candidate Input Sets": []
12754
},
128-
129-
{
130-
"Label": 1999,
131-
"Conditions":
132-
[
133-
{ "Property": "Car State", "Op": "==", "Value": 1 }
134-
],
135-
136-
"Satisfies": [ ],
137-
138-
"Actions":
139-
[
140-
{ "Type": "Trigger Fail" }
141-
]
55+
"Game Configuration": {
56+
"Game Name": "A2600 / Hellway",
57+
"Frame Rate": 60.1,
58+
"Last Input Step Reward": 0.0,
59+
"Print Properties": [
60+
"Score",
61+
"Car State",
62+
"SubDistance"
63+
],
64+
"Hash Properties": [
65+
"Score",
66+
"Car State"
67+
],
68+
"Rules": [
69+
{
70+
"Label": 1998,
71+
"Conditions": [
72+
{
73+
"Property": "Score",
74+
"Op": ">=",
75+
"Value": 100
76+
}
77+
],
78+
"Satisfies": [],
79+
"Actions": [
80+
{
81+
"Type": "Trigger Win"
82+
}
83+
]
84+
},
85+
{
86+
"Label": 1999,
87+
"Conditions": [
88+
{
89+
"Property": "Car State",
90+
"Op": "==",
91+
"Value": 1
92+
}
93+
],
94+
"Satisfies": [],
95+
"Actions": [
96+
{
97+
"Type": "Trigger Fail"
98+
}
99+
]
100+
}
101+
]
142102
}
143-
]
144-
}
145-
}
103+
}

0 commit comments

Comments
 (0)