Last active
June 19, 2020 21:34
-
-
Save tf-taxa/9b6867d534315674c5963853fe1d2c16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# millionaire.py | |
import json | |
@taxa.route("/submit_value") | |
def submit(): | |
rawData = json.loads(request.data) | |
my_id = taxa.globals.getUserCert() | |
my_value = rawData["value"] | |
session[my_id] = my_value | |
response.add("OK") | |
@taxa.route("/get_results") | |
def reveal(): | |
rawData = json.loads(request.data) | |
my_id = taxa.globals.getUserCert() | |
my_opponent = rawData["opponent"] | |
if my_opponent not in session: | |
response.add("Opponent doesn't exist") | |
return | |
if session[my_id] >= session[my_opponent]: | |
response.add("Your value is no less than your opponent") | |
else: | |
response.add("Your value is less than your opponent") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment