Play Light Cycles
A Tron style light cycle duel built with plain JavaScript and canvas. Steer your cycle, leave a wall behind you, and force your rival to crash first. Play against the computer or a friend on one device.
This is a real, playable game, not a screenshot. Your cycle never stops and paints a wall wherever it goes, so every turn is a gamble between cutting off your rival and trapping yourself. It runs on a grid with a steady game loop and a collision check on every step, which makes it a clean example of how many classic arcade games actually work.
How to play
You ride a light cycle that never stops and leaves a solid wall everywhere it has been. You cannot drive straight forward yourself, you only steer, so every press turns your cycle ninety degrees left or right. The trick is to box your rival in while keeping room to breathe yourself. Crash into the arena edge, your own trail, or the other cycle and the round is lost. First rider to five round wins takes the match. Play against the computer to learn the lines, or hand a friend the other set of buttons for a tense duel on one screen.
Controls and modes
Everything is built for one device, phone or desktop.
Steering your cycle
Each player gets a left and a right steer button, and the same works from the keyboard, A and D for player one, the arrow keys for player two. Turns are relative to where you are pointing, so you can never accidentally reverse into your own wall.
One player versus the computer
In the solo mode the orange cycle is driven by code that looks a few cells ahead and steers toward the most open space. It will not hand you the win, so you have to cut it off without trapping yourself.
Two player duel
Pick two player and both sets of buttons go live. One phone, two thumbs, and a very short path to an argument about who turned too late.
How this game is built
Light Cycles is a tidy showcase of three core arcade techniques.
A grid that remembers every trail
The arena is a grid where each cell records which cycle has been there, so a crash is just a check of whether the next cell is already taken, the heart of collision detection.
A steady tick and simple opponent
A fixed timer advances both cycles one cell at a time, the rhythm described in the game loop, while the computer scans ahead each tick and the steer buttons feed in through the same path as handling game input.
Why this teaches real game code
Strip away the neon and Light Cycles is the same skeleton behind a surprising number of games. A grid holds the world, a loop moves everything forward in equal steps, and every step asks one question, is the space ahead free. Snake works this way, so do countless puzzle and board games, and the little opponent here is your first taste of an agent that senses its surroundings and decides where to go. Get comfortable with this shape and you can build a dozen more games on top of it, including the reactive, state driven thinking behind an event driven UI.
Frequently asked questions
How do I play Light Cycles?
Your cycle moves on its own and leaves a wall behind it. Tap the left or right steer button to turn, and survive longer than your rival by making them crash into a wall, a trail, or the edge first.
What modes are there?
One player against a computer opponent, and a two player duel where both players share one device, each using their own pair of steer buttons or keys.
How does the computer decide where to go?
Each tick it looks a few cells ahead along straight, left, and right, then steers toward whichever has the most open space, with a touch of randomness so it is not perfectly predictable.
How does this relate to programming?
It combines a grid that stores state, a fixed game loop, and a collision check on every move, the same building blocks used in Snake and many other tile based games.
Want the engineering behind reactive, stateful systems?
See how event driven interfaces sense change and respond.
Read: Event Driven UI →