Pokémon Learning Game

An interactive Pokémon identification game built with Flask, Python, JavaScript, and the PokéAPI.

Python Flask JavaScript REST API HTML/CSS

Project Overview

This project is an interactive Pokémon learning game designed to help players recognize and learn Pokémon through repeated identification challenges.

Each round randomly selects a Pokémon and presents the player with multiple possible answers. Players receive immediate feedback and can track their score and accuracy as they continue playing.

The application combines a Flask backend with the PokéAPI to dynamically retrieve Pokémon information, sprites, and names.

Game Features

🎮

Pokémon Identification

Each round displays a randomly selected Pokémon with four possible answers. One answer is correct while the others are randomly generated choices.

📊

Score & Accuracy

The game tracks correct guesses, total guesses, score, and overall accuracy throughout the session.

❤️

Pokémon Collection

Players can save Pokémon to a personal collection and view the Pokémon they have discovered during the game.

🔄

Dynamic Rounds

After every guess, the application loads a new Pokémon and generates a fresh set of possible answers.

Technical Implementation

Flask Backend

Flask manages the game routes, session state, Pokémon retrieval, scoring, and player collections.

  • Game state stored with Flask sessions
  • Dynamic Pokémon selection
  • Score and accuracy tracking
  • JSON API responses for guesses

PokéAPI Integration

The application uses the PokéAPI to retrieve Pokémon information instead of maintaining a manually created database of Pokémon.

  • Random Pokémon retrieval
  • Pokémon names
  • Sprite images
  • Dynamic answer generation

Interactive JavaScript

JavaScript handles communication between the game interface and Flask without requiring the player to manually submit a traditional HTML form.

When a player selects an answer, JavaScript sends a request to the Flask endpoint:

fetch(`/pokemon-guess/${guess}`)

The server evaluates the answer and returns JSON containing whether the guess was correct, the correct Pokémon, the updated score, and the player's accuracy.

Application Architecture

1. Flask

Handles routes and game state

2. PokéAPI

Provides Pokémon data

3. JavaScript

Handles player interaction

4. Session

Tracks game progress

What I Learned

This project gave me experience connecting a Python web application to an external REST API and using the returned data to create a dynamic interactive experience.

It also provided practical experience with Flask sessions, asynchronous JavaScript requests, JSON responses, random data generation, and designing game logic for a web application.

Most importantly, the project demonstrated how traditional web development techniques can be combined with game mechanics to create an engaging learning experience.