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 @@ -94,6 +94,7 @@ The home page lists one **Games Hub** card (`games/`). Individual games live on
- **Same as Last** (`games/same/`) — shapes appear one at a time; tap Same or Different versus the previous shape; best streak
- **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
- **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
44 changes: 44 additions & 0 deletions assets/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -1649,3 +1649,47 @@ body[data-tool="collab"] .site-footer { display: none; }
margin: 0 auto 1rem;
user-select: none;
}

/* Turned or Flipped */
.turn-pair {
display: flex;
gap: 0.85rem;
align-items: stretch;
justify-content: center;
width: 100%;
}
.turn-card {
flex: 1 1 0;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.4rem;
min-width: 0;
}
.turn-label {
font-size: 0.72rem;
font-weight: 700;
color: var(--color-muted);
text-transform: uppercase;
letter-spacing: 0.06em;
}
.turn-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 4px;
width: min(128px, 34vw);
aspect-ratio: 1;
padding: 0.55rem;
border-radius: 14px;
border: 1px solid var(--color-line);
background: var(--color-card);
}
.turn-cell {
border-radius: 6px;
background: rgba(255, 255, 255, 0.04);
min-height: 0;
aspect-ratio: 1;
}
.turn-cell.is-on {
background: linear-gradient(145deg, #c9a000, #ffc300);
}
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, 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, 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 @@ -97,6 +97,10 @@ <h3>Light Recall</h3>
<h3>Go Stop</h3>
<p>Gold means tap. Muted means wait it out. A go/no-go drill that tightens as your streak grows.</p>
</a>
<a class="tool-card ai-card-accent" href="turn/">
<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="quiz/">
<h3>Casual Quiz</h3>
<p>Multiple-choice on India, Tamil Nadu, science, tech, and more. Switch topic or level anytime.</p>
Expand Down
207 changes: 207 additions & 0 deletions games/turn/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Turned or Flipped | RMKR Toolkit</title>
<meta name="description" content="Compare two shapes. Is the second one rotated, or mirrored? Mental-rotation drill with a streak. 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="turn">
<main class="wrap page-main" id="main">
<a class="game-back" href="../">← Focus Games</a>
<h1 class="page-title">Turned or Flipped</h1>
<p class="page-lead">A reference shape sits on the left. The right one is either <strong>turned</strong> (rotated) or <strong>flipped</strong> (mirrored). Tap which it is.</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. Keyboard: T or ← for Turned, F or → for Flipped.</p>
<div class="game-board-wrap">
<div class="even-stage" id="stage" aria-live="polite" aria-label="Turned or Flipped board">
<div class="turn-pair" id="pair" hidden>
<div class="turn-card">
<span class="turn-label">Reference</span>
<div class="turn-grid" id="refGrid" aria-label="Reference shape"></div>
</div>
<div class="turn-card">
<span class="turn-label">Probe</span>
<div class="turn-grid" id="probeGrid" aria-label="Probe shape"></div>
</div>
</div>
<div class="even-actions" id="actions" hidden></div>
</div>
</div>
</main>
<script>
(function () {
var KEY = "rmkr-game-turn-best";
// Chiral 3×3 polyominoes — mirror cannot be reached by rotation alone.
var SHAPES = [
[[1, 0, 0], [1, 0, 0], [1, 1, 0]],
[[0, 0, 1], [0, 0, 1], [0, 1, 1]],
[[0, 1, 1], [1, 1, 0], [0, 0, 0]],
[[1, 1, 0], [0, 1, 1], [0, 0, 0]],
[[1, 0, 0], [1, 1, 0], [0, 1, 0]],
[[0, 0, 1], [0, 1, 1], [0, 1, 0]]
];
var streak = 0, playing = false, busy = true, answer = null;
var refGrid = document.getElementById("refGrid");
var probeGrid = document.getElementById("probeGrid");
var pair = document.getElementById("pair");
var actions = document.getElementById("actions");
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 clone(g) {
return g.map(function (row) { return row.slice(); });
}
function rotate90(g) {
var n = g.length, out = [];
for (var r = 0; r < n; r++) {
out[r] = [];
for (var c = 0; c < n; c++) out[r][c] = g[n - 1 - c][r];
}
return out;
}
function mirrorH(g) {
return g.map(function (row) { return row.slice().reverse(); });
}
function rotateN(g, n) {
var out = clone(g);
for (var i = 0; i < n; i++) out = rotate90(out);
return out;
}
function same(a, b) {
for (var r = 0; r < a.length; r++) {
for (var c = 0; c < a[r].length; c++) {
if (a[r][c] !== b[r][c]) return false;
}
}
return true;
}
function paint(el, g) {
el.innerHTML = "";
for (var r = 0; r < 3; r++) {
for (var c = 0; c < 3; c++) {
var cell = document.createElement("span");
cell.className = "turn-cell" + (g[r][c] ? " is-on" : "");
el.appendChild(cell);
}
}
}
function buildProbe(base) {
// Prefer a probe that is not identical to the reference.
var tries = 0;
while (tries < 24) {
tries += 1;
var flipped = Math.random() < 0.5;
var extra = 1 + Math.floor(Math.random() * 3);
var probe = flipped ? rotateN(mirrorH(base), extra) : rotateN(base, extra);
if (same(probe, base)) continue;
// Confirm chirality: flipped probes must not match any pure rotation.
if (flipped) {
var isAlsoRotation = false;
for (var k = 0; k < 4; k++) {
if (same(probe, rotateN(base, k))) { isAlsoRotation = true; break; }
}
if (isAlsoRotation) continue;
}
return { probe: probe, flipped: flipped };
}
// Fallback: mirror once without extra rotation if needed.
var fb = mirrorH(base);
if (same(fb, base)) fb = rotateN(mirrorH(base), 1);
return { probe: fb, flipped: true };
}
function round() {
busy = true;
answer = null;
var base = rotateN(SHAPES[Math.floor(Math.random() * SHAPES.length)], Math.floor(Math.random() * 4));
var built = buildProbe(base);
answer = built.flipped ? "flipped" : "turned";
paint(refGrid, base);
paint(probeGrid, built.probe);
setNote("Turned (rotated) or Flipped (mirrored)?");
busy = false;
}
function guess(choice) {
if (!playing || busy || !answer) return;
busy = true;
if (choice === answer) {
streak += 1;
var best = saveBest(streak);
render();
setNote("Correct — it was " + answer + ". Streak " + streak + (best === streak ? " — new best!" : "."), "ok");
setTimeout(function () { if (playing) round(); }, 420);
return;
}
var ended = streak;
streak = 0;
playing = false;
render();
setNote("It was " + answer + (ended > 0 ? ". Streak reset from " + ended + "." : ". Press Play again."), "err");
startBtn.textContent = "Play again";
}

[["turned", "Turned"], ["flipped", "Flipped"]].forEach(function (p) {
var b = document.createElement("button");
b.type = "button";
b.className = "btn even-btn";
b.textContent = p[1];
b.setAttribute("aria-label", p[1]);
b.addEventListener("click", function () { guess(p[0]); });
actions.appendChild(b);
});
document.addEventListener("keydown", function (e) {
var k = e.key.toLowerCase();
if (k === "t" || e.key === "ArrowLeft") { e.preventDefault(); guess("turned"); }
else if (k === "f" || e.key === "ArrowRight") { e.preventDefault(); guess("flipped"); }
});
startBtn.addEventListener("click", function () {
playing = true;
busy = true;
streak = 0;
render();
pair.hidden = false;
actions.hidden = false;
startBtn.textContent = "Restart";
round();
});
render();
})();
</script>
</body>
</html>
Loading