While I'm not ready to indoctrinate my four-year-old into the monkhood of true geekery while he's getting in his prime running around time, I was curious to see how logically he could think. My layman's knowledge was that children began properly interpreting and creating rules around the age of six, while four was still wild imagination territory.
For my experiment, I created an extremely minimal programming game, like a very stripped-down version of RoboRally:
The image depicted is doctored. We had already completed four playthroughs the night before with a similar setup, however. He was able to figure out how to program the robot to collect all of its pieces (three Duplo blocks comprised the robot; successful completion of the robot wins the game). I demonstrated the rules once, and then let him try to play by himself with minimal guidance. One interesting strategy he discovered was placing the "instructions" (the cards with arrows) on the game board in order to create a path.
Apparently he liked the game well enough, because he independently recreated it at school:
The true geekery is probably inevitable.