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 @@ -97,6 +97,7 @@ The home page lists one **Games Hub** card (`games/`). Individual games live on
- **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
- **More Dots** (`games/more/`) — two panels of dots; tap Left, Equal, or Right for the side with more; counts get closer and view time shrinks with the streak; best streak
- **Glow Grid** (`games/glow/`) — 12-level logic puzzle from 3×3 to 5×5; each tap flips a cell and its four neighbours, light every cell; par-move and time bonuses, pause and restart; best total score

#### Casual Quiz (unlisted)

Expand Down
74 changes: 74 additions & 0 deletions assets/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -1756,3 +1756,77 @@ body[data-tool="collab"] .site-footer { display: none; }
-webkit-user-select: text;
user-select: text;
}

/* Level games (Glow Grid, Echo Path): shared layout */
.lv-help {
margin: 0 0 1rem;
padding: 0.75rem 1rem;
background: var(--color-card);
border: 1px solid var(--color-line);
border-radius: var(--radius);
font-size: 0.85rem;
color: var(--color-muted);
}
.lv-help summary {
cursor: pointer;
font-weight: 700;
color: var(--color-text);
min-height: 44px;
display: flex;
align-items: center;
}
.lv-help ul { margin: 0.25rem 0 0.4rem; padding-left: 1.2rem; }
.lv-stage {
position: relative;
width: min(100%, 420px);
}
.lv-grid {
display: grid;
grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
gap: 0.5rem;
width: 100%;
}
.lv-cell {
aspect-ratio: 1;
min-width: 44px;
min-height: 44px;
padding: 0;
border-radius: 12px;
border: 1px solid var(--color-line);
background: linear-gradient(145deg, #1c2844, #121a2c);
color: var(--color-text);
font-family: inherit;
font-weight: 800;
cursor: pointer;
transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
}
.lv-cell:hover:not(:disabled) { border-color: rgba(255, 195, 0, 0.5); }
.lv-cell:disabled { cursor: default; }
.lv-cell:active:not(:disabled) { transform: scale(0.96); }
.lv-cell.is-on {
background: linear-gradient(145deg, #c9a000, #ffc300);
border-color: #ffc300;
color: var(--color-bg);
box-shadow: 0 0 0 2px rgba(255, 195, 0, 0.3);
}
.lv-cell.is-ok {
background: linear-gradient(145deg, #15803d, #4ade80);
border-color: #86efac;
}
.lv-cell.is-miss {
background: linear-gradient(145deg, #b91c1c, #f87171);
border-color: #fecaca;
}
.lv-paused {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
background: rgba(12, 21, 36, 0.94);
border-radius: var(--radius);
font-weight: 800;
font-size: 1.1rem;
color: var(--color-accent);
}
.lv-paused[hidden] { display: none; }
269 changes: 269 additions & 0 deletions games/glow/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Glow Grid | RMKR Toolkit</title>
<meta name="description" content="A multi-level logic puzzle: each tap flips a cell and its neighbours. Light the whole grid in as few moves as you can. Best score saved locally.">
<link rel="icon" type="image/svg+xml" href="../../assets/favicon.svg">
<link rel="stylesheet" href="../../assets/site.css">
<script src="../../assets/site.js" defer></script>
</head>
<body class="game-page" data-root="../../" data-tool="glow">
<main class="wrap page-main" id="main">
<a class="game-back" href="../">← Focus Games</a>
<h1 class="page-title">Glow Grid</h1>
<p class="page-lead">Every tap flips a cell <strong>and</strong> the cells above, below, left and right of it. Turn the whole grid gold. Twelve levels, from 3×3 up to 5×5.</p>

<details class="lv-help">
<summary>How to play</summary>
<ul>
<li>Tap a cell to flip it and its four neighbours (gold ↔ dark).</li>
<li>Clear a level by making every cell gold.</li>
<li>Each level has a <em>par</em> move count. Finish at or under par for a bonus; speed adds a little more.</li>
<li>Tapping the same cell twice undoes it, so think before you tap.</li>
<li>Keyboard: arrow keys move, Enter or Space taps, P pauses, R restarts the level.</li>
<li>Your best total score stays in this browser only.</li>
</ul>
</details>

<div class="game-hud">
<div class="game-hud-stats">
<span>Level: <strong id="level">1</strong>/12</span>
<span>Moves: <strong id="moves">0</strong> (par <strong id="par">—</strong>)</span>
<span>Time: <strong id="time">0s</strong></span>
<span>Score: <strong id="score">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>
<button type="button" class="btn btn-ghost" id="pauseBtn" disabled>Pause</button>
<button type="button" class="btn btn-ghost" id="resetBtn" disabled>Restart level</button>
</div>
</div>
<p class="game-note" id="note" role="status">Press Start to begin at level 1.</p>
<div class="game-board-wrap">
<div class="lv-stage">
<div class="lv-grid" id="grid" role="grid" aria-label="Glow Grid board"></div>
<div class="lv-paused" id="paused" hidden>Paused</div>
</div>
</div>
</main>
<script>
(function () {
var KEY = "rmkr-game-glow-best";
var LEVELS = [
{ n: 3, taps: 2 }, { n: 3, taps: 3 }, { n: 3, taps: 4 },
{ n: 4, taps: 3 }, { n: 4, taps: 4 }, { n: 4, taps: 5 }, { n: 4, taps: 6 },
{ n: 5, taps: 4 }, { n: 5, taps: 5 }, { n: 5, taps: 6 }, { n: 5, taps: 7 }, { n: 5, taps: 8 }
];
var gridEl = document.getElementById("grid");
var startBtn = document.getElementById("startBtn");
var pauseBtn = document.getElementById("pauseBtn");
var resetBtn = document.getElementById("resetBtn");
var pausedEl = document.getElementById("paused");

var level = 0, n = 3, cells = [], startCells = [], par = 0, moves = 0;
var score = 0, playing = false, paused = false, busy = false;
var seconds = 0, ticker = null, focusIdx = 0;

function $(id) { return document.getElementById(id); }
function loadBest() {
try {
var v = parseInt(localStorage.getItem(KEY) || "", 10);
return Number.isFinite(v) && v > 0 ? v : null;
} catch (e) { return null; }
}
function saveBest(v) {
var cur = loadBest();
if (v > 0 && (cur == null || v > cur)) {
try { localStorage.setItem(KEY, String(v)); } catch (e) {}
return true;
}
return false;
}
function setNote(msg, kind) {
var el = $("note");
el.textContent = msg || "";
el.className = "game-note" + (kind ? " " + kind : "");
}
function renderHud() {
$("level").textContent = String(level + 1);
$("moves").textContent = String(moves);
$("par").textContent = par ? String(par) : "—";
$("time").textContent = seconds + "s";
$("score").textContent = String(score);
var b = loadBest();
$("best").textContent = b == null ? "—" : String(b);
}
function startTicker() {
stopTicker();
ticker = setInterval(function () {
if (playing && !paused && !busy) { seconds += 1; $("time").textContent = seconds + "s"; }
}, 1000);
}
function stopTicker() { if (ticker) { clearInterval(ticker); ticker = null; } }

function flip(arr, i) {
var r = Math.floor(i / n), c = i % n;
var list = [[r, c], [r - 1, c], [r + 1, c], [r, c - 1], [r, c + 1]];
for (var k = 0; k < list.length; k++) {
var rr = list[k][0], cc = list[k][1];
if (rr >= 0 && rr < n && cc >= 0 && cc < n) arr[rr * n + cc] = !arr[rr * n + cc];
}
}
function solved() {
for (var i = 0; i < cells.length; i++) if (!cells[i]) return false;
return true;
}
function makeLevel(idx) {
var cfg = LEVELS[idx];
n = cfg.n;
var arr, picks;
do {
arr = [];
for (var i = 0; i < n * n; i++) arr.push(true);
picks = [];
while (picks.length < cfg.taps) {
var p = Math.floor(Math.random() * n * n);
if (picks.indexOf(p) === -1) picks.push(p);
}
for (var j = 0; j < picks.length; j++) flip(arr, picks[j]);
} while (arr.every(function (v) { return v; }));
par = cfg.taps;
return arr;
}
function buildGrid() {
gridEl.innerHTML = "";
gridEl.style.setProperty("--n", String(n));
for (var i = 0; i < n * n; i++) {
var b = document.createElement("button");
b.type = "button";
b.className = "lv-cell";
b.dataset.index = String(i);
b.tabIndex = i === focusIdx ? 0 : -1;
b.addEventListener("click", function () { onTap(Number(this.dataset.index)); });
gridEl.appendChild(b);
}
paint();
}
function paint() {
var bs = gridEl.children;
for (var i = 0; i < bs.length; i++) {
bs[i].classList.toggle("is-on", !!cells[i]);
bs[i].classList.remove("is-ok");
bs[i].setAttribute("aria-label", "Row " + (Math.floor(i / n) + 1) + " column " + (i % n + 1) + (cells[i] ? ", gold" : ", dark"));
bs[i].disabled = !playing || paused || busy;
}
}
function loadLevel(idx, fresh) {
level = idx;
if (fresh || !startCells.length) startCells = makeLevel(idx);
cells = startCells.slice();
moves = 0;
seconds = 0;
busy = false;
focusIdx = Math.min(focusIdx, n * n - 1);
buildGrid();
renderHud();
setNote("Level " + (idx + 1) + ": light every cell. Par is " + par + ".");
}
function onTap(i) {
if (!playing || paused || busy) return;
focusIdx = i;
flip(cells, i);
moves += 1;
paint();
renderHud();
if (solved()) levelClear();
}
function levelClear() {
busy = true;
var base = 100 * (level + 1);
var parBonus = Math.max(0, par * 2 - moves) * 25;
var timeBonus = Math.max(0, 60 - seconds) * 2;
var gained = base + parBonus + timeBonus;
score += gained;
var bs = gridEl.children;
for (var i = 0; i < bs.length; i++) { bs[i].classList.add("is-ok"); bs[i].disabled = true; }
var isBest = saveBest(score);
renderHud();
if (level + 1 >= LEVELS.length) {
playing = false;
stopTicker();
pauseBtn.disabled = true;
resetBtn.disabled = true;
startBtn.textContent = "Play again";
setNote("All 12 levels cleared! Final score " + score + (isBest ? " — new best!" : "."), "ok");
return;
}
setNote("Cleared in " + moves + " moves (+" + gained + "). Next level…", "ok");
setTimeout(function () {
if (!playing) return;
startCells = [];
loadLevel(level + 1, true);
}, 1100);
}
function startGame() {
playing = true;
paused = false;
score = 0;
startCells = [];
pausedEl.hidden = true;
startBtn.textContent = "New game";
pauseBtn.disabled = false;
pauseBtn.textContent = "Pause";
resetBtn.disabled = false;
loadLevel(0, true);
startTicker();
var first = gridEl.children[focusIdx];
if (first) first.focus({ preventScroll: true });
}
function togglePause() {
if (!playing) return;
paused = !paused;
pausedEl.hidden = !paused;
pauseBtn.textContent = paused ? "Resume" : "Pause";
paint();
setNote(paused ? "Paused. Timer stopped." : "Back to it. Level " + (level + 1) + ".");
}
function restartLevel() {
if (!playing || busy) return;
if (paused) togglePause();
loadLevel(level, false);
setNote("Level " + (level + 1) + " reset. Par is " + par + ".");
}
startBtn.addEventListener("click", startGame);
pauseBtn.addEventListener("click", togglePause);
resetBtn.addEventListener("click", restartLevel);

document.addEventListener("keydown", function (e) {
if (e.ctrlKey || e.metaKey || e.altKey) return;
var k = e.key;
if (k === "p" || k === "P") { togglePause(); e.preventDefault(); return; }
if (k === "r" || k === "R") { restartLevel(); e.preventDefault(); return; }
if (!playing || paused || busy) return;
var r = Math.floor(focusIdx / n), c = focusIdx % n, moved = true;
if (k === "ArrowUp") r = Math.max(0, r - 1);
else if (k === "ArrowDown") r = Math.min(n - 1, r + 1);
else if (k === "ArrowLeft") c = Math.max(0, c - 1);
else if (k === "ArrowRight") c = Math.min(n - 1, c + 1);
else moved = false;
if (moved) {
e.preventDefault();
var bs = gridEl.children;
bs[focusIdx].tabIndex = -1;
focusIdx = r * n + c;
bs[focusIdx].tabIndex = 0;
bs[focusIdx].focus();
}
});
n = LEVELS[0].n;
cells = [];
for (var i = 0; i < n * n; i++) cells.push(false);
buildGrid();
renderHud();
})();
</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">
<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, spot the change, and more dots. 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, more dots, and glow grid. 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 @@ -109,6 +109,10 @@ <h3>Spot the Change</h3>
<h3>More Dots</h3>
<p>Two panels of dots flash up. Tap Left, Equal, or Right for the side with more — the gap narrows as you go.</p>
</a>
<a class="tool-card ai-card-accent" href="glow/">
<h3>Glow Grid</h3>
<p>Twelve-level logic puzzle. Each tap flips a cell and its neighbours — light the whole grid near par for a high score.</p>
</a>
</div>

<h2 class="section-title">How it works</h2>
Expand Down
Loading