コード例 #1
0
 def get_games_for_puzzle_rush(self, p_id, numPuzzles, difficulty, type):
     if (PuzzleRushDAO().check_game_valid(p_id)):
         if difficulty == 'easy':
             #do stuff etc check for all
             games = GenDAO().getPuzzles(8, 5, numPuzzles, type)
         elif difficulty == 'medium':
             games = GenDAO().getPuzzles(13, 9, numPuzzles, type)
         elif difficulty == 'hard':
             games = GenDAO().getPuzzles(18, 14, numPuzzles, type)
         elif difficulty == 'Exteremly Hard':
             games = GenDAO().getPuzzles(22, 19, numPuzzles, type)
         elif difficulty == 'godly':
             games = GenDAO().getPuzzles(50, 23, numPuzzles, type)
     else:
         return 'Game has ended'
     gamelist = list()
     for game in games:
         if PuzzleRushDAO().match_game_to_puzzle(
                 p_id, game['g_id']) == 'completed':
             gamelist.append(game)
     return gamelist
コード例 #2
0
 def get_puzzle_rush_profile_view(self, user_id):
     return PuzzleRushDAO().get_puzzle_rush_profile_view(user_id)
コード例 #3
0
 def get_random_game(self, difficulty, type):
     if type == 'random':
         type = 'algo'
     return PuzzleRushDAO().get_random_game(difficulty, type)
コード例 #4
0
 def end_puzzle_rush_game(self, p_id, totalMoves, differenceFrom):
     PuzzleRushDAO().end_puzzle_rush_game(p_id, totalMoves, differenceFrom)
コード例 #5
0
 def submit_solution_rush(self, p_id, g_id, solutiondata):
     if (PuzzleRushDAO().check_game_valid(p_id)):
         #check solution data based on g_id
         PuzzleRushDAO().increment_score(p_id)
     return
コード例 #6
0
 def start_puzzle(self, user_id, difficulty, type):
     if type == 'random':
         type = 'algo'
     p_id = PuzzleRushDAO().start_puzzle(user_id, difficulty, type)
     games = self.get_games_for_puzzle_rush(p_id, 20, difficulty, type)
     return (games, p_id)
コード例 #7
0
 def get_puzzle_rush(self, p_id):
     return PuzzleRushDAO().get_puzzle_rush(p_id)