✨
This commit is contained in:
42
main.py
42
main.py
@@ -20,21 +20,53 @@ def decode_state(game_state):
|
|||||||
bit_string = ''.join([format(BASE64.index(s), '06b')[::-1] for s in game_state])
|
bit_string = ''.join([format(BASE64.index(s), '06b')[::-1] for s in game_state])
|
||||||
return [x != "1" for x in bit_string]
|
return [x != "1" for x in bit_string]
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/board')
|
||||||
def main_page():
|
def main_page():
|
||||||
game_encoding = flask.request.args.get("game_state")
|
game_encoding = flask.request.args.get("game_state")
|
||||||
|
if game_encoding == ".":
|
||||||
|
return flask.redirect("/")
|
||||||
|
|
||||||
if game_encoding is None:
|
if game_encoding is None:
|
||||||
game_encoding = "000000"
|
game_encoding = "000000"
|
||||||
game_state = decode_state(game_encoding)
|
game_state = decode_state(game_encoding)
|
||||||
|
|
||||||
empty = 36-sum(game_state)
|
empty = 36-sum(game_state)
|
||||||
|
|
||||||
return flask.render_template("main_board.html", categories=QUESTIONS["categories"], game_state=game_encoding, draw_cells=game_state, empty=empty)
|
return flask.render_template("main_board.html", categories=QUESTIONS["categories"], game_state=game_encoding, draw_cells=game_state, empty=empty)
|
||||||
|
|
||||||
|
@app.route('/final')
|
||||||
|
def final_jeopardy():
|
||||||
|
question_text = QUESTIONS['final'][0]
|
||||||
|
|
||||||
|
if question_text == "":
|
||||||
|
return flask.redirect("/")
|
||||||
|
elif question_text == "$":
|
||||||
|
return flask.render_template("question picture.html", game_state=".")
|
||||||
|
|
||||||
|
|
||||||
|
return flask.render_template("question.html", question_text=question_text, game_state=".")
|
||||||
|
|
||||||
|
@app.route('/final_answer')
|
||||||
|
def final_answer():
|
||||||
|
answer_text = QUESTIONS["final"][1]
|
||||||
|
|
||||||
|
if answer_text == "":
|
||||||
|
return flask.redirect("/")
|
||||||
|
elif answer_text == "$":
|
||||||
|
return flask.render_template("answer picture.html", game_state=".")
|
||||||
|
|
||||||
|
return flask.render_template("answer.html", answer_text=answer_text, game_state=".")
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def empty_page():
|
||||||
|
return flask.render_template("empty.html")
|
||||||
|
|
||||||
@app.route('/question')
|
@app.route('/question')
|
||||||
def question():
|
def question():
|
||||||
game_encoding = flask.request.args.get("game_state")
|
game_encoding = flask.request.args.get("game_state")
|
||||||
question = flask.request.args.get("question")
|
question = flask.request.args.get("question")
|
||||||
if game_encoding is None or question is None:
|
if game_encoding is None or question is None:
|
||||||
return flask.redirect("/")
|
return flask.redirect("/board")
|
||||||
|
|
||||||
game_state = decode_state(game_encoding)
|
game_state = decode_state(game_encoding)
|
||||||
empty = 36-sum(game_state)
|
empty = 36-sum(game_state)
|
||||||
@@ -43,7 +75,7 @@ def question():
|
|||||||
question_text = QUESTIONS["questions"][int(question)%6][int(question)//6][0]
|
question_text = QUESTIONS["questions"][int(question)%6][int(question)//6][0]
|
||||||
|
|
||||||
if question_text == "":
|
if question_text == "":
|
||||||
return flask.redirect("/?game_state="+game_encoding)
|
return flask.redirect("/board?game_state="+game_encoding)
|
||||||
elif question_text == "$":
|
elif question_text == "$":
|
||||||
return flask.render_template("question picture.html", question=int(question), game_state=game_encoding, empty=empty)
|
return flask.render_template("question picture.html", question=int(question), game_state=game_encoding, empty=empty)
|
||||||
|
|
||||||
@@ -57,12 +89,12 @@ def answer():
|
|||||||
empty = 35-sum(game_state)
|
empty = 35-sum(game_state)
|
||||||
question = flask.request.args.get("question")
|
question = flask.request.args.get("question")
|
||||||
if game_encoding is None or question is None:
|
if game_encoding is None or question is None:
|
||||||
return flask.redirect("/")
|
return flask.redirect("/board")
|
||||||
|
|
||||||
answer_text = QUESTIONS["questions"][int(question)%6][int(question)//6][1]
|
answer_text = QUESTIONS["questions"][int(question)%6][int(question)//6][1]
|
||||||
|
|
||||||
if answer_text == "":
|
if answer_text == "":
|
||||||
return flask.redirect("/?game_state="+game_encoding)
|
return flask.redirect("/board?game_state="+game_encoding)
|
||||||
elif answer_text == "$":
|
elif answer_text == "$":
|
||||||
return flask.render_template("answer picture.html", question=int(question), game_state=game_encoding, empty=empty)
|
return flask.render_template("answer picture.html", question=int(question), game_state=game_encoding, empty=empty)
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
["Elphaba's signature song in Wicked + The main source of thrust for Nomai spaceships","Defying Gravity cannon"],
|
["Elphaba's signature song in Wicked + The main source of thrust for Nomai spaceships","Defying Gravity cannon"],
|
||||||
["",""],
|
["",""],
|
||||||
["NSYNC's lead single + What the Nomai constructed the ATP to find","Bye Bye Beye of the Universe"],
|
["NSYNC's lead single + What the Nomai constructed the ATP to find","Bye Bye Beye of the Universe"],
|
||||||
["",""],
|
["Bonnie Tyler's biggest hit + The citizens of the starting planet","Total Eclipse of the Hearthians"],
|
||||||
["The lead single of Sabrina Carpenter's 2024 album + The Nomai you meet at the quantum moon","Espressolanum"]
|
["The lead single of Sabrina Carpenter's 2024 album + The Nomai you meet at the quantum moon","Espressolanum"]
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
@@ -56,5 +56,9 @@
|
|||||||
["",""],
|
["",""],
|
||||||
["",""]
|
["",""]
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
"final": [
|
||||||
|
"test",
|
||||||
|
"answer"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -79,6 +79,21 @@ th {
|
|||||||
text-shadow: 5px 5px 1px black;
|
text-shadow: 5px 5px 1px black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
color: rgb(255, 204, 0);
|
||||||
|
font-family: "Korinna";
|
||||||
|
text-align: center;
|
||||||
|
font-size: 150;
|
||||||
|
bottom: auto;
|
||||||
|
height: 100%;
|
||||||
|
width: 80%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
text-decoration: none;
|
||||||
|
text-shadow: 5px 5px 1px black;
|
||||||
|
}
|
||||||
|
|
||||||
.question img {
|
.question img {
|
||||||
height: 70%;
|
height: 70%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,18 @@
|
|||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<a class="question" href="/?game_state={{ game_state }}">
|
{% if game_state != "." %}
|
||||||
|
<a class="question" href="/board?game_state={{ game_state }}">
|
||||||
<img src="/static/images/{{question}}.png">
|
<img src="/static/images/{{question}}.png">
|
||||||
</a>
|
</a>
|
||||||
<div class="money">
|
<div class="money">
|
||||||
${{(question//6+1)*((1+empty)*7-2)}}
|
${{(question//6+1)*((1+empty)*7-2)}}
|
||||||
<!--${{ (question//6+1) ** 4 + 2*((question//6+1) ** 3) + 7*((question//6+1)**2) + (question//6+1) * 33 + (((question%6)+2)%3)**2 + (question%6) * 87 - ((question%6)+3)**2 - ((question%6)+2)**3 + (question//6+1)*(((question%6) + 2)%3) + 24 }}-->
|
<!--${{ (question//6+1) ** 4 + 2*((question//6+1) ** 3) + 7*((question//6+1)**2) + (question//6+1) * 33 + (((question%6)+2)%3)**2 + (question%6) * 87 - ((question%6)+3)**2 - ((question%6)+2)**3 + (question//6+1)*(((question%6) + 2)%3) + 24 }}-->
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<a class="question" href="/">
|
||||||
|
<img src="/static/images/final.png">
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -4,12 +4,18 @@
|
|||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<a class="question" href="/?game_state={{ game_state }}">
|
{% if game_state != "." %}
|
||||||
|
<a class="question" href="/board?game_state={{ game_state }}">
|
||||||
{{answer_text}}
|
{{answer_text}}
|
||||||
</a>
|
</a>
|
||||||
<div class="money">
|
<div class="money">
|
||||||
${{(question//6+1)*((1+empty)*7-2)}}
|
${{(question//6+1)*((1+empty)*7-2)}}
|
||||||
<!--${{ (question//6+1) ** 4 + 2*((question//6+1) ** 3) + 7*((question//6+1)**2) + (question//6+1) * 33 + (((question%6)+2)%3)**2 + (question%6) * 87 - ((question%6)+3)**2 - ((question%6)+2)**3 + (question//6+1)*(((question%6) + 2)%3) + 24 }}-->
|
<!--${{ (question//6+1) ** 4 + 2*((question//6+1) ** 3) + 7*((question//6+1)**2) + (question//6+1) * 33 + (((question%6)+2)%3)**2 + (question%6) * 87 - ((question%6)+3)**2 - ((question%6)+2)**3 + (question//6+1)*(((question%6) + 2)%3) + 24 }}-->
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<a class="question" href="/">
|
||||||
|
{{answer_text}}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
11
templates/empty.html
Normal file
11
templates/empty.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Jeopardy</title>
|
||||||
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a class="title" href="/board">
|
||||||
|
Jeopardy
|
||||||
|
</a>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
{% if empty < 36 %}
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
{% for cat in categories: %}
|
{% for cat in categories: %}
|
||||||
@@ -22,5 +23,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<a class="title" href="/final">
|
||||||
|
Final Jeopardy
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
{% if game_state != "." %}
|
||||||
<a class="question" href="/answer?question={{ question }}&game_state={{ game_state }}">
|
<a class="question" href="/answer?question={{ question }}&game_state={{ game_state }}">
|
||||||
<img src="/static/images/{{question}}.png">
|
<img src="/static/images/{{question}}.png">
|
||||||
</a>
|
</a>
|
||||||
@@ -11,5 +12,10 @@
|
|||||||
${{(question//6+1)*((1+empty)*7-2)}}
|
${{(question//6+1)*((1+empty)*7-2)}}
|
||||||
<!--${{ (question//6+1) ** 4 + 2*((question//6+1) ** 3) + 7*((question//6+1)**2) + (question//6+1) * 33 + (((question%6)+2)%3)**2 + (question%6) * 87 - ((question%6)+3)**2 - ((question%6)+2)**3 + (question//6+1)*(((question%6) + 2)%3) + 24 }}-->
|
<!--${{ (question//6+1) ** 4 + 2*((question//6+1) ** 3) + 7*((question//6+1)**2) + (question//6+1) * 33 + (((question%6)+2)%3)**2 + (question%6) * 87 - ((question%6)+3)**2 - ((question%6)+2)**3 + (question//6+1)*(((question%6) + 2)%3) + 24 }}-->
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<a class="question" href="/final_answer">
|
||||||
|
<img src="/static/images/final.png">
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
{% if game_state != "." %}
|
||||||
<a class="question" href="/answer?question={{ question }}&game_state={{ game_state }}">
|
<a class="question" href="/answer?question={{ question }}&game_state={{ game_state }}">
|
||||||
{{question_text}}
|
{{question_text}}
|
||||||
</a>
|
</a>
|
||||||
@@ -11,5 +12,10 @@
|
|||||||
${{(question//6+1)*((1+empty)*7-2)}}
|
${{(question//6+1)*((1+empty)*7-2)}}
|
||||||
<!--${{ (question//6+1) ** 4 + 2*((question//6+1) ** 3) + 7*((question//6+1)**2) + (question//6+1) * 33 + (((question%6)+2)%3)**2 + (question%6) * 87 - ((question%6)+3)**2 - ((question%6)+2)**3 + (question//6+1)*(((question%6) + 2)%3) + 24 }}-->
|
<!--${{ (question//6+1) ** 4 + 2*((question//6+1) ** 3) + 7*((question//6+1)**2) + (question//6+1) * 33 + (((question%6)+2)%3)**2 + (question%6) * 87 - ((question%6)+3)**2 - ((question%6)+2)**3 + (question//6+1)*(((question%6) + 2)%3) + 24 }}-->
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<a class="question" href="/final_answer">
|
||||||
|
{{question_text}}
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user