Project File Structure:
+Pro Tip: All project files are available at https://gitea.techshare.cc/technolyceum/ai6-m2.git
+diff --git a/Quiz_Game_Project-Student Learning_Portal.html b/Quiz_Game_Project-Student Learning_Portal.html index 8473533..325d8b8 100644 --- a/Quiz_Game_Project-Student Learning_Portal.html +++ b/Quiz_Game_Project-Student Learning_Portal.html @@ -369,14 +369,12 @@
# 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+
# 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
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
- }
+ # 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
[
- {
- "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
- }
-]
+ // 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
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;
- }
- });
-}
+ // 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)
Pro Tip: All project files are available at https://gitea.techshare.cc/technolyceum/ai6-m2.git
+Open your terminal and run the following command to get the project files:
+Move into the project directory using:
+Install the necessary Python packages:
+Navigate to the database file at:
+Add the MongoDB connection information:
+Add your quiz questions to the database:
+Navigate to the backend developer documentation:
+Add the Flask setup code:
+Add the API endpoints for getting questions and submitting answers:
+Navigate to the frontend developer documentation:
+Add the basic HTML structure with game container:
+Add the game control elements:
+You won: 0 ₽
+Make sure MongoDB is running:
+Start the Flask application:
+Open your browser and go to:
+