Skip to content

[Feature]:Add N-Queens Clash (Backtracking DSA Game) - Games Category #1278

@24CS059Aemi

Description

@24CS059Aemi

❓ Problem Statement

Currently, the repository has a great collection of games and math utilities, but it lacks a project that gamifies advanced Data Structures and Algorithms (DSA) concepts like Backtracking. Learning concepts like the N-Queens problem is notoriously difficult for beginners through just reading code or textbooks. There is a need for an interactive, visual way to understand how recursive backtracking algorithms work step-by-step while keeping it fun.

🚀 Proposed Enhancement

I propose adding N-Queens Clash to the games/ category.
This will be an interactive mini-game where the user tries to place 8 Queens on a chessboard so that no two queens can attack each other.

It will have two parts:

  1. CLI Version (Python): A pure procedural Python script (using zero external dependencies as per the guidelines). It will use a text-based interactive grid with emojis (👑 for Queens, ⬛/⬜ for the board). The user inputs row/column coordinates to place queens.
  2. Web App Version (Vanilla JS): A browser-based visualizer in the web-app/js/projects/ directory. It will have a visual chessboard where users can click to place queens. It will feature an "Auto-Solve" button that visually animates the backtracking algorithm, placing and removing queens automatically so users can watch the algorithm "think."

🛠️ Suggested Implementation

For Python (CLI):

  • Create games/N-Queens-Clash/N-Queens-Clash.py.
  • Use a simple while loop (keeping procedural style where possible) to take user input for row and col.
  • Use emojis (✅, ❌, 👑, 🎯) for prompts, success, and error messages as required by the contribution guidelines.
  • Validate inputs mathematically (checking diagonals, rows, columns).

For Web App (HTML/CSS/Vanilla JS):

  • Create web-app/js/projects/n-queens-clash.js.
  • Create getNQueensClashHTML() for the DOM structure (chessboard grid).
  • Create initNQueensClash() for the game logic.
  • Register it in projects.js.
  • Use CSS Variables and smooth animations to visually highlight attacking queens in red and safe placements in green.

  • I am a registered GSSoC 2026 contributor.
  • I would like to implement this feature myself.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions