~parcheesi-team/parcheese/master

« back to all changes in this revision

Viewing changes to src/core/square.py

  • Committer: neonigma
  • Date: 2011-06-25 15:20:11 UTC
  • Revision ID: neonigma@gmail.com-20110625152011-5ypiqt77x4ti0lpb
Done rule [R07], difference between barriers, check when UI is ready

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
# Copyright 2011 Parcheese Team.
4
4
# Author: J. Ignacio Alvarez <neonigma@gmail.com>
 
5
# Author: Luis Diaz Mas <piponazo@gmail.com>
5
6
# Author: Edorta Garcia Gonzalez <edortagarcia@gmail.com>
6
7
#
7
8
# Parcheese is free software; you can redistribute it and/or
17
18
# You should have received a copy of the GNU Lesser General Public
18
19
# License along with Parcheese. If not, see <http://www.gnu.org/licenses/>.
19
20
 
 
21
import logging
 
22
 
20
23
 
21
24
class Square:
22
25
    """ Represent a square of the board. """
36
39
        """ Change the status of the Set this square as blocked """
37
40
        assert(type(val) == bool)
38
41
        self.locked = val
 
42
        if val == True:
 
43
            logging.info("Square %s locked!", self.squareId)
 
44
        else:
 
45
            logging.info("Square %s unlocked!", self.squareId)
39
46
 
40
47
    def isLocked(self):
41
48
        """ Get if this square is locked """
45
52
        """ Add a checker to this square"""
46
53
        self.checkers.append(chk)
47
54
        chk.setSquare(self)
48
 
        if len(self.checkers) == 2:
49
 
            self.setLock(True) # lock this square
50
55
 
51
56
    def popChecker(self, chk):
52
57
        """ Remove and existing checker from the list of checkers """