Paint a Strange Room
Hard · Walls
Karel is inside a room with a strange shape. Put exactly one ball on every square of the room. Squares outside the room must stay empty.
Your code runs in several rooms, and some have a pillar in the middle, so rows alone will not do. Hint: a function can call itself. Put a ball here, then try each direction: step in, and if that square has no ball yet, paint from there, then step back. You never need to check behind you: that is where you came from, and it is already painted.