Skip to content
karim.semaan(open to work)
WorkExperienceAboutSkillsContactResume ↓
← All work
FloodIt preview
Full-stackProtected2021

FloodIt

recursive flood-fill puzzle game

A complete, test-covered FloodIt: a mutable cell graph, recursive four-way flood-fill, and win, lose and reset states governed by a fixed move budget.

FloodIt · 10×10 · 6 colours · move 0/18
Size

Pick a colour to flood from the top-left corner. Match the whole board to one colour within the move budget. Click a swatch, or focus the board and press 1 to 6 (arrow keys move the cursor, Enter commits).

10 by 10 FloodIt board, 6 colours, flooding from the top-left corner. Press 1 to 6 to flood a colour.
✚●★◆▲■●●■▲★▲✚▲●■★✚●●▲●◆●◆▲■●★◆✚◆✚★✚■●★✚◆◆●■■■■✚★◆◆▲★■◆✚▲◆●✚▲▲★✚■✚▲▲▲✚★●■★●▲●■◆■●★●✚■●●■★◆▲▲●✚▲★✚◆●■●
Moves 0 / 18

Move 0 of 18. 18 moves left.

Playable in your browser: flood the grid to one colour within the move budget. Same recursive flood-fill and move formula as the Java original.

Protected work

The source for this course project is kept private. Request access through the contact form and I will gladly share the code and walk through it.

Request access

FloodIt is a CS2510 (Fundamentals of Computer Science 2) pair project that builds the classic colour-flood puzzle on top of the course's imperative world library. The board is a 20×20 grid of cells, each cell wired to its left, top, right and bottom neighbours so the grid is a mutable graph rather than a flat array. The top-left cell starts flooded; each turn the player picks one of 9 colours and a recursive flood (upadateAllAdjacent) repaints every connected same-colour cell, growing the flooded region outward. A player wins by making the whole board one colour, and loses if they exceed the allowed move budget, computed as floorDiv(gridSize + numColors, 2) + gridSize (34 moves at the default size). The project also enforces a minimum of 6 colours, tracks clicks and an elapsed-time score, supports an in-game reset, and ships a tester-based unit suite covering cell drawing, neighbour wiring, click-to-cell mapping, the win check and the colour-legality rule. The in-page demo reimplements the same recursive flood-fill and the exact move formula so you can play it in the browser.

  • Java
  • Recursion
  • Graphs
  • Flood fill
  • Unit testing
Board
20×20 grid
Colours
9 (min 6 enforced)
Move budget
floor((n+c)/2)+n
Flood-fill
recursive, 4-way

What I'd improve

The flood-fill recurses per click over the whole board, which is fine at 20×20 but would not scale; an explicit stack or a single graph traversal that only visits the flooded frontier would be cleaner. I would also separate the game model from the rendering and add a difficulty selector for board size and colour count rather than fixing them in the constructor.

Private · request access
Want something like this? Get in touch →
© 2026 Karim SemaanBuilt with Next.js, Tailwind & Supabase.LinkedIn ↗GitHub ↗