def callAll(data): (l, flag1) = util.findMatchingNum(data.candies, data.rows, data.cols, 3) (n, flag2) = util.findMatchingNum(data.candies, data.rows, data.cols, 4) (m, flag3) = util.findMatchingNum(data.candies, data.rows, data.cols, 5) if (m == None and n == None and l == None): return False return True
def demoLevelTimerFired(data): (m, flag5) = util.findMatchingNum(data.candies, data.rows, data.cols, 5) if (m != None): (x, y) = m[2] candy = data.candies[x][y] data.candies[x][y] = ColorBomb(candy.x, candy.y) for (row, col) in m: if (data.candies[row][col].color != "colorful"): data.candies[row][col].color = "clear" data.candies[row][col].image = None (n, flag4) = util.findMatchingNum(data.candies, data.rows, data.cols, 4) if (n != None): letter = util.findOrientation(n) for (row, col) in n: color = data.candies[row][col].color image = util.findImage(color, letter) data.candies[row][col].image = image data.candies[row][col].color = color + letter (package, row, col) = util.findPackage(data.candies, data.rows, data.cols) if (package != None): color = data.candies[row][col].color + "P" candy = data.candies[row][col] data.candies[row][col] = PackagedCandy(candy.x, candy.y, color) for (x, y) in package: if (data.candies[x][y].color != color): data.candies[x][y].color = "clear" data.candies[x][y].image = None (l, flag3) = util.findMatchingNum(data.candies, data.rows, data.cols, 3) if (l != None): for (row, col) in l: data.candies[row][col].color = "clear" data.candies[row][col].image = None gameOver(data) (rows, cols) = (data.rows, data.cols) for row in range(rows): for col in range(cols): if (data.candies[row][col].color == "clear"): data.score += 60 candy = data.candies[row][col] data.candies[row][col] = Candy(candy.x, candy.y) elif (data.candies[row][col].color.endswith("V")): clearARow(data, col, "V") elif (data.candies[row][col].color.endswith("H")): clearARow(data, row, "H") if (data.gameOver1): data.mode = "playGame2"
def callAll(data): (l, flag1) = util.findMatchingNum( data.candies, data.rows, data.cols, 3) (n, flag2) = util.findMatchingNum( data.candies, data.rows, data.cols, 4) (m, flag3) = util.findMatchingNum( data.candies, data.rows, data.cols, 5) if(m == None and n== None and l==None): return False return True
def timerFired(data): (m, flag5) = util.findMatchingNum( data.candies, data.rows, data.cols, 5) if(m!= None): (x, y) = m[2] candy = data.candies[x][y] data.candies[x][y] = ColorBomb(candy.x, candy.y) for (row, col) in m: if(data.candies[row][col].color != "colorful"): data.candies[row][col].color = "clear" data.candies[row][col].image = None (n, flag4) = util.findMatchingNum( data.candies, data.rows, data.cols, 4) if(n != None): letter = util.findOrientation(n) for (row, col) in n: color = data.candies[row][col].color image = util.findImage(color, letter) data.candies[row][col].image = image data.candies[row][col].color = color + letter (package, row, col)= util.findPackage( data.candies, data.rows, data.cols) if(package != None): color = data.candies[row][col].color + "P" candy = data.candies[row][col] data.candies[row][col] = PackagedCandy(candy.x, candy.y, color) for (x, y) in package: if(data.candies[x][y].color != color): data.candies[x][y].color = "clear" data.candies[x][y].image = None (l, flag3) = util.findMatchingNum( data.candies, data.rows, data.cols, 3) if(l != None): for (row, col) in l: data.candies[row][col].color = "clear" data.candies[row][col].image = None if(data.jelly2[row][col].jelly != None): data.jelly2[row][col].jelly = None elif(data.jellies[row][col].jelly != None): data.jellies[row][col].jelly = None gameOver(data) (rows, cols) = (data.rows,data.cols) for row in range(rows): for col in range(cols): if(data.candies[row][col].color == "clear"): data.score += 60 candy = data.candies[row][col] data.candies[row][col] = Candy(candy.x, candy.y) elif(data.candies[row][col].color.endswith("V")): clearARow(data, col, "V") elif(data.candies[row][col].color.endswith("H")): clearARow(data, row, "H") if(data.gameOver1): data.mode = "playGame2"