DEV Community

Rory
Rory

Posted on Edited on

How I Built a Spinning Schulte Table Game

Every developer has that moment: you're scrolling through X at 11 PM and see someone post a tiny game they made over the weekend. "I could do that," you think. But then Sunday comes and goes, and you never start.

I decided to stop just thinking about it. Over one weekend, I built Spinning Schulte Table — a brain-training focus game that runs entirely in the browser. No React, no Three.js, no complex build pipeline. Just HTML, CSS, and vanilla JavaScript.

Here's how I did it.

What is a Schulte Table?
If you've never heard of it, the Schulte table is a classic focus and attention exercise. You get a grid of scattered numbers, and your goal is to tap them in order: 1, 2, 3, … all the way to the final number. A timer tracks how fast you finish.

It is widely used for focus training, and even pilots use it to improve peripheral vision and sustained attention.

My twist: the whole table slowly rotates while you play. Now your eyes have to track numbers on a spinning board, which adds a fun extra challenge.

The core idea
The game has three core pieces:
Generate a grid — randomize numbers and place them on screen
Rotate the container — run a smooth CSS animation to spin the whole board
Track taps — check whether the player clicks numbers in the correct order

Let me break each part down.

Generating the number grid
The simplest approach: create an array of sequential numbers, shuffle it, then render each number as an interactive tile.

function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}

function generateNumbers(size) {
const total = size * size;
const numbers = Array.from({ length: total }, (_, i) => i + 1);
return shuffle(numbers);
}

For positioning, I use absolute positioning inside a square container. Every number tile gets a random position inside the grid boundary, plus a small individual rotation:

function positionNumber(index, total, containerSize) {
const angle = (index / total) * Math.PI * 2;
const radius = containerSize / 2 * 0.8;
const x = containerSize / 2 + Math.cos(angle) * radius;
const y = containerSize / 2 + Math.sin(angle) * radius;
return { x, y };
}

This creates a spiral-like layout instead of a rigid grid, which makes it visually interesting and harder to track numbers.

The rotation trick
This part was simpler than I expected. I wrapped all number tiles inside one parent container and applied a continuous CSS rotation animation:

.game-board {
position: relative;
width: 500px;
height: 500px;
animation: rotate 60s linear infinite;
}
@keyframes rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}

That’s it. One CSS keyframe animation spins the whole board slowly. Players have to find and tap numbers while everything keeps turning.

Tracking taps
Each tile listens for click events. When a player taps, we check if this number is the next one in sequence.

let nextNumber = 1;
let mistakes = 0;
function handleNumberClick(value) {
if (value === nextNumber) {
value.classList.add('correct');
nextNumber++;
if (nextNumber > gridTotal) {
finishGame();
}
} else {
mistakes++;
value.classList.add('mistake');
setTimeout(() => value.classList.remove('mistake'), 800);
}
}

The timer starts on the first click and stops once you finish all numbers.

What I learned
Vanilla JavaScript is enough for small browser games. You don’t always need heavy game engines or frameworks. The hardest part was balancing the rotation speed — fast enough to feel challenging, slow enough that players can still read the numbers.

CSS animations are surprisingly powerful. A single rotation animation creates almost all of the unique feeling of this game.

It’s easy to overbuild. I skipped multiplayer, save systems, and fancy visual effects. I shipped one core mechanic and polished it until it was fun.

Try it
The game is live, free to play directly in your browser:
👉 Spinning Schulte Table

No download or sign-up required. Open it, tap numbers in order to finish while the board spins. Let me know your best time!

Note: this demo is hosted locally on my PC, so please be patient if there is a connection hiccup.

What's next
The game already has adjustable difficulty levels (3×3 up to 10×10) and a leaderboard.
I'm planning to add:
Daily challenges

If you've built a tiny browser game with vanilla JS, I'd love to hear about it. Feel free to share!

Top comments (1)

Collapse
 
rory18439909614 profile image
Rory •

tried the 10×10 mode. Everything keeps spinning, it’s way harder than I expected — the numbers are so tricky to find!