### Tit for Tat, Evolution, Game Theory and the Python Axelrod Library pip install axelrod [@drvinceknight](https://twitter.com/drvinceknight) {[github.com](https://github.com/Axelrod-Python/Axelrod), [gitter.im](https://gitter.im/Axelrod-Python/Axelrod)}/Axelrod-Python/Axelrod

## Themes

reveal.js comes with a few themes built in:
Black (default) - White - League - Sky - Beige - Simple
Serif - Night - Moon - Solarized

- Mathematician;
- PyDiff organiser ([www.pydiff.wales](http://www.pydiff.wales/), [@pydiff](https://twitter.com/pydiff)); - PyCon UK Committee; - PyCon NA Committee; - Sustainable software institute fellow.
$$\begin{pmatrix} 3,3&0,5\\ 5,0&1,1 \end{pmatrix}$$

'This course has taught me to not trust my classmates.'
1. Robert Axelrod
2. 1980a: 14+1 strategies
3. 1980b: 64+1 strategies

TODO: Sacrifice a cat


class TitForTat(Player):
"""A player starts by cooperating and then mimics previous move by opponent."""

name = 'Tit For Tat'
classifier = {
'memory_depth': 1,  # Four-Vector = (1.,0.,1.,0.)
'stochastic': False,
'inspects_source': False,
'manipulates_source': False,
'manipulates_state': False
}

@staticmethod
def strategy(opponent):
return 'D' if opponent.history[-1:] == ['D'] else 'C'


class TestTitForTat(TestPlayer):

name = "Tit For Tat"
player = axelrod.TitForTat
expected_classifier = {
'memory_depth': 1,
'stochastic': False,
'inspects_source': False,
'manipulates_source': False,
'manipulates_state': False
}

def test_strategy(self):
"""Starts by cooperating."""
self.first_play_test(C)

def test_effect_of_strategy(self):
"""Repeats last action of opponent history."""
self.markov_test([C, D, C, D])
self.responses_test([C] * 4, [C, C, C, C], [C])
self.responses_test([C] * 5, [C, C, C, C, D], [D])


class MindBender(MindWarper):
"""
A player that changes the opponent's strategy by modifying the internal
dictionary.
"""

name = 'Mind Bender'
classifier = {
'memory_depth': -10,
'stochastic': False,
'inspects_source': False,
'manipulates_source': True,  # changes what opponent will do
'manipulates_state': False
}

@staticmethod
def strategy(opponent):
opponent.__dict__['strategy'] = lambda opponent: 'C'
return 'D'

http://axelrod-tournament.readthedocs.io/

### Outcomes

@AxelrodPython
https://axelrod-api.eu.aldryn.io/strategies/
pip install axelrod {[github.com](https://github.com/Axelrod-Python/Axelrod), [gitter.im](https://gitter.im/Axelrod-Python/Axelrod)}/Axelrod-Python/Axelrod