Skip to content

lookasdev/linkedin-puzzles

Repository files navigation

🧩 Puzzle Collection - AI-Powered Logic Puzzle Solver & Builder

A modern web-based collection of three classic logic puzzles with AI-assisted building capabilities. Built with vanilla JavaScript and featuring a sleek dark gaming theme.

Puzzle Collection AI-Powered JavaScript

🎮 Featured Puzzles

1. 👑 Queens Puzzle

Objective: Place queens on a grid so that no two queens attack each other, with each colored region containing exactly one queen.

Rules:

  • Grid is divided into numbered colored regions (1-11)
  • Each region must contain exactly one queen
  • No two queens can be on the same row, column, or diagonal
  • Queens cannot attack each other

2. 🌙 Tango Puzzle

Objective: Fill the grid with sun (☀) and moon (☾) symbols following constraint rules.

Rules:

  • Each cell contains either a sun or moon symbol
  • Adjacent cells can have equality (=) or difference (×) constraints
  • No more than 2 consecutive identical symbols in any row/column
  • Each row and column must have exactly half suns and half moons

3. 🔗 Zip Puzzle

Objective: Connect numbered dots in sequence with a continuous path.

Rules:

  • Numbered dots are placed on the grid starting with 1
  • Draw a path connecting all dots in numerical order (1→2→3→...)
  • Walls (thick borders) block movement between adjacent cells
  • Path must visit every numbered dot exactly once
  • Path can only move horizontally or vertically (no diagonal moves)

🤖 AI-Powered Features

Gemini Integration

Each puzzle includes an AI-assisted building mode powered by Google's Gemini API:

  • Screenshot Analysis: Upload or paste puzzle images for automatic recognition
  • Smart Prompt Generation: Contextual prompts optimized for each puzzle type
  • JSON Output: Structured data format for precise puzzle recreation
  • Manual Editing: Fine-tune AI results with interactive editing tools

Build with AI Workflow

  1. Select Grid Size: Choose puzzle dimensions (2x2 to 11x11)
  2. Upload Image: Paste screenshot or upload puzzle image
  3. Generate Prompt: AI creates optimized recognition prompt
  4. Run AI: Gemini analyzes image and returns structured JSON
  5. Apply & Edit: Load results and manually adjust if needed

🧠 Solving Algorithms

Queens Puzzle - Backtracking with Constraint Propagation

ALGORITHM: Recursive Backtracking
1. Place queens row by row (one queen per row)
2. For each row, try each column position
3. Check constraints:
   - No column conflicts (only one queen per column)
   - No diagonal conflicts (|r1-r2| ≠ |c1-c2|)
   - Region constraints (one queen per colored region)
4. If valid placement, recurse to next row
5. If no valid placement, backtrack and try next position

TIME COMPLEXITY: O(N!) in worst case, but pruning makes it much faster
SPACE COMPLEXITY: O(N) for recursion stack

Tango Puzzle - Constraint Satisfaction with Backtracking

ALGORITHM: Backtracking with Constraint Validation
1. Fill cells one by one with sun (1) or moon (0)
2. For each cell, try both values
3. Check constraints after each placement:
   - Row/column balance (exactly N/2 suns and moons)
   - No more than 2 consecutive identical symbols
   - Equality constraints (= edges must have same values)
   - Difference constraints (× edges must have different values)
4. If constraints violated, backtrack
5. If all cells filled successfully, solution found

TIME COMPLEXITY: O(2^N) worst case, pruned by constraint checking
SPACE COMPLEXITY: O(N²) for grid state

Zip Puzzle - Depth-First Search with Path Tracking

ALGORITHM: DFS with Path Validation
1. Start from dot #1, maintain current path
2. For each position, try all 4 directions (up/down/left/right)
3. Check movement validity:
   - No walls blocking the path
   - Stay within grid boundaries
   - Don't revisit cells (except for backtracking)
4. When reaching next numbered dot, continue from that position
5. Solution found when all dots connected in sequence

TIME COMPLEXITY: O(4^(N²)) worst case, pruned by wall constraints
SPACE COMPLEXITY: O(N²) for visited tracking and path storage

🚀 Getting Started

Prerequisites

  • Modern web browser with JavaScript enabled
  • Gemini API key (for AI features)

Installation

  1. Clone the repository:

    git clone https://github.com/lookasdev/linkedin-puzzles.git
    cd linkedin-puzzles
  2. Open index.html in your web browser or go to https://linkle-demo.netlify.app/

  3. (Optional) Set up Gemini API key:

    • Get API key from Google AI Studio
    • Enter key in the main page - it will be saved locally
    • Key persists across all puzzle sessions

Usage

  1. Select a Puzzle: Choose from Queens, Tango, or Zip
  2. Solve Mode: Use existing puzzles with the built-in solver
  3. Build Mode: Create new puzzles manually or with AI assistance
  4. AI Mode: Upload puzzle images for automatic recognition

📁 Project Structure

linkedin-puzzles/
├── index.html          # Main entry point with puzzle selection
├── styles.css          # Unified dark gaming theme
├── queens.html         # Queens puzzle interface
├── queens.js           # Queens puzzle logic & solver
├── tango.html          # Tango puzzle interface  
├── tango.js            # Tango puzzle logic & solver
├── zip.html            # Zip puzzle interface
├── zip.js              # Zip puzzle logic & solver
└── README.md           # This file

Enjoy solving and building puzzles! 🧩✨

About

Linkle - solver for linkedin zip, tango and queens puzzles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors