There's Knuth Literate Programming version of the classic Adventure [0] which you can read almost like a novel, and the source code for Spelunky [1] has also been released [2]. (I don't know whether Spelunky has good code, but it's a good game.)
Good luck!
[0] http://www.literateprogramming.com/adventure.pdf [1] http://www.spelunkyworld.com/ [2] http://spelunky.wikia.com/wiki/Source_code
I would point to open source games such as Nethack, Stepmania or Battle for Wesnoth for some ideas.
There's Knuth Literate Programming version of the classic Adventure [0] which you can read almost like a novel, and the source code for Spelunky [1] has also been released [2]. (I don't know whether Spelunky has good code, but it's a good game.)
Good luck!
[0] http://www.literateprogramming.com/adventure.pdf [1] http://www.spelunkyworld.com/ [2] http://spelunky.wikia.com/wiki/Source_code