Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-12-07 16:13:35 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-12-07 16:13:35 (GMT)
commit834471044da08a117afe059492d912ce3db1c143 (patch)
treed06a1be1723926866aa055b88dbf55ad050ca2a0
parent397753429a317e5de1b205464ed35bc56fd1d002 (diff)
added bilateral symmetry game
-rw-r--r--ReflectionActivity.py5
-rw-r--r--game.py24
-rw-r--r--icons/new-game-bilateral.svg196
3 files changed, 223 insertions, 2 deletions
diff --git a/ReflectionActivity.py b/ReflectionActivity.py
index 1f42c5e..e4b3361 100644
--- a/ReflectionActivity.py
+++ b/ReflectionActivity.py
@@ -104,6 +104,11 @@ class ReflectionActivity(activity.Activity):
cb_arg='vertical',
tooltip=_('Start a new vertical-reflection game.'))
+ self._new_game_button_b = button_factory(
+ 'new-game-bilateral', self.toolbar, self._new_game_cb,
+ cb_arg='bilateral',
+ tooltip=_('Start a new bilateral-reflection game.'))
+
self.status = label_factory(self.toolbar, '')
if _have_toolbox:
diff --git a/game.py b/game.py
index 138bce4..70ef13c 100644
--- a/game.py
+++ b/game.py
@@ -94,9 +94,12 @@ class Game():
if self._orientation == 'horizontal':
self.hline.hide()
self.vline.set_layer(1000)
- else:
+ elif self._orientation == 'vertical':
self.hline.set_layer(1000)
self.vline.hide()
+ else:
+ self.hline.set_layer(1000)
+ self.vline.set_layer(1000)
# Clear dots
for dot in self._dots:
@@ -107,9 +110,12 @@ class Game():
if self._orientation == 'horizontal':
self._set_label(
_('Click on the dots to make a horizontal reflection.'))
- else:
+ elif self._orientation == 'vertical':
self._set_label(
_('Click on the dots to make a vertical reflection.'))
+ else:
+ self._set_label(
+ _('Click on the dots to make a bilateral reflection.'))
def _initiating(self):
return self._activity.initiating
@@ -157,7 +163,21 @@ class Game():
return False
self._set_label(_('good work'))
return True
+ if self._orientation == 'vertical':
+ for y in range(int(SIX / 2)):
+ for x in range(TEN):
+ if self._dots[y * TEN + x].type != \
+ self._dots[(SIX - y - 1) * TEN + x].type:
+ self._set_label(_('keep trying'))
+ return False
+ self._set_label(_('good work'))
else:
+ for y in range(SIX):
+ for x in range(SIX):
+ if self._dots[y * TEN + x].type != \
+ self._dots[y * TEN + TEN - x - 1].type:
+ self._set_label(_('keep trying'))
+ return False
for y in range(int(SIX / 2)):
for x in range(TEN):
if self._dots[y * TEN + x].type != \
diff --git a/icons/new-game-bilateral.svg b/icons/new-game-bilateral.svg
new file mode 100644
index 0000000..be0d797
--- /dev/null
+++ b/icons/new-game-bilateral.svg
@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="55"
+ height="55"
+ id="svg2">
+ <metadata
+ id="metadata9">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs7" />
+ <path
+ d="m 33.49995,32.607143 a 2.4107143,2.4107143 0 1 1 -0.0172,6.1e-5"
+ id="path6"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 33.49995,26.848214 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path8"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 33.49995,15.330357 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path12"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 33.49995,38.366071 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path14"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 33.49995,9.571428 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path16"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 33.49995,3.8125 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path18"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 45.821378,32.607143 a 2.4107143,2.4107143 0 1 1 -0.0172,6.1e-5"
+ id="path22"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 45.821378,26.848214 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path24"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 45.821378,15.330357 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path28"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 45.821378,38.366071 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path30"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 45.821378,9.571428 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path32"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 45.821378,3.8125 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path34"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 9.017807,32.607143 a 2.4107143,2.4107143 0 1 1 -0.0172,6.1e-5"
+ id="path38"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 9.017807,26.848214 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path40"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 9.017807,15.330357 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path44"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 9.017807,38.366071 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path46"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 9.017807,9.571428 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path48"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 9.017807,3.8125 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path50"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 15.178521,32.607143 a 2.4107143,2.4107143 0 1 1 -0.0172,6.1e-5"
+ id="path54"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 15.178521,26.848214 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path56"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 15.178521,15.330357 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path60"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 15.178521,38.366071 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path62"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 15.178521,9.571428 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path64"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 15.178521,3.8125 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path66"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 21.339235,32.607143 a 2.4107143,2.4107143 0 1 1 -0.0172,6.1e-5"
+ id="path70"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 21.339235,26.848214 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path72"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 21.339235,15.330357 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path76"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 21.339235,38.366071 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path78"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 21.339235,9.571428 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path80"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 21.339235,3.8125 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path82"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 39.660664,32.607143 a 2.4107143,2.4107143 0 1 1 -0.0172,6.1e-5"
+ id="path86"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 39.660664,26.848214 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path88"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 39.660664,15.330357 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path92"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 39.660664,38.366071 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path94"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 39.660664,9.571428 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path96"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 39.660664,3.8125 a 2.4107143,2.4107143 0 1 1 -0.0172,6.2e-5"
+ id="path98"
+ style="fill:#eeeeee;fill-opacity:1;stroke:#eeeeee;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <rect
+ width="3.9826431"
+ height="44.182838"
+ rx="1.8633741"
+ ry="0"
+ x="-25.491322"
+ y="5.4085808"
+ transform="matrix(0,-1,1,0,0,0)"
+ id="rect3174"
+ style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:0.81716114;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <rect
+ width="3.9826431"
+ height="44.182838"
+ rx="1.8633741"
+ ry="0"
+ x="-29.491322"
+ y="-45.984863"
+ transform="scale(-1,-1)"
+ id="rect3174-9"
+ style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-width:0.81716114;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ d="m 40.004296,28.657143 c -1.10877,0 -2.018763,0.909992 -2.018763,2.018761 l 0,4.629689 -3.283849,-3.283849 c -0.784855,-0.783184 -2.043082,-0.78485 -2.826264,0 -0.783183,0.784854 -0.784823,2.069998 0,2.85318 l 3.310766,3.28385 -4.683521,0 c -1.10877,0 -2.018762,0.909991 -2.018762,2.018762 0,1.108769 0.909992,1.991843 2.018762,1.991843 l 4.656605,0 -3.28385,3.283849 c -0.783181,0.784854 -0.784823,2.069999 0,2.85318 0.784855,0.783182 2.07,0.757938 2.85318,-0.02692 l 3.256933,-3.283849 0,4.683524 c 0,1.10877 0.909993,1.991844 2.018763,1.991844 1.108769,0 1.991843,-0.883074 1.991843,-1.991844 l 0,-4.71044 3.337683,3.310765 c 0.784853,0.783182 2.043082,0.784855 2.826262,0 0.783182,-0.784853 0.784858,-2.043082 0,-2.826262 l -3.310765,-3.28385 4.656607,0 c 1.10877,0 1.991844,-0.883074 1.991844,-1.991843 0,-1.108771 -0.883074,-2.018763 -1.991844,-2.018763 l -4.683523,0 3.310765,-3.337683 c 0.783182,-0.784854 0.784857,-2.016165 0,-2.799347 -0.784854,-0.78318 -2.043082,-0.811775 -2.826263,-0.02691 l -3.310766,3.337682 0,-4.656604 c 0,-1.10877 -0.883074,-2.018763 -1.991843,-2.018763 z"
+ id="rect3894"
+ style="fill:#ffffff;fill-opacity:1;stroke:#282828;stroke-width:1.72267997;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+</svg>