1- from axelrod .actions import Actions
1+ from axelrod .actions import Actions , Action
22from axelrod .player import Player
33
44C , D = Actions .C , Actions .D
@@ -26,13 +26,13 @@ def __init__(self, transitions, initial_state):
2626 for (state , opp_action , next_state , next_action ) in transitions :
2727 self .state_transitions [(state , opp_action )] = (next_state , next_action )
2828
29- def move (self , opponent_action ) :
29+ def move (self , opponent_action : Action ) -> Action :
3030 """Computes the response move and changes state."""
3131 next_state , next_action = self .state_transitions [(self .state , opponent_action )]
3232 self .state = next_state
3333 return next_action
3434
35- def __eq__ (self , other ) :
35+ def __eq__ (self , other : Player ) -> bool :
3636 """Equality of two FSMs"""
3737 check = True
3838 for attr in ["state" , "state_transitions" ]:
@@ -56,7 +56,7 @@ class FSMPlayer(Player):
5656 }
5757
5858 def __init__ (self , transitions = None , initial_state = None ,
59- initial_action = None ):
59+ initial_action = None ) -> None :
6060 if not transitions :
6161 # Tit For Tat
6262 transitions = [(1 , C , 1 , C ), (1 , D , 1 , D )]
@@ -68,7 +68,7 @@ def __init__(self, transitions=None, initial_state=None,
6868 self .initial_action = initial_action
6969 self .fsm = SimpleFSM (transitions , initial_state )
7070
71- def strategy (self , opponent ) :
71+ def strategy (self , opponent : Player ) -> Action :
7272 if len (self .history ) == 0 :
7373 return self .initial_action
7474 else :
@@ -78,7 +78,7 @@ def strategy(self, opponent):
7878 self .state = self .fsm .state
7979 return action
8080
81- def reset (self ):
81+ def reset (self ) -> None :
8282 super ().reset ()
8383 self .fsm .state = self .initial_state
8484 self .state = self .initial_state
@@ -100,7 +100,7 @@ class Fortress3(FSMPlayer):
100100 'manipulates_state' : False
101101 }
102102
103- def __init__ (self ):
103+ def __init__ (self ) -> None :
104104 transitions = (
105105 (1 , D , 2 , D ),
106106 (1 , C , 1 , D ),
@@ -129,7 +129,7 @@ class Fortress4(FSMPlayer):
129129 'manipulates_state' : False
130130 }
131131
132- def __init__ (self ):
132+ def __init__ (self ) -> None :
133133 transitions = (
134134 (1 , C , 1 , D ),
135135 (1 , D , 2 , D ),
@@ -158,7 +158,7 @@ class Predator(FSMPlayer):
158158 'manipulates_state' : False
159159 }
160160
161- def __init__ (self ):
161+ def __init__ (self ) -> None :
162162 transitions = (
163163 (0 , C , 0 , D ),
164164 (0 , D , 1 , D ),
@@ -201,7 +201,7 @@ class Pun1(FSMPlayer):
201201 'manipulates_state' : False
202202 }
203203
204- def __init__ (self ):
204+ def __init__ (self ) -> None :
205205 transitions = (
206206 (1 , C , 2 , C ),
207207 (1 , D , 2 , C ),
@@ -226,7 +226,7 @@ class Raider(FSMPlayer):
226226 'manipulates_state' : False
227227 }
228228
229- def __init__ (self ):
229+ def __init__ (self ) -> None :
230230 transitions = (
231231 (0 , C , 2 , D ),
232232 (0 , D , 2 , D ),
@@ -255,7 +255,7 @@ class Ripoff(FSMPlayer):
255255 'manipulates_state' : False
256256 }
257257
258- def __init__ (self ):
258+ def __init__ (self ) -> None :
259259 transitions = (
260260 (1 , C , 2 , C ),
261261 (1 , D , 3 , C ),
@@ -282,7 +282,7 @@ class SolutionB1(FSMPlayer):
282282 'manipulates_state' : False
283283 }
284284
285- def __init__ (self ):
285+ def __init__ (self ) -> None :
286286 transitions = (
287287 (1 , C , 2 , D ),
288288 (1 , D , 1 , D ),
@@ -309,7 +309,7 @@ class SolutionB5(FSMPlayer):
309309 'manipulates_state' : False
310310 }
311311
312- def __init__ (self ):
312+ def __init__ (self ) -> None :
313313 transitions = (
314314 (1 , C , 2 , C ),
315315 (1 , D , 6 , D ),
@@ -342,7 +342,7 @@ class Thumper(FSMPlayer):
342342 'manipulates_state' : False
343343 }
344344
345- def __init__ (self ):
345+ def __init__ (self ) -> None :
346346 transitions = (
347347 (1 , C , 1 , C ),
348348 (1 , D , 2 , D ),
@@ -373,7 +373,7 @@ class EvolvedFSM4(FSMPlayer):
373373 'manipulates_state' : False
374374 }
375375
376- def __init__ (self ):
376+ def __init__ (self ) -> None :
377377 transitions = (
378378 (0 , C , 0 , C ),
379379 (0 , D , 2 , D ),
@@ -409,7 +409,7 @@ class EvolvedFSM16(FSMPlayer):
409409 'manipulates_state' : False
410410 }
411411
412- def __init__ (self ):
412+ def __init__ (self ) -> None :
413413 transitions = (
414414 (0 , C , 0 , C ),
415415 (0 , D , 12 , D ),
@@ -469,7 +469,7 @@ class EvolvedFSM16Noise05(FSMPlayer):
469469 'manipulates_state' : False
470470 }
471471
472- def __init__ (self ):
472+ def __init__ (self ) -> None :
473473 transitions = (
474474 (0 , C , 8 , C ),
475475 (0 , D , 3 , D ),
0 commit comments