This commit is contained in:
2024-09-09 16:38:33 +02:00
parent 1526451fd1
commit 8ee14b3984
6 changed files with 16 additions and 9 deletions

11
main.py
View File

@@ -37,6 +37,7 @@ def question():
return flask.redirect("/") return flask.redirect("/")
game_state = decode_state(game_encoding) game_state = decode_state(game_encoding)
empty = 36-sum(game_state)
game_state[int(question)] = False game_state[int(question)] = False
game_encoding = encode_state(game_state) game_encoding = encode_state(game_state)
question_text = QUESTIONS["questions"][int(question)%6][int(question)//6][0] question_text = QUESTIONS["questions"][int(question)%6][int(question)//6][0]
@@ -44,14 +45,16 @@ def question():
if question_text == "": if question_text == "":
return flask.redirect("/?game_state="+game_encoding) return flask.redirect("/?game_state="+game_encoding)
elif question_text == "$": elif question_text == "$":
return flask.render_template("question picture.html", question=int(question), game_state=game_encoding) return flask.render_template("question picture.html", question=int(question), game_state=game_encoding, empty=empty)
return flask.render_template("question.html", question=int(question), question_text=question_text, game_state=game_encoding) return flask.render_template("question.html", question=int(question), question_text=question_text, game_state=game_encoding, empty=empty)
@app.route('/answer') @app.route('/answer')
def answer(): def answer():
game_encoding = flask.request.args.get("game_state") game_encoding = flask.request.args.get("game_state")
game_state = decode_state(game_encoding)
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("/")
@@ -61,9 +64,9 @@ def answer():
if answer_text == "": if answer_text == "":
return flask.redirect("/?game_state="+game_encoding) return flask.redirect("/?game_state="+game_encoding)
elif answer_text == "$": elif answer_text == "$":
return flask.render_template("answer picture.html", question=int(question), game_state=game_encoding) return flask.render_template("answer picture.html", question=int(question), game_state=game_encoding, empty=empty)
return flask.render_template("answer.html", question=int(question), answer_text=answer_text, game_state=game_encoding) return flask.render_template("answer.html", question=int(question), answer_text=answer_text, game_state=game_encoding, empty=empty)
@app.route('/static/<path:path>') @app.route('/static/<path:path>')
def flag_image(path): def flag_image(path):

View File

@@ -8,7 +8,8 @@
<img src="/static/images/{{question}}.png"> <img src="/static/images/{{question}}.png">
</a> </a>
<div class="money"> <div class="money">
${{ (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)*((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 }}-->
</div> </div>
</body> </body>
</html> </html>

View File

@@ -8,7 +8,8 @@
{{answer_text}} {{answer_text}}
</a> </a>
<div class="money"> <div class="money">
${{ (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)*((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 }}-->
</div> </div>
</body> </body>
</html> </html>

View File

@@ -15,7 +15,7 @@
{% for j in range(0,6): %} {% for j in range(0,6): %}
<td> <td>
{% if draw_cells[(i-1)*6+j] %} {% if draw_cells[(i-1)*6+j] %}
<a href="/question?question={{ (i-1) * 6 + j }}&game_state={{ game_state }}">${{(i*250)-(i**2*empty)}}<!--${{ i ** 4 + 2*(i ** 3) + 7*(i**2) + i * 33 + ((j+2)%3)**2 + j * 87 - (j+3)**2 - (j+2)**3 + i*((j + 2)%3) + 24 }}--></a> <a href="/question?question={{ (i-1) * 6 + j }}&game_state={{ game_state }}">${{i*((1+empty)*7-2)}}<!--${{ i ** 4 + 2*(i ** 3) + 7*(i**2) + i * 33 + ((j+2)%3)**2 + j * 87 - (j+3)**2 - (j+2)**3 + i*((j + 2)%3) + 24 }}--></a>
{% endif %} {% endif %}
</td> </td>
{% endfor %} {% endfor %}

View File

@@ -8,7 +8,8 @@
<img src="/static/images/{{question}}.png"> <img src="/static/images/{{question}}.png">
</a> </a>
<div class="money"> <div class="money">
${{ (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)*((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 }}-->
</div> </div>
</body> </body>
</html> </html>

View File

@@ -8,7 +8,8 @@
{{question_text}} {{question_text}}
</a> </a>
<div class="money"> <div class="money">
${{ (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)*((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 }}-->
</div> </div>
</body> </body>
</html> </html>