Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/boardwidget.py
diff options
context:
space:
mode:
Diffstat (limited to 'boardwidget.py')
-rwxr-xr-xboardwidget.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/boardwidget.py b/boardwidget.py
index 95e19fd..4ea9cdd 100755
--- a/boardwidget.py
+++ b/boardwidget.py
@@ -99,8 +99,13 @@ class BoardWidget(gtk.EventBox):
assert y < self.myBoard.size
self.myBoard.setPointi( x, y, color )
+ self.update_score(self.myBoard.score)
return None
-
+
+ def update_score(self, score):
+ if score == 0:
+ return 0
+ self.activity.info_panel.show_score(_("Score is: Whites %(W)d - Blacks %(B)d" % score))
# def remove(self, column, value):
# """Return:
@@ -215,14 +220,20 @@ class BoardWidget(gtk.EventBox):
boolean check if the stone play is legal
"""
if self.myBoard.status.has_key( (x,y) ) :
+ self.activity.info_panel.show(_("There already is a stone there!"))
return False
c = 'W'
if self.lastColor is 1 :
c = 'B'
-# if not self.myBoard.legal( (x,y), c ) :
-# return False
+ if not self.myBoard.legal( (x,y), c ) :
+ self.activity.info_panel.show(_("Illegal move"))
+ return False
+
+ if self.myBoard.checkKo( (x, y), c):
+ self.activity.info_panel.show(_("Ko violation!"))
+ return False
logger.debug( " returning legal ")
return True