Logo Search packages:      
Sourcecode: uligo version File versions  Download package

def board1::abstractBoard::legal (   self,
  pos,
  color 
) [inherited]

Check if a play by color at pos would be a legal move. 

Definition at line 92 of file board1.py.

00092                                :
        """ Check if a play by color at pos would be a legal move. """
        c = [] # captured stones
        for x in self.neighbors(pos):
            if self.status.has_key(x) and self.status[x]==self.invert(color):
                c = c + self.hasNoLibExcP(x, pos)        

        self.status[pos]=color

        if c:
            captures = []
            for x in c:
                if not x in captures: captures.append(x)
            return (1, captures)

        if self.hasNoLibExcP(pos):
            del self.status[pos]
            return 0
        else: return (1, [])

    def hasNoLibExcP(self, pos, exc = None):


Generated by  Doxygen 1.6.0   Back to index