Skip to content

Commit

Permalink
Add Type hints to Game (#824)
Browse files Browse the repository at this point in the history
* Add Type hints to Game

* Make changes according to review
  • Loading branch information
souravsingh authored and marcharper committed Jan 18, 2017
1 parent 155332f commit 5bf6f10
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions axelrod/game.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from axelrod import Actions
from typing import Tuple

C, D = Actions.C, Actions.D


class Game(object):
"""A class to hold the game matrix and to score a game accordingly."""

def __init__(self, r=3, s=0, t=5, p=1):
def __init__(self, r: int =3, s: int=0, t: int=5, p:int=1):
self.scores = {
(C, C): (r, r),
(D, D): (p, p),
Expand All @@ -23,7 +24,7 @@ def RPST(self):
T = self.scores[(D, C)][0]
return (R, P, S, T)

def score(self, pair):
def score(self, pair) -> Tuple[int, int]:
"""Return the appropriate score for decision pair.
Returns the appropriate score (as a tuple) from the scores dictionary
Expand Down

0 comments on commit 5bf6f10

Please sign in to comment.