I've re-implemented the simple, popular, addictive (be warned!), open source puzzle game 2048 in a single file of Racket:
https://github.com/danprager/racket-2048 It's a clean-room, functional implementation, with I hope reasonable comments. The commented code is just over 500 lines, plus tests. One of the nice things about the original 2048 is how many creative variations have been devised: 3D and 4D, hexagonal grid, AI, Tetris version, image-based versions, parodies (including numberwang ;-). There are even sites where you can config your own version. My 8 year-old daughter did a version based on "there was an old lady who swallowed a fly". Code review and suggestions appreciated, or just fork and hack away. Ideas for improving the existing code: * In-game instructions * Suggestions on using parameters instead of global *constants* * Sprites instead of first-principles animation * Better factoring out of the model and views of the board * Caching * Types But I suspect the real fun is in making game variants. Notes: * For less time playing the game try a grid *side* of 3. * Hold down the space bar (which just rotates the board) for an animated effect. * If you find the game too hard, try watching the AI version for some sense of strategy. Let me know what you think! Dan -- *Daniel Prager* Agile/Lean Coaching, Software Development and Leadership Startup: www.youpatch.com Twitter: @agilejitsu <https://twitter.com/agilejitsu> Blog: agile-jitsu.blogspot.com
____________________ Racket Users list: http://lists.racket-lang.org/users