The Windows game loop

The Chip’s Challenge game loop Load the board once. Each tick reads one direction or none, advances the Windows rules, and reports the updated board and sound cues. If the level is still running, that state returns to the input stage for the next tick. A win or loss stops the loop. Load starting board Read input One direction or none Advance one tick Run creature moves and slides when due. Check the clock and try Chip’s move. Moves can trigger pickups, gates, devices, terrain effects, or collisions. Report the result of the tick Updated board and sound cues Level over? No · next tick Updated state Yes Win or loss

Rules that can apply during a tick

Open a group for the individual rules. Several can act on the same move.

Turn timingInput, move order, idle turns
Input
A direction requests a step. With no direction, creatures and moving floors can still take their turns. Chip can use a voluntary move only when his movement slot allows it. After he waits, he eventually faces south.
Tick order
When due, creatures move in level-list order, followed by forced floor movement. The engine checks the clock, tries Chip’s move, and finalizes new clones. A win or loss can end the tick early.
Movement rates
Chip’s ordinary move cycle is four ticks. Teeth and blobs move less often than most monsters. The starting phase and random-number state affect which moves happen when.

Tick loop · Start of tick · Chip’s turn

Creature steeringNine movement patterns
Tank
Goes straight and waits when blocked. A blue button reverses its heading.
Ball
Tries forward, then back.
Bug and paramecium
The bug tries left, forward, right, then back. The paramecium mirrors that order, starting on its right.
Glider and fireball
Both try forward first. The glider then prefers left over right, the fireball right over left. Back is their last choice.
Walker and blob
The walker tries forward, then the other directions in random order. The blob shuffles all four directions.
Teeth
Chases Chip on the axis with the larger distance, choosing the vertical axis on a tie, then tries the other axis.
Traps and cloners
A confined creature can use different direction choices. Bugs, paramecia, and teeth use the engine’s stored controller direction there.

Direction choices · Turning tanks

Passage and wallsTile edges, terrain, block pushes
Entry and exit
The board edge, walls, occupied squares, and thin walls constrain movement. A thin wall can block leaving one square or entering its neighbor. The engine checks different passage rules for Chip, blocks, and creatures.
Walls that change
Solid and permanently invisible walls block passage. Bumping a revealable invisible wall or a real blue wall exposes it. Chip clears a false blue wall by entering it. A pop-up tile becomes a wall under Chip. Toggle walls alternate between open and closed.
Who can cross
Only Chip can cross dirt, which he clears as he goes. Chip and blocks can enter gravel, random force floors, squares holding boots, and the exit. Those squares block monsters. All three can cross a square holding a key.
Blocks
Chip can push a block if it has somewhere to go. The push resolves the block’s destination, including hazards, buttons, traps, or teleports. Chip can normally push a sliding block only from the side. When the engine checks a possible teleport exit for Chip, it can also push the block along or against its slide.

Tile access table · Passage checks · Block pushes

Forced travelIce, force floors, teleports
Ice
Without skates, Chip slides. Corners turn a sliding piece. When the next step is blocked the engine tries the rebound direction.
Force floors
Directional floors push along their arrow. Random floors choose a direction with the game’s random-number generator. Suction boots let Chip walk normally. Without them, when his turn to move comes, he can try stepping sideways or back against the arrow. Pressing in the direction he is already sliding adds no extra step.
Teleports
Search backward through the board in reading order, wrapping at the start. The engine checks working teleporters for a legal exit in the incoming direction. If none qualifies it falls back to the entry teleporter. Checking a possible exit can push a block.
Forced move order
Chip’s forced move is processed separately from sliding blocks and monsters. The engine retains slide direction and resolves blocked moves, reversals, and transfers to the next floor.

Floor directions · Teleporter search · Floor movement

Inventory and gatesMicrochips, sockets, keys, boots
Chips and sockets
Collecting a microchip reduces the remaining quota until it reaches zero. A socket opens when Chip enters it with the quota met. A reachable exit works even if a socket elsewhere is still locked.
Keys and doors
Red, blue, yellow, and green doors require matching keys. Opening a red, blue, or yellow door spends one key. Chip keeps the green key.
Footwear and thieves
Flippers protect Chip in water, fire boots protect him on fire, skates stop ice from carrying him, and suction boots counter force floors. A thief removes all four kinds of footwear.

Gate checks · Landing on a tile

Buttons and devicesTanks, toggle walls, traps, clones
Blue and green
Blue reverses tanks. Green flips every working toggle wall, including walls currently covered by another piece.
Brown
A brown button releases its linked bear trap. A held button can let an arriving occupant leave. A closed trap normally holds its occupant until released.
Red
A red button activates its linked clone machine. A creature or block needs a usable way out. New creature clones become eligible for ordinary movement after the cloning tick.
Button timing
Chip, creatures, and blocks can trigger devices. A block push can defer button effects until Chip’s move resolves. The level data supplies the links between buttons and traps or cloners.

Traps and walls · Cloners and traps · Button dispatch

Hazards and collisionsWater, fire, bombs, crushing
Water
Chip drowns without flippers. Gliders survive water. A block sinks and turns the water square into dirt.
Fire
Chip burns without fire boots. Fireballs survive fire. Bugs and walkers ordinarily avoid entering it.
Bombs
A bomb kills Chip. A block or monster hitting a bomb consumes it and is destroyed.
Contact and crushing
A creature can hit Chip on its turn, or Chip can walk into one. A moving block can also kill him. The Windows engine distinguishes ordinary contact from a crush involving a cloning block.

Terrain and collisions · Forced moves and crushing

Clock and outcomesExit, timeout, hints, sound cues
Clock
Timed boards issue a low-time cue in their final 15 game seconds. Reaching the time limit ends the level. Untimed boards skip those checks.
Outcome
Chip entering the exit completes the level. Lethal terrain, collisions, crushing, or running out of time end the attempt. Otherwise the updated state feeds the next tick.
Feedback
Standing on a hint tile exposes its text. Sound flags record events such as blocked moves, pickups, and device changes. Patch Bay’s adapter exposes the flags and the browser plays them.

Win and loss checks · Clock · Hint state