Guess Game is an interactive web application where an AI Language Model (LLM) plays the role of a game host. Players must guess a secret item by asking questions and receiving indirect clues from the AI.
- AI-powered game host using a Large Language Model
- Web-based user interface built with Streamlit
- Dynamic question-answer gameplay
- Random selection of topics for each game
- Class and seat number input for player identification
- Multilingual support (primarily Chinese)
- Game Initialization: The AI selects a random topic from a predefined list.
- Player Interaction: Users ask questions through a chat interface.
- AI Responses: The LLM provides indirect clues based on the secret item.
- Guessing: Players attempt to guess the item using the provided clues.
- Win Condition: The game ends when the player correctly guesses the item.
- Web Framework:
streamlit
- AI Model API: Together.ai (Qwen/Qwen1.5-72B-Chat)
- HTTP Requests:
requests
- Language: Python
To run the application:
streamlit run main.py
- Enter your class and seat number.
- Start asking questions to guess the secret item.
- Use the phrase "答案是XX嗎?" (Is the answer XX?) to confirm your guess.
- The game ends when you guess correctly or choose to start a new game.
call_ai_model
: Function to interact with the AI model API- Session state management for conversation tracking
- Dynamic conversation display using Streamlit's chat interface
- Webhook integration for game record submission
- Initialize game with a random topic
- Display welcome message and game instructions
- Accept user input for questions
- Process AI responses and update the conversation
- Check for correct guesses and end the game accordingly
- The AI is instructed to maintain a strict and challenging gameplay experience.
- Cheating attempts or off-topic conversations are discouraged by the AI.
- The game is primarily in Chinese, with some English instructions in the code comments.