Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ The home page lists one **Games Hub** card (`games/`). Individual games live on
- **Light Recall** (`games/recall/`) — a few cells flash gold; tap every one you saw; one more cell per level, 3×3 growing to 4×4; best level
- **Go Stop** (`games/stop/`) — tap on GO, hold still on STOP; time window tightens with the streak; best streak
- **Turned or Flipped** (`games/turn/`) — reference vs probe shape; tap whether the probe is rotated or mirrored; best streak
- **Spot the Change** (`games/change/`) — a grid of shapes blinks off and returns with one cell changed in shape or color; tap it; 3×3 growing to 4×4, look time shrinks with the streak; best streak
- **Casual Quiz** (`games/quiz/`) — multiple-choice on India, Tamil Nadu, science, technology, and more, plus a General mix. Switch topic or level anytime. Marks stay in `localStorage`. Questions live only in `games/quiz/questions.json`.

#### How to add or change quiz questions
Expand Down
16 changes: 16 additions & 0 deletions assets/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -1693,3 +1693,19 @@ body[data-tool="collab"] .site-footer { display: none; }
.turn-cell.is-on {
background: linear-gradient(145deg, #c9a000, #ffc300);
}

/* Spot the Change (reuses Pop Light cells) */
.change-cell {
display: flex;
align-items: center;
justify-content: center;
}
.change-sym {
width: 58%;
height: 58%;
pointer-events: none;
}
.change-grid.is-4 .change-sym {
width: 62%;
height: 62%;
}
205 changes: 205 additions & 0 deletions games/change/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spot the Change | RMKR Toolkit</title>
<meta name="description" content="A grid of shapes shows for a moment, blinks off, and comes back with one cell changed. Tap the one that changed. Best streak saved locally.">
<link rel="icon" type="image/svg+xml" href="../../assets/favicon.svg">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="../../assets/site.css">
<script src="../../assets/site.js" defer></script>
</head>
<body data-root="../../" data-tool="change">
<main class="wrap page-main" id="main">
<a class="game-back" href="../">← Focus Games</a>
<h1 class="page-title">Spot the Change</h1>
<p class="page-lead">Study the grid of shapes. It blinks off for a moment and comes back with <strong>one</strong> cell changed — a new shape or a new color. Tap the cell that changed.</p>
<div class="game-hud">
<div class="game-hud-stats">
<span>Streak: <strong id="streak">0</strong></span>
<span>Best: <strong id="best">—</strong></span>
</div>
<div class="game-hud-actions">
<button type="button" class="btn btn-gold" id="startBtn">Start</button>
</div>
</div>
<p class="game-note" id="note" role="status">Press Start. Look, wait for the blink, then tap what changed.</p>
<div class="game-board-wrap">
<div class="pop-stage" id="stage" aria-live="polite" aria-label="Spot the Change board">
<div class="pop-grid change-grid" id="grid" hidden aria-label="Shape grid"></div>
</div>
</div>
</main>
<script>
(function () {
var KEY = "rmkr-game-change-best";
var SHAPES = ["circle", "square", "triangle", "diamond", "ring"];
var COLORS = [
{ id: "gold", hex: "#ffc300" },
{ id: "sky", hex: "#38bdf8" },
{ id: "mint", hex: "#4ade80" },
{ id: "rose", hex: "#f472b6" },
{ id: "pearl", hex: "#e5e7eb" }
];
var BLANK_MS = 450;
var streak = 0, playing = false, busy = true, roundId = 0, changed = -1;
var gridEl = document.getElementById("grid");
var startBtn = document.getElementById("startBtn");

function loadBest() {
try {
var v = parseInt(localStorage.getItem(KEY) || "", 10);
return Number.isFinite(v) && v > 0 ? v : null;
} catch (e) { return null; }
}
function saveBest(n) {
var cur = loadBest();
if (cur == null || n > cur) {
try { localStorage.setItem(KEY, String(n)); } catch (e) {}
return n;
}
return cur;
}
function setNote(msg, kind) {
var el = document.getElementById("note");
el.textContent = msg || "";
el.className = "game-note" + (kind ? " " + kind : "");
}
function render() {
document.getElementById("streak").textContent = String(streak);
var b = loadBest();
document.getElementById("best").textContent = b == null ? "—" : String(b);
}
function rand(n) { return Math.floor(Math.random() * n); }

// 3×3 for the first 8 in a streak, then 4×4. Look time shrinks with the streak.
function sizeFor(s) { return s < 8 ? 3 : 4; }
function lookMs(s) {
if (s < 8) return Math.max(1100, 1800 - s * 90);
return Math.max(1000, 2000 - (s - 8) * 80);
}

function svgFor(item) {
var c = COLORS[item.color].hex;
var body;
switch (SHAPES[item.shape]) {
case "circle": body = '<circle cx="20" cy="20" r="13" fill="' + c + '"/>'; break;
case "square": body = '<rect x="8" y="8" width="24" height="24" rx="3" fill="' + c + '"/>'; break;
case "triangle": body = '<path d="M20 6 L34 32 H6 Z" fill="' + c + '"/>'; break;
case "diamond": body = '<path d="M20 5 L35 20 L20 35 L5 20 Z" fill="' + c + '"/>'; break;
default: body = '<circle cx="20" cy="20" r="11" fill="none" stroke="' + c + '" stroke-width="5"/>';
}
return '<svg class="change-sym" viewBox="0 0 40 40" aria-hidden="true">' + body + "</svg>";
}
function label(item) {
return COLORS[item.color].id + " " + SHAPES[item.shape];
}

function build(size) {
gridEl.innerHTML = "";
gridEl.classList.toggle("is-4", size === 4);
for (var i = 0; i < size * size; i++) {
var b = document.createElement("button");
b.type = "button";
b.className = "pop-cell change-cell";
b.disabled = true;
b.dataset.idx = String(i);
b.addEventListener("click", onTap);
gridEl.appendChild(b);
}
}
function cells() { return gridEl.querySelectorAll(".pop-cell"); }
function paint(items) {
cells().forEach(function (cell, i) {
if (items) {
cell.innerHTML = svgFor(items[i]);
cell.setAttribute("aria-label", "Cell " + (i + 1) + ": " + label(items[i]));
} else {
cell.innerHTML = "";
cell.setAttribute("aria-label", "Cell " + (i + 1) + ": hidden");
}
});
}
function setEnabled(on) { cells().forEach(function (c) { c.disabled = !on; }); }

function makeItems(count) {
var items = [];
for (var i = 0; i < count; i++) items.push({ shape: rand(SHAPES.length), color: rand(COLORS.length) });
return items;
}
function mutate(item) {
var next = { shape: item.shape, color: item.color };
if (Math.random() < 0.5) {
next.shape = (item.shape + 1 + rand(SHAPES.length - 1)) % SHAPES.length;
} else {
next.color = (item.color + 1 + rand(COLORS.length - 1)) % COLORS.length;
}
return next;
}

function round() {
busy = true;
roundId += 1;
var id = roundId;
var size = sizeFor(streak);
build(size);
var before = makeItems(size * size);
changed = rand(before.length);
var after = before.slice();
after[changed] = mutate(before[changed]);
paint(before);
setNote("Look closely…");
setTimeout(function () {
if (id !== roundId || !playing) return;
paint(null);
setNote("Blink…");
setTimeout(function () {
if (id !== roundId || !playing) return;
paint(after);
setEnabled(true);
busy = false;
setNote("Tap the cell that changed.");
}, BLANK_MS);
}, lookMs(streak));
}

function onTap(e) {
if (!playing || busy) return;
busy = true;
setEnabled(false);
var idx = parseInt(e.currentTarget.dataset.idx, 10);
var all = cells();
all[changed].classList.add("is-correct");
if (idx === changed) {
streak += 1;
var best = saveBest(streak);
render();
setNote("Spotted it. Streak " + streak + (best === streak ? " — new best!" : "."), "ok");
var id = roundId;
setTimeout(function () { if (playing && id === roundId) round(); }, 650);
return;
}
all[idx].classList.add("is-miss");
var ended = streak;
streak = 0;
playing = false;
render();
setNote("The change was the green cell" + (ended > 0 ? ". Streak reset from " + ended + "." : ". Press Play again."), "err");
startBtn.textContent = "Play again";
}

startBtn.addEventListener("click", function () {
playing = true;
streak = 0;
render();
gridEl.hidden = false;
startBtn.textContent = "Restart";
round();
});
render();
})();
</script>
</body>
</html>
6 changes: 5 additions & 1 deletion games/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Focus Games | RMKR Toolkit</title>
<meta name="description" content="Simple browser focus games — memory, sequence, number slide, word scramble, reaction tap, tap order, color clash, odd one out, higher or lower, quick math, find-the-number, pop light, sum pair, missing number, even or odd, count the dots, middle arrow, same as last, light recall, go stop, turned or flipped, and a casual quiz. No accounts, works offline after load.">
<meta name="description" content="Simple browser focus games — memory, sequence, number slide, word scramble, reaction tap, tap order, color clash, odd one out, higher or lower, quick math, find-the-number, pop light, sum pair, missing number, even or odd, count the dots, middle arrow, same as last, light recall, go stop, turned or flipped, spot the change, and a casual quiz. No accounts, works offline after load.">
<link rel="icon" type="image/svg+xml" href="../assets/favicon.svg">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;900&display=swap" rel="stylesheet">
Expand Down Expand Up @@ -101,6 +101,10 @@ <h3>Go Stop</h3>
<h3>Turned or Flipped</h3>
<p>Two shapes side by side. Is the second rotated, or mirrored? A quick mental-rotation drill.</p>
</a>
<a class="tool-card ai-card-accent" href="change/">
<h3>Spot the Change</h3>
<p>A grid of shapes blinks off and back on with one cell changed. Tap the one that changed.</p>
</a>
<a class="tool-card ai-card-accent" href="quiz/">
<h3>Casual Quiz</h3>
<p>Multiple-choice on India, Tamil Nadu, science, tech, and more. Switch topic or level anytime.</p>
Expand Down
Loading