Skip to content
 
 

Latest commit

 

History

32 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Refactor a Sudoku Game written in Python Flask

Use this simple Sudoku game as a starting point to practice your skills with GitHub Copilot. The goal is to refactor the code to use modern technologies, while also adding new features and improving the overall user experience.

Getting Started

Follow these instructions to get a copy of the project up and running on your local machine.

Dependencies

- Modern web browser (Chrome, Firefox, Edge, etc.)
- Python 3

Installation

  1. Fork this repository to your GitHub account. (You can use the "Fork" button on the top right corner of the repository page.)

  2. Clone your forked repository to your local machine.

  3. Open a terminal window and navigate to the "github-copilot-python/starter" directory.

  4. Create a Python virtual environment and activate it (optional but highly recommended).

python3 -m venv .venv
source .venv/bin/activate
  1. Install required Python packages.
pip install -r requirements.txt
  1. Run the Flask app.
python app.py
  1. Open http://127.0.0.1:5000 in your browser.

Project Instructions

Use GitHub Copilot to refactor the code for this game to add more advanced features. The goal is to create a more modern and maintainable codebase and add additional functionality to the final product. You can use any combination of code completion and chat features, like Ask, Edit, or Agent modes.

  • Errors should be handled gracefully with appropriate messages to the user.
  • Implement a Sudoku board generator that creates a valid Sudoku puzzle with a unique solution.
  • Add a timer to track how long it takes to solve the puzzle.
  • Implement a solution checker that verifies if the user's solution is correct using event delegation.
  • Add a difficulty selector to allow users to choose between easy, medium, and hard puzzles.
  • Add a hint feature that provides clues for the user that are noted with unique colors.
  • Add a check puzzle button that checks the current state of the board against the solution.
  • User should get immediate feedback on their input, such as highlighting invalid entries.
  • Top 10 scores should be saved in local storage and displayed on the page with the user's name, time taken, hints used, and difficulty level.
  • The game should be responsive and work well on both desktop and mobile devices.
  • UI colors should be visually appealing and accessible.
  • Completed and correct puzzles should display a congratulatory message with the time taken and hints used and ask for the user's name for Top 10 times.

Sudoku Game (Flask)

A web-based Sudoku game built using Python Flask. The project was refactored into a modular architecture using GitHub Copilot while preserving the original functionality.

Features

  • Generate random Sudoku puzzles
  • Three difficulty levels (Easy, Medium, Hard)
  • Sudoku solver
  • Hint system
  • Check solution
  • Game timer
  • Top 10 leaderboard
  • Dark mode
  • Responsive UI
  • Unique-solution puzzle generation
  • Automated testing with Pytest

Project Structure

starter/
│── app.py
│── board.py
│── validator.py
│── solver.py
│── generator.py
│── sudoku_logic.py
│── static/
│── templates/
│── tests/

Installation

Clone the repository.

git clone https://github.com/vuppalapati09/github-copilot-python.git

Move into the project.

cd github-copilot-python/starter

Create a virtual environment.

python -m venv .venv

Activate it.

Windows PowerShell:

.\.venv\Scripts\Activate.ps1

Install dependencies.

pip install -r requirements.txt

Run the Application

python app.py

Open:

http://127.0.0.1:5000

Run Tests

pytest -q

All tests should pass successfully.

Refactoring Summary

The application was refactored into separate modules:

  • board.py
  • validator.py
  • solver.py
  • generator.py

The original functionality was preserved while improving readability and maintainability.

Screenshots

Final Application

Final UI

Copilot Refactoring

Copilot Refactor

Testing Framework

Testing

Technologies Used

  • Python
  • Flask
  • HTML
  • CSS
  • JavaScript
  • Pytest
  • Git
  • GitHub Copilot

Author

Vuppalapati Surya prakash

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages