Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions axelrod/strategies/_strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
TF2,
TF3,
EvolvedFSM4,
EvolvedFSM6,
EvolvedFSM16,
EvolvedFSM16Noise05,
Fortress3,
Expand Down Expand Up @@ -337,6 +338,7 @@
EvolvedFSM16,
EvolvedFSM16Noise05,
EvolvedFSM4,
EvolvedFSM6,
EvolvedHMM5,
EvolvedLookerUp1_1_1,
EvolvedLookerUp2_2_2,
Expand Down
45 changes: 45 additions & 0 deletions axelrod/strategies/finite_state_machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,3 +1024,48 @@ def __init__(self) -> None:
super().__init__(
transitions=transitions, initial_state=0, initial_action=C
)


class EvolvedFSM6(FSMPlayer):
"""
An 6 state FSM player trained with an evolutionary algorithm.

Evolved using axelrod-dojo version 0.0.8 and axelrod version 4.10.0, trained to maximize score against
the short_run_time_strategies with 10 machine states for 500 generations,population size of 40,
mutation rate at 0.1, bottleneck at 10, 200 turns, and 0 noise. The resulting strategy had only 6
states in its accessible component.

Names:

- Evolved FSM 6: Original name by Frederick Vincent & Dashiell Fryer
"""

name = "Evolved FSM 6"
classifier = {
"memory_depth": float("inf"),
"stochastic": False,
"long_run_time": False,
"inspects_source": False,
"manipulates_source": False,
"manipulates_state": False,
}

def __init__(self) -> None:
transitions = (
(2, C, 2, D),
(2, D, 7, D),
(3, C, 6, D),
(3, D, 4, C),
(4, C, 4, C),
(4, D, 6, D),
(5, C, 2, D),
(5, D, 7, D),
(6, C, 3, C),
(6, D, 5, D),
(7, C, 2, C),
(7, D, 3, D),
)

super().__init__(
transitions=transitions, initial_state=4, initial_action=C
)
20 changes: 20 additions & 0 deletions axelrod/tests/strategies/test_finite_state_machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,26 @@ def test_strategy(self):
self.versus_test(axl.Alternator(), expected_actions=actions)


class TestEvolvedFSM6(TestFSMPlayer):

name = "Evolved FSM 6"
player = axl.EvolvedFSM6
expected_classifier = {
"memory_depth": float("inf"),
"stochastic": False,
"makes_use_of": set(),
"long_run_time": False,
"inspects_source": False,
"manipulates_source": False,
"manipulates_state": False,
}

def test_strategy(self):
player = self.player()
self.assertEqual(player.initial_state, 4)
self.assertEqual(player.initial_action, C)


class TestEvolvableFSMPlayer(unittest.TestCase):

player_class = EvolvableFSMPlayer
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Count the number of available players::

>>> import axelrod as axl
>>> len(axl.strategies)
237
238

Create matches between two players::

Expand Down