def Play_3(sessionid): Play_locals['playerName'] = runtime.get_field('positioned') if Play_locals['percentage'] > g.get('percentage2', 0) or ((Play_locals['percentage'] == g.get('percentage2', 0) and (Play_locals['possiblePoints'] > g.get('maxPoints2', 0)))): g.put('top3', g.get('top2', '')) g.put('percentage3', g.get('percentage2', 0)) g.put('maxPoints3', g.get('maxPoints2', 0)) g.put('points3', g.get('points2', 0)) if Play_locals['percentage'] > g.get('percentage1', 0) or ((Play_locals['percentage'] == g.get('percentage1', 0) and Play_locals['possiblePoints'] > g.get('maxPoints1', 0))): g.put('top2', g.get('top1', '')) g.put('percentage2', g.get('percentage1', 0)) g.put('maxPoints2', g.get('maxPoints1', 0)) g.put('points2', g.get('points1', 0)) g.put('top1', Play_locals['playerName']) g.put('percentage1', Play_locals['percentage']) g.put('maxPoints1', Play_locals['possiblePoints']) g.put('points1', Play_locals['points']) else: g.put('top2', Play_locals['playerName']) g.put('percentage2', Play_locals['percentage']) g.put('maxPoints2', Play_locals['possiblePoints']) g.put('points2', Play_locals['points']) else: g.put('top3', Play_locals['playerName']) g.put('percentage3', Play_locals['percentage']) g.put('maxPoints3', Play_locals['possiblePoints']) g.put('points3', Play_locals['points']) runtime.output(sessionid, lambda: output_Positioned(g.get('top1', ''), g.get('points1', 0), g.get('maxPoints1', 0), g.get('percentage1', 0), g.get('top2', ''), g.get('points2', 0), g.get('maxPoints2', 0), g.get('percentage2', 0), g.get('top3', ''), g.get('points3', 0), g.get('maxPoints3', 0), g.get('percentage3', 0)), exit=True)
def Play_While_2(sessionid): Play_locals['playerChoice'] = int(runtime.get_field('playerChoice')) if Play_locals['serverChoice'] == Play_locals['playerChoice']: Play_locals['gameResult'] = 'tie' Play_locals['points'] = Play_locals['points'] + 1 else: if (Play_locals['playerChoice'] + 1) % 3 == Play_locals['serverChoice']: Play_locals['gameResult'] = 'loss' else: Play_locals['gameResult'] = 'win' Play_locals['points'] = Play_locals['points'] + 2 Play_locals['possiblePoints'] = Play_locals['possiblePoints'] + 2 Play_locals['serverChoiceString'] = toString(Play_locals['serverChoice']) Play_locals['playerChoiceString'] = toString(Play_locals['playerChoice']) runtime.output(sessionid, lambda: output_Result(Play_locals['playerChoiceString'], Play_locals['serverChoiceString'], Play_locals['gameResult'], Play_locals['points'], Play_locals['possiblePoints'])) l = runtime.Store(sessionid) l.put('locals', Play_locals) l.put('start', 'Play_While_3')
def Play_While_3(sessionid): Play_locals['playAgain'] = int(runtime.get_field('playAgain')) if Play_locals['playAgain'] == 0: Play_While_1(sessionid) else: Play_2(sessionid)