Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Archive
gcompris
Commits
4633f9c5
Commit
4633f9c5
authored
Aug 21, 2005
by
Bruno Coudoin
Browse files
Added support for reload
parent
792cd260
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/boards/python/sudoku.py
View file @
4633f9c5
...
...
@@ -81,7 +81,14 @@ class Gcompris_sudoku:
self
.
gcomprisBoard
.
level
=
1
self
.
gcomprisBoard
.
maxlevel
=
len
(
self
.
sudoku
)
self
.
gcomprisBoard
.
sublevel
=
1
gcompris
.
bar_set
(
gcompris
.
BAR_LEVEL
)
pixmap
=
gcompris
.
utils
.
load_pixmap
(
gcompris
.
skin
.
image_to_skin
(
"button_reload.png"
))
if
(
pixmap
):
gcompris
.
bar_set_repeat_icon
(
pixmap
)
gcompris
.
bar_set
(
gcompris
.
BAR_LEVEL
|
gcompris
.
BAR_REPEAT_ICON
)
else
:
gcompris
.
bar_set
(
gcompris
.
BAR_LEVEL
|
gcompris
.
BAR_REPEAT
)
gcompris
.
set_background
(
self
.
gcomprisBoard
.
canvas
.
root
(),
gcompris
.
skin
.
image_to_skin
(
"gcompris-bg.jpg"
))
gcompris
.
bar_set_level
(
self
.
gcomprisBoard
)
...
...
@@ -111,8 +118,7 @@ class Gcompris_sudoku:
def
repeat
(
self
):
print
(
"Gcompris_sudoku repeat."
)
self
.
display_sudoku
(
self
.
sudoku
[
self
.
gcomprisBoard
.
level
-
1
][
self
.
gcomprisBoard
.
sublevel
-
1
])
def
config
(
self
):
print
(
"Gcompris_sudoku config."
)
...
...
@@ -208,6 +214,14 @@ class Gcompris_sudoku:
# return True if continue, False if bail out
def
next_level
(
self
):
# Randomize symbols
for
j
in
range
(
0
,
len
(
self
.
symbols
)):
# Select a random new position to set the J symbol
old_symbol
=
self
.
symbols
[
j
]
new_pos
=
random
.
randint
(
0
,
len
(
self
.
symbols
)
-
1
)
self
.
symbols
[
j
]
=
self
.
symbols
[
new_pos
]
self
.
symbols
[
new_pos
]
=
old_symbol
self
.
display_sudoku
(
self
.
sudoku
[
self
.
gcomprisBoard
.
level
-
1
][
self
.
gcomprisBoard
.
sublevel
-
1
])
return
True
...
...
@@ -461,14 +475,6 @@ class Gcompris_sudoku:
self
.
sudo_size
=
len
(
sudoku
[
0
])
# Randomize symbols
for
j
in
range
(
0
,
len
(
self
.
symbols
)):
# Select a random new position to set the J symbol
old_symbol
=
self
.
symbols
[
j
]
new_pos
=
random
.
randint
(
0
,
len
(
self
.
symbols
)
-
1
)
self
.
symbols
[
j
]
=
self
.
symbols
[
new_pos
]
self
.
symbols
[
new_pos
]
=
old_symbol
if
(
self
.
root_sudo
):
self
.
root_sudo
.
destroy
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment