Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/gogame.py
diff options
context:
space:
mode:
Diffstat (limited to 'gogame.py')
-rw-r--r--gogame.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/gogame.py b/gogame.py
index ce674f2..acc1921 100644
--- a/gogame.py
+++ b/gogame.py
@@ -135,7 +135,16 @@ class GoGame:
def illegal(self, x, y, color):
""" Check if a play by color at pos would be an illigal move, and return pretty errors"""
if self.status.has_key((x, y)):
- return _('There already is a stone there!')
+ if self.status[(x,y)] == 'X':
+ del self.status[(x,y)]
+ elif self.status[(x,y)] == 'T':
+ del self.status[(x,y)]
+ elif self.status[(x,y)] == 'C':
+ del self.status[(x,y)]
+ elif self.status[(x,y)] == 'S':
+ del self.status[(x,y)]
+ else:
+ return _('There already is a stone there!')
if self.checkKo((x, y), color):
return _('Ko violation!')
@@ -175,6 +184,8 @@ class GoGame:
for y in self.neighbors(x):
if not self.status.has_key(y) and y != exc and y != pos: # found a liberty
return []
+ elif self.status.has_key(y) and (self.status[y] == 'X' or self.status[y] == 'C' or self.status[y] == 'T' or self.status[y] == 'S'):
+ return []
elif self.status.has_key(y) and self.status[y]==color \
and not y in newlyFound and not y in st: # found another stone of same color
n.append(y)