-
Notifications
You must be signed in to change notification settings - Fork 1
/
riddle.html
66 lines (60 loc) · 2.59 KB
/
riddle.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{% extends 'base.html'%}
{% block title %}Riddle{% endblock %}
{% block content %}
<!--This block of text will display if the user skips the previous question-->
{% if session['message'] == "skipped" and question_number != 1 %}
<p>I'm sorry you had to skip the last question, {{ session['user']|title}}. In case you'd like to know, the keyword the
Sphinx was expecting was <strong>
{% for riddle in riddles %}
{% if ( loop.index == question_number|int - 1 ) %}
{{riddle.answer}}
{% endif %}
{% endfor %}
</strong>.</p>
{% if question_number <= 10 %}
<p>I hope you have better luck with this one!</p>
<hr>
{% else %}
<p>Well done on finishing the game, {{ session['user']|title}}</p>
<a href="{{ url_for('show_LB') }}" class="btn btn-warning btn-lg">Go To Leaderboard</a>
<a href="{{ url_for('reset') }}" class="btn btn-warning btn-lg">Play Again</a>
<a href="{{ url_for('index') }}" class="btn btn-warning btn-lg">Home</a>
{% endif %}
{% endif %}
<!--Display riddle-->
{% if question_number == 1 %}
<p>Welcome, {{ session['user']|title }}! Are you ready for your first riddle? Good luck!</p>
{% elif question_number == 10 %}
<p>And now the last question, {{ session['user']|title}}!</p>
{% endif %}
{% if question_number <= 10 %}
<p><strong>Reminder:</strong> The sphinx looks for a specific keyword in your answer. You can phrase it any way you
like: A full sentence, a phrase, a few words or if you're feeling very brave, try and guess the sphinx' expected
keyword!</p>
<hr>
{% endif %}
{% for riddle in riddles %}
{% if ( loop.index == question_number|int ) and ( loop.index <= 10 ) %} <div class="riddle">
<p>{{loop.index}}. {{riddle.riddle|safe}}</p>
</div>
<!--Answer form-->
<form name="riddles" method="POST" action="">
<div class="form-group">
<input class="field hidden" type="text" name="question_number" id="question_number" placeholder="Question Number"
value="{{ loop.index }}"></div>
<div class="
form-group">
<input class="field hidden" type="text" name="correct_answer" id="correct_answer" placeholder="Your answer" value="{{ riddle.answer }}">
</div>
<div class="form-group">
<input class="field" type="text" name="guess" id="guess" placeholder="Your answer" required>
</div>
<div class="form-group">
<button type="submit" class="btn btn-warning btn-lg" value="user_answer">Submit</button>
<a href="{{ url_for('skip') }}" class="btn btn-warning btn-lg">Skip</a>
<a href="{{ url_for('write_to_LB') }}" class="btn btn-warning btn-lg">End Game</a>
</div>
</form>
{% endif %}
{% endfor %}
{% endblock%}