Skip to content

Commit 70ba9d9

Browse files
Merge pull request #1687 from IshitaPrajapati08/feature/queens-logic-puzzle
feat: add Queens Logic Puzzle game
2 parents 561e4fc + 2e7ef32 commit 70ba9d9

8 files changed

Lines changed: 1024 additions & 1 deletion

File tree

11.2 KB
Loading
Lines changed: 144 additions & 0 deletions
Loading
20.9 KB
Loading

web-app/games.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,25 @@ <h3>Sudoku Solver &amp; Game</h3>
636636
<p>Interactive Sudoku puzzle with levels and visual backtracking solver.</p>
637637
</div>
638638

639+
<div
640+
class="project-card"
641+
data-category="games"
642+
data-project="queens-logic-puzzle"
643+
>
644+
<img
645+
class="card-banner"
646+
src="assets/banners/queens-logic-puzzle.webp"
647+
alt="Queens Logic Puzzle"
648+
loading="lazy"
649+
/>
650+
<div class="card-actions">
651+
<button class="btn-play" aria-label="Play Queens Logic Puzzle">Try It</button>
652+
</div>
653+
654+
<h3>Queens Logic Puzzle</h3>
655+
<p>Place queens following row, column, region, and adjacency rules!</p>
656+
</div>
657+
639658

640659
<div
641660
class="project-card"
@@ -844,6 +863,7 @@ <h3>War Card Game</h3>
844863
<script defer src="js/projects/word-scramble.js"></script>
845864
<script defer src="js/projects/spot-the-difference.js"></script>
846865
<script defer src="js/projects/sudoku-game.js"></script>
866+
<script defer src="js/projects/queens-logic-puzzle.js"></script>
847867
<script defer src="js/projects/number-sliding-puzzle.js"></script>
848868
<script defer src="js/projects/chess.js"></script>
849869
<script defer src="js/projects/war-card-game.js"></script>

web-app/generate_banners.py

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,75 @@ def draw_die(ox, oy):
427427
x = gx_min + r * 80 + 40
428428
y = gy_min + c * 80 + 40
429429
v_draw.text((x, y), d, fill=color_accent, anchor="mm")
430+
elif "queens" in n_lower or "logic" in n_lower:
431+
# Draw colored irregular regions with queens - matching the reference design
432+
cx, cy = 400, 225
433+
434+
# Region colors inspired by the reference image (matching glassmorphism theme)
435+
region_colors_queens = [
436+
(219, 112, 147), # Pink/Magenta
437+
(70, 130, 180), # Steel Blue
438+
(144, 238, 144), # Light Green
439+
(255, 215, 0), # Gold/Yellow
440+
(186, 85, 211), # Medium Orchid
441+
(135, 206, 250) # Light Sky Blue
442+
]
443+
444+
# Define irregular regions (6 regions, roughly 6 cells each)
445+
# Each region is a list of (row, col) coordinates
446+
regions_map = {
447+
0: [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2)], # Pink - top-left
448+
1: [(0, 3), (0, 4), (0, 5), (1, 3), (1, 4), (1, 5)], # Blue - top-right
449+
2: [(2, 0), (2, 1), (3, 0), (3, 1), (4, 0), (4, 1)], # Green - left
450+
3: [(2, 2), (2, 3), (3, 2), (3, 3), (4, 2), (4, 3)], # Gold - center
451+
4: [(2, 4), (2, 5), (3, 4), (3, 5), (4, 4), (4, 5)], # Purple - right
452+
5: [(5, 0), (5, 1), (5, 2), (5, 3), (5, 4), (5, 5)] # Light Blue - bottom
453+
}
454+
455+
grid_size = 6
456+
cell_w = 50
457+
cell_h = 50
458+
grid_x = cx - (grid_size * cell_w) // 2
459+
grid_y = cy - (grid_size * cell_h) // 2 + 20
460+
461+
# Draw each cell with region background
462+
for region_id, cells in regions_map.items():
463+
region_col = region_colors_queens[region_id]
464+
for r, c in cells:
465+
x = grid_x + c * cell_w
466+
y = grid_y + r * cell_h
467+
468+
# Draw filled cell with semi-transparent region color
469+
v_draw.rectangle(
470+
[x + 1, y + 1, x + cell_w - 1, y + cell_h - 1],
471+
fill=(*region_col, 100),
472+
outline=(*region_col, 150),
473+
width=2
474+
)
475+
476+
# Draw grid borders
477+
for r in range(grid_size + 1):
478+
v_draw.line([(grid_x, grid_y + r * cell_h), (grid_x + grid_size * cell_w, grid_y + r * cell_h)],
479+
fill=(255, 255, 255, 80), width=1)
480+
for c in range(grid_size + 1):
481+
v_draw.line([(grid_x + c * cell_w, grid_y), (grid_x + c * cell_w, grid_y + grid_size * cell_h)],
482+
fill=(255, 255, 255, 80), width=1)
483+
484+
# Place queens on some cells (solution-like pattern)
485+
queen_positions = [
486+
(0, 1, 0), # Region 0 (Pink)
487+
(1, 4, 1), # Region 1 (Blue)
488+
(2, 1, 2), # Region 2 (Green)
489+
(3, 3, 3), # Region 3 (Gold)
490+
(4, 4, 4), # Region 4 (Purple)
491+
(5, 2, 5) # Region 5 (Light Blue)
492+
]
493+
494+
for region_id, c, r in queen_positions:
495+
x = grid_x + c * cell_w + cell_w // 2
496+
y = grid_y + r * cell_h + cell_h // 2
497+
# Draw glowing queen crown emoji
498+
v_draw.text((x, y), "👑", fill=(255, 255, 255, 255), anchor="mm", font=font_subtitle)
430499
elif "blackjack" in n_lower:
431500
# Playing cards
432501
def draw_card(x, y, val):
@@ -736,7 +805,7 @@ def draw_o(ox, oy):
736805
("Chess Game", "games", "chess.webp"),
737806
("Number Sliding Puzzle", "games", "number-sliding-puzzle.webp"),
738807
("War Card Game", "games", "war-card-game.webp"),
739-
("Minesweeper", "games", "minesweeper.webp"),
808+
("Queens Logic Puzzle", "games", "queens-logic-puzzle.webp"),
740809

