all work

projects

CS61B Craft

A seeded, minable world in 90 by 50 tiles — the course project taken well past the brief.

CS61B ends with a project that hands you a tile engine and a seed and asks for a world. The brief stops at rooms and hallways. Dominic Bankovitch and I kept going and turned it into a mining game — ore buried in the stone, a pickaxe, an inventory, and the ability to put blocks back where you took them from.

The CS61B Craft title screen, with a blocky stone-textured logo over a blurred landscape and a byline crediting Dominic Bankovitch and Devin Fitzpatrick
The title screen.

The world is a 90 by 50 grid that starts as nothing but stone, and everything interesting happens by carving into it. I wrote the room generation — placing rectangles that don't overlap, and the containment test that tells you whether a given tile falls inside one — and Dominic wrote the hallway pass that connects them. The real constraint on all of it is determinism: every random decision has to come from a single seeded generator, in the same order, every run. Pull one extra number out of it in a different place and the same seed silently stops producing the same world, which is a genuinely annoying bug to chase because nothing crashes.

A generated world of rectangular rooms connected by narrow hallways, carved out of a solid black field
One seed. Rooms placed, then connected.

The mining half was mine. Rather than leave the stone inert, every stone tile rolls once against a spawn table of cumulative thresholds, rarest first: diamond lands in the first tenth of a percent, coal takes a five percent band at the other end, and about eleven percent of the rock ends up as ore of some kind. On top of that I built the pickaxe and the block-placing system — pick up the pickaxe, mine a tile, and it lands in a HUD inventory keyed by tile type, then any block you're holding can go back into the world. Saving writes the whole tile grid, the avatar position, the inventory counts, whether you're carrying the pickaxe, and which song is playing, so a loaded game resumes exactly where it stopped.

A second generated world with a visibly different room layout, demonstrating that a different seed produces a different map
A different seed, a genuinely different map — but the same seed always rebuilds this one.

All Java, and no game engine underneath it — rendering goes through StdDraw from Princeton's algs4 library, one tile at a time, which is a good way to learn exactly how much a real engine does for you. The ore textures are Minecraft's own.