Skip to content

Commit 210b0a9

Browse files
style: apply ruff format to evolution_of_trust game files
1 parent b9a6530 commit 210b0a9

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

packages/gds-examples/games/evolution_of_trust/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
# Payoff parameters — Nicky Case's version: T > R > P > S, 2R > T + S
4141
# ======================================================================
4242

43-
R = 2 # Reward (mutual cooperation)
44-
T = 3 # Temptation (defect while other cooperates)
43+
R = 2 # Reward (mutual cooperation)
44+
T = 3 # Temptation (defect while other cooperates)
4545
S = -1 # Sucker (cooperate while other defects)
46-
P = 0 # Punishment (mutual defection)
46+
P = 0 # Punishment (mutual defection)
4747

4848
# ======================================================================
4949
# Atomic Games — OGS primitives

packages/gds-examples/games/evolution_of_trust/strategies.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ class GrimTrigger:
9999

100100
name = "Grim Trigger"
101101
description = (
102-
"Cooperates until opponent defects once, "
103-
"then defects forever. Unforgiving."
102+
"Cooperates until opponent defects once, then defects forever. Unforgiving."
104103
)
105104

106105
def __init__(self) -> None:
@@ -134,7 +133,10 @@ class Detective:
134133
)
135134

136135
_probe_sequence: ClassVar[list[str]] = [
137-
COOPERATE, DEFECT, COOPERATE, COOPERATE,
136+
COOPERATE,
137+
DEFECT,
138+
COOPERATE,
139+
COOPERATE,
138140
]
139141

140142
def __init__(self) -> None:

packages/gds-examples/games/evolution_of_trust/test_model.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,11 @@ def test_noise_flips_actions(self):
319319

320320
rng = _random.Random(42)
321321
result = play_match(
322-
AlwaysCooperate(), AlwaysCooperate(),
323-
rounds=10, noise=1.0, rng=rng,
322+
AlwaysCooperate(),
323+
AlwaysCooperate(),
324+
rounds=10,
325+
noise=1.0,
326+
rng=rng,
324327
)
325328
# With noise=1.0, cooperate flips to defect
326329
defects = sum(1 for a, b in result.history if a == DEFECT or b == DEFECT)

0 commit comments

Comments
 (0)