741810
# MATH
742811
("AP/GP/AGP/HP Recognizer", "math", "progression-recognizer.webp"),

web-app/index.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@ <h3>Stay Updated</h3>
512512
<script defer src="js/projects/snake.js"></script>
513513
<script defer src="js/projects/spot-the-difference.js"></script>
514514
<script defer src="js/projects/sudoku-game.js"></script>
515+
<script defer src="js/projects/queens-logic-puzzle.js"></script>
516+
<script defer src="js/projects/pattern-recall-game.js"></script>
515517
<script defer src="js/projects/color-palette.js"></script>
516518
<script src="js/projects/caesar-cipher.js"></script>
517519
<script src="js/projects/matrix-calculator.js"></script>
@@ -677,6 +679,20 @@ <h3>Stay Updated</h3>
677679
desc: "Interactive Sudoku with difficulty levels and visual backtracking solver",
678680
tags: "game,puzzle,backtracking,solver",
679681
},
682+
{
683+
project: "queens-logic-puzzle",
684+
title: "Queens Logic Puzzle",
685+
category: "games",
686+
desc: "Place queens following row, column, region, and adjacency rules!",
687+
tags: "game,puzzle,logic,queens,strategy",
688+
},
689+
{
690+
project: "pattern-recall-game",
691+
title: "Pattern Recall Game",
692+
category: "games",
693+
desc: "Watch and recreate the pattern within 10 seconds!",
694+
tags: "game,memory,pattern,recall,puzzle",
695+
},
680696
{
681697
project: "chess",
682698
title: "Chess Game",

web-app/js/projects.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function getProjectHTML(projectName) {
2222
"morse-code": getMorseCodeHTML(),
2323
"tower-of-hanoi": getTowerOfHanoiHTML(),
2424
nqueens: getNQueensHTML(),
25+
"queens-logic-puzzle": getQueensLogicPuzzleHTML(),
2526
"matrix-calculator": () => getMatrixCalculatorHTML(),
2627
"sudoku-game": getSudokuGameHTML(),
2728
"unit-converter": getUnitConverterHTML(),
@@ -57,6 +58,11 @@ function initializeProject(projectName) {
5758
return;
5859
}
5960

61+
if (projectName === "queens-logic-puzzle") {
62+
initQueensLogicPuzzle();
63+
return;
64+
}
65+
6066
const fnName = "init" + toPascalCase(projectName);
6167
const init = window[fnName];
6268

@@ -212,6 +218,17 @@ const projectInstructions = {
212218
"Try to get the highest score",
213219
],
214220
},
221+
"queens-logic-puzzle": {
222+
title: "👑 How to Play Queens Logic Puzzle",
223+
steps: [
224+
"Place one queen in each row, column, and colored region",
225+
"Queens cannot touch horizontally, vertically, or diagonally",
226+
"Click a cell to place a queen, click again to remove it",
227+
"Use Hint to highlight a valid placement",
228+
"Use Undo to revert your last move",
229+
"Solve the puzzle to win!",
230+
],
231+
},
215232
"dice-rolling": {
216233
title: "🎲 How to Use Dice Roller",
217234
steps: [

0 commit comments

Comments
 (0)