From: Brett K. <in...@us...> - 2005-08-11 00:30:37
|
Update of /cvsroot/wtfibs/WTFibs/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31222/src Modified Files: Backgammon.py Log Message: More tests, added isValidDestination to BoardPoint Index: Backgammon.py =================================================================== RCS file: /cvsroot/wtfibs/WTFibs/src/Backgammon.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Backgammon.py 11 Aug 2005 00:08:16 -0000 1.5 +++ Backgammon.py 11 Aug 2005 00:30:28 -0000 1.6 @@ -69,6 +69,19 @@ else: return None + def isValidDestination(self,color): + """Checks to see if a checker of 'color' can land here legally""" + if color == "White": + if len([x for x in self.checkers if x.color == "Black"]) > 1: + return False + else: + return True + elif color == "Black": + if len([x for x in self.checkers if x.color == "White"]) > 1: + return False + else: + return True + class Die(object): """Represents a single die""" def __init__(self, sides=6): |