Commit 2028fde0 authored by Srishti Sethi's avatar Srishti Sethi

DiceyDicey final refinement

parent a6afa58a
......@@ -29,22 +29,75 @@ import gcompris.bonus
from BrailleChar import *
from gcompris import gcompris_gettext as _
on = 0XFFFFFFFFL
off = 0X00000000L
plus_on = 0XFF0000FFL
minus_on = 0XFF00FFL
mult_on = 0X00FFFFL
div_on = 0x3D59ABL
circle_stroke = "black"
circle_fill = "#660066"
symbol_off = "#DfDfDf"
cell_width = 30
symbol = ['+','_','X',"/"]
random.shuffle(symbol)
color = ["red","green","blue","dark green"]
#Constants Declaration
COLOR_ON = 0XFFFFFFFFL
COLOR_OFF = 0X00000000L
PLUS_COLOR_ON = 0XFF0000FFL
MINUS_COLOR_ON = 0XFF00FFL
MULT_COLOR_ON = 0X00FFFFL
DIV_COLOR_ON = 0x3D59ABL
CIRCLE_STROKE = "black"
CIRCLE_FILL = "#660066"
SYMBOL_OFF = "#DfDfDf"
CELL_WIDTH = 30
SYMBOL = ['+','_','*','/']
COLOR_LIST = ["red","green","blue","dark green"]
#Declaring list of all questions
#used in different levels
PLUS_LIST_LEVEL_ONE_A = [0,1,2]
PLUS_LIST_LEVEL_ONE_B = [0,1,2]
MINUS_LIST_LEVEL_ONE_A = [2,2,2]
MINUS_LIST_LEVEL_ONE_B = [0,1,2]
PLUS_LIST_LEVEL_TWO_A = [3,4,5]
PLUS_LIST_LEVEL_TWO_B = [2,3,4]
MINUS_LIST_LEVEL_TWO_A = [5,5,5]
MINUS_LIST_LEVEL_TWO_B = [3,4,5]
PLUS_LIST_LEVEL_THREE_A = [6,7,8,9]
PLUS_LIST_LEVEL_THREE_B = [6,7,8,9]
MINUS_LIST_LEVEL_THREE_A = [9,9,9]
MINUS_LIST_LEVEL_THREE_B = [6,7,8,9]
MULT_LIST_LEVEL_FOUR_A= [0,1,2]
MULT_LIST_LEVEL_FOUR_B = [0,1,2]
DIV_LIST_LEVEL_FOUR_A = [0,1,2]
DIV_LIST_LEVEL_FOUR_B = [1,2,3]
MULT_LIST_LEVEL_FIVE_A = [3,4,3,4]
MULT_LIST_LEVEL_FIVE_B = [1,2,1,2]
DIV_LIST_LEVEL_FIVE_A = [2,4,6]
DIV_LIST_LEVEL_FIVE_B = [2,2,2]
MULT_LIST_LEVEL_SIX_A = [6,7,8,9]
MULT_LIST_LEVEL_SIX_B = [6,7,8,9]
DIV_LIST_LEVEL_SIX_A = [3,6,9]
DIV_LIST_LEVEL_SIX_B = [3,3,3]
#Shuffling all the lists
random.shuffle(PLUS_LIST_LEVEL_ONE_A)
random.shuffle(PLUS_LIST_LEVEL_ONE_B)
random.shuffle(MINUS_LIST_LEVEL_ONE_B)
random.shuffle(PLUS_LIST_LEVEL_TWO_A)
random.shuffle(PLUS_LIST_LEVEL_TWO_B)
random.shuffle(MINUS_LIST_LEVEL_TWO_A)
random.shuffle(MINUS_LIST_LEVEL_TWO_B)
random.shuffle(PLUS_LIST_LEVEL_THREE_A)
random.shuffle(PLUS_LIST_LEVEL_THREE_B)
random.shuffle(MINUS_LIST_LEVEL_THREE_A)
random.shuffle(MINUS_LIST_LEVEL_THREE_B)
random.shuffle(MULT_LIST_LEVEL_FOUR_A)
random.shuffle(MULT_LIST_LEVEL_FOUR_B)
random.shuffle(DIV_LIST_LEVEL_FOUR_A)
random.shuffle(DIV_LIST_LEVEL_FOUR_B)
random.shuffle(MULT_LIST_LEVEL_FIVE_A)
random.shuffle(MULT_LIST_LEVEL_FIVE_B)
random.shuffle(DIV_LIST_LEVEL_FIVE_A)
random.shuffle(DIV_LIST_LEVEL_FIVE_B)
random.shuffle(MULT_LIST_LEVEL_SIX_A)
random.shuffle(MULT_LIST_LEVEL_SIX_B)
random.shuffle(DIV_LIST_LEVEL_SIX_A)
random.shuffle(DIV_LIST_LEVEL_SIX_B)
random.shuffle(SYMBOL)
x1 = 100
x2 = 300
......@@ -52,6 +105,12 @@ x3 = 340
x4 = 120
x5 = 360
x6 = 400
SIGN_LIST_ONE = ['+','_','+','_']
random.shuffle(SIGN_LIST_ONE)
SIGN_LIST_TWO = ['+','_','*','/']
random.shuffle(SIGN_LIST_TWO)
class Gcompris_dicey_dicey:
"""Empty gcompris python class"""
......@@ -111,96 +170,48 @@ class Gcompris_dicey_dicey:
alignment = pango.ALIGN_CENTER,
font = 'SANS 20'
)
if(self.gcomprisBoard.level == 1 or self.gcomprisBoard.level == 2 or
self.gcomprisBoard.level == 3):
sign = ['+','_']
random.shuffle(sign)
self.random_sign = sign[self.counter]
else :
sign = ['+','_','X','/']
random.shuffle(sign)
self.random_sign = sign[self.counter]
self.display_function(self.gcomprisBoard.level)
def display_function(self,level):
if(level == 1):
"""Taking two random numbers to be displayed on the dice"""
plus_arr_a = [0,1,2]
plus_arr_b = [0,1,2]
minus_arr_a = [2]
minus_arr_b = [0,1,2]
self.dicey_dicey1()
self.calculate(plus_arr_a,plus_arr_b,minus_arr_a,minus_arr_b,
None,None,None,None,level)
self.random_sign = SIGN_LIST_ONE[self.counter]
self.dicey_dicey()
self.calculate(level)
if(level == 2):
plus_arr_a = [3,4,5]
plus_arr_b = [3,4]
minus_arr_a = [5]
minus_arr_b = [3,4,5]
self.dicey_dicey1()
self.calculate(plus_arr_a,plus_arr_b,minus_arr_a,minus_arr_b,
None,None,None,None,level)
self.random_sign = SIGN_LIST_ONE[self.counter]
self.dicey_dicey()
self.calculate(level)
if(level == 3):
plus_arr_a = [6,7,8,9]
plus_arr_b = [6,7,8,9]
minus_arr_a = [9]
minus_arr_b = [6,7,8,9]
self.random_sign = SIGN_LIST_ONE[self.counter]
if(self.random_sign == '+'):
self.dicey_dicey2()
else :
self.dicey_dicey1()
self.calculate(plus_arr_a,plus_arr_b,minus_arr_a,minus_arr_b,
None,None,None,None,level)
else :
self.dicey_dicey()
self.calculate(level)
if(level == 4):
plus_arr_a = [0,1,2]
plus_arr_b = [0,1,2]
minus_arr_a = [2]
minus_arr_b = [0,1,2]
mult_arr_a = [0,1,2]
mult_arr_b = [0,1,2]
div_arr_a = [0,1,2]
div_arr_b = [1,2]
self.dicey_dicey1()
self.dicey_dicey4()
self.calculate(plus_arr_a,plus_arr_b,minus_arr_a,minus_arr_b,
mult_arr_a,mult_arr_b,div_arr_a,div_arr_b,level)
self.random_sign = SIGN_LIST_TWO[self.counter]
self.dicey_dicey()
self.dicey_dicey2()
self.calculate(level)
if(level == 5):
plus_arr_a = [3,4,5]
plus_arr_b = [3,4]
minus_arr_a = [5]
minus_arr_b = [3,4,5]
mult_arr_a = [3,4]
mult_arr_b = [1,2]
div_arr_a = [2,4,6]
div_arr_b = [2]
self.dicey_dicey1()
self.dicey_dicey4()
self.calculate(plus_arr_a,plus_arr_b,minus_arr_a,minus_arr_b,
mult_arr_a,mult_arr_b,div_arr_a,div_arr_b,level)
self.random_sign = SIGN_LIST_TWO[self.counter]
self.dicey_dicey()
self.dicey_dicey2()
self.calculate(level)
if(level == 6):
plus_arr_a = [6,7,8,9]
plus_arr_b = [6,7,8,9]
minus_arr_a = [9]
minus_arr_b = [6,7,8,9]
mult_arr_a = [6,7,8,9]
mult_arr_b = [6,7,8,9]
div_arr_a = [3,6,9]
div_arr_b = [3]
if((self.random_sign == '+') or (self.random_sign == 'X')):
self.random_sign = SIGN_LIST_TWO[self.counter]
if((self.random_sign == '+') or (self.random_sign == '*')):
self.dicey_dicey1()
self.dicey_dicey2()
self.dicey_dicey4()
else:
self.dicey_dicey1()
self.dicey_dicey4()
self.calculate(plus_arr_a,plus_arr_b,minus_arr_a,minus_arr_b,
mult_arr_a,mult_arr_b,div_arr_a,div_arr_b,level)
self.dicey_dicey()
self.dicey_dicey2()
self.calculate(level)
if(level == 1 or level == 2 or level == 3):
gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
......@@ -214,23 +225,51 @@ class Gcompris_dicey_dicey:
ok.connect("button_press_event", self.ok_event,level)
gcompris.utils.item_focus_init(ok, None)
def calculate(self,plus_arr_a,plus_arr_b,minus_arr_a,minus_arr_b,
mult_arr_a,mult_arr_b,div_arr_a,div_arr_b,level):
def calculate(self,level):
if(self.random_sign == '+'):
i = random.choice(plus_arr_a)
j = random.choice(plus_arr_b)
if(level == 1 or level == 4):
i = PLUS_LIST_LEVEL_ONE_A[self.counter]
j = PLUS_LIST_LEVEL_ONE_B[self.counter]
elif(level == 2 or level == 5):
i = PLUS_LIST_LEVEL_TWO_A[self.counter]
j = PLUS_LIST_LEVEL_TWO_B[self.counter]
elif(level == 3 or level == 6):
i = PLUS_LIST_LEVEL_THREE_A[self.counter]
j = PLUS_LIST_LEVEL_THREE_B[self.counter]
self.result = i + j
elif(self.random_sign == '_'):
i = random.choice(minus_arr_a)
j = random.choice(minus_arr_b)
if(level == 1 or level == 4):
i = MINUS_LIST_LEVEL_ONE_A[self.counter]
j = MINUS_LIST_LEVEL_ONE_B[self.counter]
elif(level == 2 or level == 5):
i = MINUS_LIST_LEVEL_TWO_A[self.counter]
j = MINUS_LIST_LEVEL_TWO_B[self.counter]
elif(level == 3 or level == 6):
i = MINUS_LIST_LEVEL_THREE_A[self.counter]
j = MINUS_LIST_LEVEL_THREE_B[self.counter]
self.result = i - j
elif(self.random_sign == 'X'):
i = random.choice(mult_arr_a)
j = random.choice(mult_arr_b)
elif(self.random_sign == '*'):
if(level == 4):
i = MULT_LIST_LEVEL_FOUR_A[self.counter]
j = MULT_LIST_LEVEL_FOUR_B[self.counter]
elif(level == 5):
i = MULT_LIST_LEVEL_FIVE_A[self.counter]
j = MULT_LIST_LEVEL_FIVE_B[self.counter]
elif(level == 6):
i = MULT_LIST_LEVEL_SIX_A[self.counter]
j = MULT_LIST_LEVEL_SIX_B[self.counter]
self.result = i * j
elif(self.random_sign == '/'):
i = random.choice(div_arr_a)
j = random.choice(div_arr_b)
if(level == 4):
i = DIV_LIST_LEVEL_FOUR_A[self.counter]
j = DIV_LIST_LEVEL_FOUR_B[self.counter]
elif(level == 5):
i = DIV_LIST_LEVEL_FIVE_A[self.counter]
j = DIV_LIST_LEVEL_FIVE_B[self.counter]
elif(level == 6):
i = DIV_LIST_LEVEL_SIX_A[self.counter]
j = DIV_LIST_LEVEL_SIX_B[self.counter]
self.result = i / j
if(level ==1 or level == 2):
......@@ -240,9 +279,10 @@ class Gcompris_dicey_dicey:
text=self.random_sign,
anchor = gtk.ANCHOR_CENTER,
font='SANS 25')
BrailleChar(self.rootitem,600,160,70,
'',on,off,circle_fill,circle_stroke,
False,True,False,callback = self.letter_change1)
BrailleChar(self.rootitem,600,160,70,'' ,
COLOR_ON, COLOR_OFF, CIRCLE_FILL,
CIRCLE_STROKE, False, True, False,
callback = self.letter_change1)
self.braille_display(x4,x5,x6,i,j)
if(level == 4 or level == 5):
......@@ -253,8 +293,8 @@ class Gcompris_dicey_dicey:
text='?',
anchor = gtk.ANCHOR_CENTER,
font='SANS 25')
BrailleChar(self.rootitem,600,160,70,
self.result,on,off,circle_fill,circle_stroke,
BrailleChar(self.rootitem,600, 160, 70, self.result,
COLOR_ON,COLOR_OFF,CIRCLE_FILL,CIRCLE_STROKE,
False,False,False,None)
self.text_display()
......@@ -269,17 +309,20 @@ class Gcompris_dicey_dicey:
text=self.random_sign,
anchor = gtk.ANCHOR_CENTER,
font='SANS 25')
braille_cell1 = BrailleChar(self.rootitem,490,160,70,
'',on,off,circle_fill,circle_stroke,
False,True,False,callback = self.letter_change1)
braille_cell2 = BrailleChar(self.rootitem,630,160,70,
'',on,off,circle_fill,circle_stroke,
False,True,False,callback = self.letter_change2)
braille_cell1 = BrailleChar(self.rootitem,490, 160, 70,
'', COLOR_ON, COLOR_OFF, CIRCLE_FILL,
CIRCLE_STROKE, False, True, False,
callback = self.letter_change1)
braille_cell2 = BrailleChar(self.rootitem,630, 160, 70,
'', COLOR_ON, COLOR_OFF, CIRCLE_FILL,
CIRCLE_STROKE, False, True, False,
callback = self.letter_change2)
else :
self.braille_display(x4, x5, x6, i, j)
braille_cell = BrailleChar(self.rootitem,600,160,70,
'',on,off,circle_fill,circle_stroke,
False,True,False,callback = self.letter_change1)
braille_cell = BrailleChar(self.rootitem,600, 160, 70,
'',COLOR_ON, COLOR_OFF, CIRCLE_FILL,
CIRCLE_STROKE, False, True, False,
callback = self.letter_change1)
goocanvas.Text(parent = self.rootitem,
x=280.0,
y=200.0,
......@@ -287,7 +330,7 @@ class Gcompris_dicey_dicey:
anchor = gtk.ANCHOR_CENTER,
font='SANS 25')
elif(level == 6):
if(self.random_sign == '+' or self.random_sign == 'X'):
if(self.random_sign == '+' or self.random_sign == '*'):
goocanvas.Text(parent = self.rootitem,
x=240.0,
y=200.0,
......@@ -310,8 +353,9 @@ class Gcompris_dicey_dicey:
self.text_display()
def result_display(self):
BrailleChar(self.rootitem,600,160,70,self.result,on,off,circle_fill,
circle_stroke,False,False,False,None)
BrailleChar(self.rootitem, 600, 160, 70, self.result,
COLOR_ON, COLOR_OFF, CIRCLE_FILL,
CIRCLE_STROKE, False, False, False, None)
def text_display(self):
......@@ -321,19 +365,21 @@ class Gcompris_dicey_dicey:
def two_cells(self):
self.a1 = self.result / 10
self.a2 = self.result % 10
braille_cell1 = BrailleChar(self.rootitem,490,160,70,
self.a1,on,off,circle_fill,circle_stroke,
False,False,False,callback = self.letter_change1)
braille_cell2 = BrailleChar(self.rootitem,630,160,70,
self.a2,on,off,circle_fill,circle_stroke,
False,False,False,callback = self.letter_change2)
braille_cell1 = BrailleChar(self.rootitem, 490, 160, 70,
self.a1, COLOR_ON, COLOR_OFF, CIRCLE_FILL,
CIRCLE_STROKE, False, False, False,
callback = self.letter_change1)
braille_cell2 = BrailleChar(self.rootitem, 630, 160, 70,
self.a2, COLOR_ON, COLOR_OFF, CIRCLE_FILL,
CIRCLE_STROKE, False, False, False,
callback = self.letter_change2)
def braille_display(self,x4,x5,x6,i,j):
BrailleChar(self.rootitem,x4,160,70, i ,on ,off ,circle_fill,
circle_stroke,False,False ,False,None)
BrailleChar(self.rootitem,x5,160,70,j,on,off,circle_fill,
circle_stroke,False, False, False, None)
goocanvas.Text(parent = self.rootitem, x=140.0,y=330.0,
text="%i" % i,anchor = gtk.ANCHOR_CENTER,
BrailleChar(self.rootitem, x4, 160, 70 , i, COLOR_ON, COLOR_OFF ,
CIRCLE_FILL, CIRCLE_STROKE, False, False ,False, None)
BrailleChar(self.rootitem, x5, 160, 70, j, COLOR_ON, COLOR_OFF ,
CIRCLE_FILL, CIRCLE_STROKE, False, False, False, None)
goocanvas.Text(parent = self.rootitem, x=140.0 ,y=330.0,
text="%i" % i, anchor = gtk.ANCHOR_CENTER,
font='SANS 25')
goocanvas.Text(parent = self.rootitem,
x=x6,y=330.0,
......@@ -341,8 +387,8 @@ class Gcompris_dicey_dicey:
anchor = gtk.ANCHOR_CENTER,
font='SANS 25')
def dicey_dicey1(self):
def dicey_dicey(self):
#Display dices
for index in range(3):
item = goocanvas.Image(parent = self.rootitem,
pixbuf = gcompris.utils.load_pixmap("dicey_dicey/diceyo.svg"),
......@@ -368,7 +414,7 @@ class Gcompris_dicey_dicey:
font='SANS 25')
def dicey_dicey2(self):
def dicey_dicey1(self):
for index in range(3):
item1 = goocanvas.Image(parent = self.rootitem,
pixbuf = gcompris.utils.load_pixmap("dicey_dicey/diceyo.svg"),
......@@ -397,7 +443,7 @@ class Gcompris_dicey_dicey:
anchor = gtk.ANCHOR_CENTER,
font='SANS 25')
def dicey_dicey4(self):
def dicey_dicey2(self):
gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
"dicey_dicey/dice_area.svg")
goocanvas.Text(parent = self.rootitem,
......@@ -418,50 +464,38 @@ class Gcompris_dicey_dicey:
self.cell.append(Item)
gcompris.utils.item_focus_init(Item,None)
"""goocanvas.Text(parent = self.rootitem,
x=(index * 98)+280,
y=455,
text = symbol[index],
fill_color = color[index],
anchor = gtk.ANCHOR_CENTER,
font='SANS 28')"""
if(symbol[index] == '+'):
BrailleChar(self.rootitem,(index*98)+255,375,50,
'+',plus_on,off,symbol_off,circle_fill,
False,False,False,None)
elif(symbol[index] == '_'):
BrailleChar(self.rootitem,(index*98)+255,375,50,'_',
minus_on,off,symbol_off,circle_fill,
False,False,False,None)
elif(symbol[index] == 'X'):
BrailleChar(self.rootitem,(index*98)+237,375,50,
'.',mult_on,off,symbol_off,circle_fill,
False,False,False,None)
BrailleChar(self.rootitem,((index*98)+237)+34,375,50,
'X',mult_on,off,symbol_off,circle_fill,
False,False,False,None)
elif(symbol[index] == '/'):
BrailleChar(self.rootitem,(index*98)+237,375,50,
'/',div_on,off,symbol_off,circle_fill,
False,False,False,None)
BrailleChar(self.rootitem,((index*98)+237)+34,375,50,
'-',div_on,off,symbol_off,circle_fill,
False,False,False,None)
if(SYMBOL[index] == '+'):
COLOR_LIST = PLUS_COLOR_ON
self.braille_math_symbol(index,COLOR_LIST)
elif(SYMBOL[index] == '_'):
COLOR_LIST = MINUS_COLOR_ON
self.braille_math_symbol(index,COLOR_LIST)
elif(SYMBOL[index] == '*'):
COLOR_LIST = MULT_COLOR_ON
self.braille_math_symbol(index,COLOR_LIST)
elif(SYMBOL[index] == '/'):
COLOR_LIST = DIV_COLOR_ON
self.braille_math_symbol(index,COLOR_LIST)
for index in range(4):
self.cell[index].connect("button_press_event",self.symbol_identify,index)
def symbol_identify(self,event,target,item,index):
if((symbol[index] == '+' and self.random_sign == '+') or
(symbol[index] == '_' and self.random_sign == '_') or
(symbol[index] == 'X' and self.random_sign == 'X')
or (symbol[index] == '/' and self.random_sign == '/')):
def braille_math_symbol(self, index, COLOR_LIST):
BrailleChar(self.rootitem,(index*98)+255,375,50,
SYMBOL[index],COLOR_LIST,COLOR_OFF,SYMBOL_OFF,CIRCLE_FILL,
False,False,False,None)
def symbol_identify(self, event, target, item, index):
if((SYMBOL[index] == '+' and self.random_sign == '+') or
(SYMBOL[index] == '_' and self.random_sign == '_') or
(SYMBOL[index] == '*' and self.random_sign == '*')
or (SYMBOL[index] == '/' and self.random_sign == '/')):
self.gamewon = 1
gcompris.bonus.display(gcompris.bonus.WIN,gcompris.bonus.FLOWER)
else :
self.gamewon = 0
self.gamewon = 1
gcompris.bonus.display(gcompris.bonus.LOOSE,gcompris.bonus.FLOWER)
def ok_event(self,item,target,event,level):
def ok_event(self, item, target, event, level):
if(level == 1 or level == 2 or level == 3):
if(level == 3 and self.random_sign == '+'):
if((self.a1 == self.correct_letter1) and
......@@ -480,7 +514,7 @@ class Gcompris_dicey_dicey:
else :
#If there is a loose
self.gamewon = 0
self.gamewon = 1
gcompris.bonus.display(gcompris.bonus.LOOSE,gcompris.bonus.FLOWER)
else :
if(self.result == self.correct_letter1):
......@@ -493,13 +527,13 @@ class Gcompris_dicey_dicey:
self.gamewon = 1
gcompris.bonus.display(gcompris.bonus.WIN,gcompris.bonus.FLOWER)
else :
self.gamewon = 0
self.gamewon = 1
gcompris.bonus.display(gcompris.bonus.LOOSE,gcompris.bonus.FLOWER)
def letter_change1(self,letter):
def letter_change1(self, letter):
self.correct_letter1 = letter
def letter_change2(self,letter):
def letter_change2(self, letter):
self.correct_letter2 = letter
def end(self):
......@@ -523,58 +557,28 @@ class Gcompris_dicey_dicey:
gcompris.set_default_background(self.gcomprisBoard.canvas.get_root_item())
#Place alphabets & numbers in array format
for index in range(0,10):
tile = BrailleChar(self.rootitem,index *(cell_width+40)+60,
50, 38, index ,on ,off ,circle_fill,
circle_fill, True ,False ,True, None)
for index, letter in enumerate(string.ascii_uppercase[:10]):
tile = BrailleChar(self.rootitem, index*(cell_width+40)+60,
130, 38, letter ,on,off,circle_fill,
circle_fill,True ,False,True,None)
tile = BrailleChar(self.rootitem, index*(CELL_WIDTH+40)+60,
60, 38, letter ,COLOR_ON, COLOR_OFF, CIRCLE_FILL,
CIRCLE_FILL, True ,False ,True , None)
for index, letter in enumerate(string.ascii_uppercase[10:20]):
tile = BrailleChar(self.rootitem, index*(cell_width+40)+60,
210, 38, letter ,on, off, circle_fill,
circle_fill, True ,False,True,None)
tile = BrailleChar(self.rootitem, index*(CELL_WIDTH+40)+60,
135, 38, letter ,COLOR_ON, COLOR_OFF, CIRCLE_FILL,
CIRCLE_FILL, True ,False ,True, None)
for index, letter in enumerate(string.ascii_uppercase[20:25]):
tile = BrailleChar(self.rootitem, index*(cell_width+40)+60,
285, 38, letter ,on ,off ,circle_fill,
circle_fill, True ,False,True, None)
BrailleChar(self.rootitem,60, 360 , 38,
'+',on,off,circle_fill,circle_fill,
True, False , True, None)
BrailleChar(self.rootitem,130,360,38,
'_',on,off,circle_fill,circle_fill,
True , False , True, None)
BrailleChar(self.rootitem,210,360,38,
'.',on,off,circle_fill,circle_fill,
False, False ,True,None)
BrailleChar(self.rootitem,245,360,38,
'X',on,off,circle_fill,circle_fill,
False,False,True , None)
BrailleChar(self.rootitem,330,360,38,
'/',on,off,circle_fill,circle_fill,
False,False,True,None)
BrailleChar(self.rootitem,365,360,38,
'-',on,off,circle_fill,circle_fill,
False,False,True,None)
goocanvas.Text(parent = self.rootitem,
x=245.0,
y=425.0,
text="X",
fill_color=circle_fill,
anchor = gtk.ANCHOR_CENTER,
alignment = pango.ALIGN_CENTER,
font = 'SANS BOLD'
)
goocanvas.Text(parent = self.rootitem,
x=365.0,
y=425.0,
text="/",
fill_color=circle_fill,
anchor = gtk.ANCHOR_CENTER,
alignment = pango.ALIGN_CENTER,
font = 'SANS BOLD'
)
tile = BrailleChar(self.rootitem, index*(CELL_WIDTH+40)+60,
210, 38, letter ,COLOR_ON ,COLOR_OFF ,CIRCLE_FILL,
CIRCLE_FILL, True ,False,True, None)
BrailleChar(self.rootitem,60, 285, 38, "#",COLOR_ON,COLOR_OFF, CIRCLE_FILL,
CIRCLE_FILL, True, False,True, None)
for index in range(0,10):
tile = BrailleChar(self.rootitem,(index+1) *(CELL_WIDTH + 33)+60,
285, 38, index ,COLOR_ON,COLOR_OFF ,CIRCLE_FILL,
CIRCLE_FILL, True ,False ,True, None)
for index in range(4):
BrailleChar(self.rootitem,index * (CELL_WIDTH + 40) + 60,
360 , 38,SYMBOL[index],COLOR_ON,COLOR_OFF,CIRCLE_FILL
,CIRCLE_FILL,True, False , True, None)
#Move back item
self.backitem = goocanvas.Image(parent = self.rootitem,
......@@ -605,10 +609,10 @@ class Gcompris_dicey_dicey:
def pause(self, pause):
self.board_paused = pause
if(pause == 0):
if(pause == 0) and (self.gamewon == 1):
self.gamewon = 0
self.counter +=1
if (self.counter == 2):
if (self.counter == 3):
self.increment_level()
self.end()
self.start()
......
<?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"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="106.29778"
height="106.29814"
id="svg5070"
sodipodi:version="0.32"
inkscape:version="0.48.0 r9654"
sodipodi:docname="icon.svg"
inkscape:export-filename="/home/franck/Gcompris/gartoon/level9.png"
inkscape:export-xdpi="8.5762272"
inkscape:export-ydpi="8.5762272"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.0">
<defs
id="defs3">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 53.149071 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="106.29778 : 53.149071 : 1"
inkscape:persp3d-origin="53.148891 : 35.432714 : 1"
id="perspective100" />
<linearGradient
inkscape:collect="always"
id="linearGradient2815">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop2817" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop2819" />
</linearGradient>
<linearGradient
id="linearGradient16033">
<stop
id="stop16035"
offset="0.0000000"
style="stop-color:#ff0000;stop-opacity:1.0000000;" />
<stop
id="stop16037"
offset="1.0000000"
style="stop-color:#b01810;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
id="linearGradient10915">
<stop
style="stop-color:#ffe7ba;stop-opacity:1;"
offset="0"
id="stop10917" />
<stop
style="stop-color:#f2e46b;stop-opacity:1.0000000;"
offset="1.0000000"
id="stop10919" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2815"
id="linearGradient2821"