Skip to content

Commit 55870af

Browse files
committed
style: black format
1 parent 582650c commit 55870af

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

scripts/plot.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ def read_metrics(filename: str) -> pd.DataFrame:
4646
line,
4747
).groups()
4848

49-
data.append({
50-
"episode": int(episode),
51-
"winning_rate": float(winning_rate),
52-
"mean_score": float(mean_score),
53-
"max_tile": int(max_tile),
54-
})
49+
data.append(
50+
{
51+
"episode": int(episode),
52+
"winning_rate": float(winning_rate),
53+
"mean_score": float(mean_score),
54+
"max_tile": int(max_tile),
55+
}
56+
)
5557

5658
return pd.DataFrame(data)
5759

src/gymnasium_2048/agents/ntuple/policy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def predict(self, state: np.ndarray) -> int:
9696
:param state: The board state.
9797
:return: Next action to play.
9898
"""
99-
return np.argmax([
100-
self.evaluate(state=state, action=action) for action in range(4)
101-
])
99+
return np.argmax(
100+
[self.evaluate(state=state, action=action) for action in range(4)]
101+
)
102102

103103
@abstractmethod
104104
def save(self, path: str | pathlib.Path | io.BufferedIOBase) -> None:
@@ -207,9 +207,9 @@ def learn(
207207
after_state_tuples = self._get_tuples(state=after_state)
208208
after_state_value = self.net.predict(tuples=after_state_tuples)
209209

210-
next_action = np.argmax([
211-
self.evaluate(state=next_state, action=a) for a in range(4)
212-
])
210+
next_action = np.argmax(
211+
[self.evaluate(state=next_state, action=a) for a in range(4)]
212+
)
213213
next_after_state, next_reward, is_legal = TwentyFortyEightEnv.apply_action(
214214
board=next_state,
215215
action=next_action,

0 commit comments

Comments
 (0)