Axelrod icon indicating copy to clipboard operation
Axelrod copied to clipboard

Jodoyle29 patch 1

Open jodoyle29 opened this issue 1 year ago • 6 comments

Adding a probabilistic hill climbing algorithm.

This strategy is based on the following assumption: if the opponent is going to defect, it is better to defect. If the opponent is going to confess, it is better to confess. Using a simple probabilistic approach, we can predict the opponents next move and chose to confess/defect accordingly.

jodoyle29 avatar Apr 25 '23 15:04 jodoyle29

Thank you for the feedback. I will make these modifications and work on some tests within the next few days.

jodoyle29 avatar Apr 26 '23 22:04 jodoyle29

I believe I will need some guidance for writing the tests. How can I test for expected behaviour if the behaviour is probability based (I don't know exactly what my strategy will do at each move, I only know what it will probably do)?

jodoyle29 avatar Apr 28 '23 14:04 jodoyle29

You can fix a random seed (or search for seeds) that trigger the expected behaviors. We strive for 100% coverage of the possible behaviors, if possible.

marcharper avatar Apr 29 '23 03:04 marcharper

You can fix a random seed (or search for seeds) that trigger the expected behaviors. We strive for 100% coverage of the possible behaviors, if possible.

You can see an example of this here: https://github.com/Axelrod-Python/Axelrod/blob/dev/axelrod/tests/strategies/test_memorytwo.py#L99 (there are a number of other stochastic strategies throughout the library).

drvinceknight avatar May 01 '23 09:05 drvinceknight

See also the code snippet in #1353

marcharper avatar May 02 '23 04:05 marcharper

See also the code snippet in #1353

Gosh I'd forgotten about that! Yes!!!

drvinceknight avatar May 02 '23 06:05 drvinceknight