def start(self, row, col, probability): g = Grid(int(row), int(col), probability=float(probability)) session['grid'] = g session.save() c.grid, c.num_left, c.gameover = g.game_state() c.rows = g.rows() c.cols = g.cols() return render('/grid.html')
def flag(self, row, col): try: session['grid'].flag(int(row),int(col)) except (UncoveredBomb, AlreadyUncovered, GameOver): pass session.save() c.grid, c.num_left, c.gameover = session['grid'].game_state() c.rows = session['grid'].rows() c.cols = session['grid'].cols() return render('/grid.html')