summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2007-07-24 04:41:00 +0200
committerGuillaume Seguin <guillaume@segu.in>2007-07-24 04:41:00 +0200
commit85e3a8bea71ad0bc26f592f1c3bccace5a96820a (patch)
tree7f17a023c350f0a5998544af9d47401d07f4cde8
parent903c2f089cc8abb1d37dffcde8870cb01048b9a1 (diff)
downloadtictactoe-85e3a8bea71ad0bc26f592f1c3bccace5a96820a.tar.gz
tictactoe-85e3a8bea71ad0bc26f592f1c3bccace5a96820a.tar.bz2
* Add O and X
-rwxr-xr-xtictactoe.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tictactoe.py b/tictactoe.py
index dd18183..0597d8d 100755
--- a/tictactoe.py
+++ b/tictactoe.py
@@ -32,6 +32,7 @@ import gtk.glade
import random
import cairo
+from math import pi
def autoconnect (ob):
'''Autoconnect every member from ob to its glade interface'''
@@ -161,6 +162,20 @@ class gtkTicTacToe (gtk.DrawingArea):
cr.rectangle (cell_side * i, cell_side * j,
cell_side, cell_side)
cr.fill ()
+ cr.set_source_rgb (0, 0, 0)
+ if self._map[i][j] == PLAYER_ID:
+ cr.move_to (cell_side * i + 5, cell_side * j + 5)
+ cr.line_to (cell_side * (i + 1) - 5,
+ cell_side * (j + 1) - 5)
+ cr.move_to (cell_side * (i + 1) - 5, cell_side * j + 5)
+ cr.line_to (cell_side * i + 5, cell_side * (j + 1) - 5)
+ cr.stroke ()
+ else:
+ cr.arc (cell_side * (i + 0.5),
+ cell_side * (j + 0.5),
+ cell_side * 0.5 - 5,
+ 0, 2 * pi)
+ cr.stroke ()
# Draw borders
cr.set_source_rgb (0, 0, 0)
cr.move_to (cell_side, 0)