Guess The States (Game)

Posted by Ruth Selorme on October 26, 2024

US States Quiz Game: A Turtle Graphics Project

Test your knowledge of US geography with this interactive quiz game built using Python's Turtle module and pandas library. In this game, players are challenged to guess the names of all 50 US states. As they correctly identify states, their names are displayed on a map.

Project Overview

This project involves creating a game where users can guess the names of US states. The game uses Turtle graphics to display a map of the US, and pandas to handle state data. As users input the names of states, they are marked on the map. If the user chooses to exit the game, the names of the states that were not guessed are saved for later review.

Key Features

    Interactive Map: Displays a blank map of the US where states will be marked as they are guessed.

    User Input: Players input state names through a text input box, and the game checks if the input matches any state names.

    State Display: Correctly guessed states are written on the map at their geographical locations.

    Exit and Save: Players can exit the game, and any unguessed states will be saved to a CSV file for later review.

Step-by-Step Breakdown

1. Setup the Game Window

Create a Turtle graphics window and set up the game environment with a map image of the US.

2. Load State Data

Read the state data from a CSV file using pandas. This file contains the names and coordinates of each state on the map.

3. User Interaction

Prompt the user to input state names. The game checks if the input matches any of the 50 states and updates the map accordingly.

4. Handle User Input and Update Map

For each correct guess, the state name is displayed on the map at the correct coordinates. The game continues until all states are guessed or the user chooses to exit.

5. Save Unanswered States

If the user exits the game, any unguessed states are saved to a CSV file, allowing the user to review them later.

Python Skills Utilized

    Turtle Graphics: Creating interactive and visually engaging elements in the game.

    Pandas: Handling and processing data from CSV files to manage game content.

    File Handling: Saving data to CSV files for future reference.

Real-World Use Cases

    This project provides a practical example of using Python for educational games and interactive applications. It showcases how to integrate graphical user interfaces with data handling to create engaging learning tools.

    The skills demonstrated here can be extended to other interactive applications, such as educational tools, quizzes, and games with different themes and data sets.

Conclusion

Explore US geography and enhance your Python skills with this interactive Turtle graphics project. Check out the complete code and details on my GitHub repository and start building your own interactive educational games!

This is a video demo of the game

Category: Projects

107 eye svg

1 thumbs up svg

Comments