Template
1
0

Updated starter pack

This commit is contained in:
2025-11-28 10:58:38 +03:00
parent cae0d5b946
commit dd33d45f46
16 changed files with 1097 additions and 85 deletions

View File

@@ -369,14 +369,12 @@
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre># Prize structure (15 levels)
PRIZE_LEVELS = [
100, 200, 300, 500, 1000,
2000, 4000, 8000, 16000, 32000,
64000, 125000, 250000, 500000, 1000000
]
GUARANTEED_LEVELS = [5, 10] # First and second guaranteed levels</pre>
<pre># 1. This file should contain the game logic for the quiz game
# TODO: Import Flask and setup the app
# TODO: Define prize levels and guaranteed levels
# TODO: Setup game session routes
# TODO: Implement question serving functionality
# TODO: Add lifeline functionality</pre>
</div>
<div class="explanation">
@@ -419,27 +417,11 @@ def start_game():
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre>import json
@app.route('/get_question')
def get_question():
# Load questions from the JSON file
with open('questions.json', 'r') as f:
questions = json.load(f)
# Get current question number from session
question_num = session.get('current_question', 0)
# Check if game is over
if question_num >= len(questions):
return {'game_over': True}
# Return the current question
return {
'question': questions[question_num]['question'],
'options': questions[question_num]['options'],
'question_number': question_num + 1
}</pre>
<pre># 2. This file should contain the database connection and data handling
# TODO: Load questions from JSON file
# TODO: Implement answer checking functionality
# TODO: Handle lifeline requests
# TODO: Manage game state and sessions</pre>
</div>
<div class="explanation">
@@ -467,28 +449,12 @@ def get_question():
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre>[
{
"question": "What is the capital of Russia?",
"options": [
"St. Petersburg",
"Moscow",
"Kazan",
"Novosibirsk"
],
"correct_answer": 1
},
{
"question": "Which Russian author wrote 'War and Peace'?",
"options": [
"Fyodor Dostoevsky",
"Leo Tolstoy",
"Alexander Pushkin",
"Anton Chekhov"
],
"correct_answer": 1
}
]</pre>
<pre>// 1. This file should contain the basic structure of the game page
// TODO: Create the main game container
// TODO: Add elements for displaying questions and answers
// TODO: Include buttons for lifelines
// TODO: Add a game over screen
// TODO: Link to CSS and JavaScript files</pre>
</div>
<div class="explanation">
@@ -834,37 +800,11 @@ if (window.location.pathname === '/start') {
<div class="code-block">
<button class="copy-btn" onclick="copyCode(this)">Copy</button>
<pre>function useFiftyFifty() {
const lifelineBtn = document.querySelector('.lifeline');
if (lifelineBtn) {
lifelineBtn.disabled = true;
}
apiRequest('/lifeline/fifty_fifty')
.then(data => {
if (data.error) {
alert(data.error);
if (lifelineBtn) {
lifelineBtn.disabled = false;
}
return;
}
// Hide two wrong options
const options = document.querySelectorAll('.option');
data.remove_indices.forEach(index => {
if (options[index]) {
options[index].style.display = 'none';
}
});
})
.catch(error => {
console.error('Error:', error);
if (lifelineBtn) {
lifelineBtn.disabled = false;
}
});
}</pre>
<pre>// 2. This file should contain the interactive functionality of the game
// TODO: Implement functions to load and display questions
// TODO: Add event handlers for answer selection
// TODO: Implement lifeline functionality
// TODO: Add game flow control (next question, game over)</pre>
</div>
<div class="explanation">