Commit 080bcb6a authored by Bruno Coudoin's avatar Bruno Coudoin
Browse files

added goal and manual. Thanks for wikipedia. added missing sudoku improved

	* boards/sudoku.xml.in: added goal and manual. Thanks for wikipedia.
	* po/POTFILES.in: added missing sudoku
	* src/boards/python/sudoku.py: improved colors
	* boards/boardicons/sudoku.png: created by bruno
parent 253b57d3
2005-08-20 Bruno coudoin <bruno.coudoin@free.fr>
* boards/sudoku.xml.in: added goal and manual. Thanks for wikipedia.
* po/POTFILES.in: added missing sudoku
* src/boards/python/sudoku.py: improved colors
* boards/boardicons/sudoku.png: created by bruno
2005-08-20 Bruno coudoin <bruno.coudoin@free.fr>
reviewed by: <delete if not using a buddy>
* boards/sudoku.xml.in:
* src/boards/python/sudoku.py:
2005-08-20 Bruno coudoin <bruno.coudoin@free.fr>
- Included art from Nicu for Mister Potato
......
......@@ -4,15 +4,16 @@
name="sudoku"
type="python:sudoku"
section="/boards"
icon="boardicons/draw.png"
icon="boardicons/sudoku.png"
difficulty="3"
author="Bruno Coudoin (bruno.coudoin@free.fr)"
boarddir="">
<_title>Sudoku</_title>
<_description>Place numbers in a square. Each number must be unique in a raw and in a column</_description>
<_title>Sudoku, place unique numbers in a square.</_title>
<_description>Each number must be unique in a raw,
in a column and in each 3x3 region.</_description>
<_prerequisite></_prerequisite>
<_goal></_goal>
<_manual>
<_goal>The aim of the puzzle is to enter a numeral from 1 through 9 in each cell of a grid, most frequently a 9x9 grid made up of 3x3 subgrids (called 'regions'), starting with various numerals given in some cells (the 'givens'). Each row, column and region must contain only one instance of each numeral. Completing the puzzle requires patience and logical ability (Source http://en.wikipedia.org/wiki/Sudoku)</_goal>
<_manual>Click on an empty square to give it the keyboard focus. Then enter a possible number. GCompris will not let you enter invalid number.
</_manual>
</Board>
</GCompris>
......@@ -168,6 +168,7 @@ boards/searace1player.xml.in
boards/smallnumbers.xml.in
boards/smallnumbers2.xml.in
boards/submarine.xml.in
boards/sudoku.xml.in
boards/superbrain.xml.in
boards/target.xml.in
boards/traffic.xml.in
......
......@@ -45,12 +45,12 @@ class Gcompris_sudoku:
# Holds the coordinate of the current square
self.cursqre = None
self.normal_square_color = 0x5566FFFFL
self.focus_square_color = 0xFF45FFFFL
self.lines_color = 0xCCCCCCFFL
self.normal_square_color = 0xbebbc9ffL
self.focus_square_color = 0x8b83a7ffL
self.lines_color = 0xebe745ffL
self.fixed_number_color = 0x11FF22FFL
self.user_number_color = 0xFFFFFFFFL
self.fixed_number_color = 0xff2100ffL
self.user_number_color = 0x000bffffL
print("Gcompris_sudoku __init__.")
......@@ -107,7 +107,7 @@ class Gcompris_sudoku:
x= x_init + square_width * x + square_width/2,
y= y_init + square_height * y + square_height/2,
text= "",
fill_color_rgba= self.fixed_number_color,
font=gcompris.skin.get_font("gcompris/content"),
)
line_number.append(item)
......@@ -191,8 +191,10 @@ class Gcompris_sudoku:
if(keyval >= gtk.keysyms._1 and
keyval <= gtk.keysyms._9):
utf8char = gtk.gdk.keyval_to_unicode(keyval)
strn = u'%c' % utf8char
if self.is_possible(strn):
self.sudo_number[self.cursqre[0]][self.cursqre[1]].set(
text = strn.encode('UTF-8'),
......@@ -205,13 +207,18 @@ class Gcompris_sudoku:
gcompris.bonus.display(gcompris.bonus.WIN, gcompris.bonus.FLOWER)
else:
# Erase the old number there
if ((keyval == gtk.keysyms.BackSpace) or
(keyval == gtk.keysyms.Delete) or
(keyval == gtk.keysyms.space)):
self.sudo_number[self.cursqre[0]][self.cursqre[1]].set(
text = "",
)
else:
# No key processing done
return False
# Return True if you did process a key
# Return False if you did not processed a key
# (gtk need to send it to next widget)
......@@ -299,6 +306,12 @@ class Gcompris_sudoku:
if(number == othernumber):
return False
#
# Check this number is in a mini sqare
#
# First, find the top-left mini square
return True
# Return True or False if the given sudoku is solved
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment