Hi, I hope you don't mind, rather than comment on the code I made some changes (many lifted from Abhishek and Mark's implementation): add-points only creates one point and it doesn't move anything so name should change, suggest new-point (maybe new-head as it is always used by the snake?)
defn snake direction with :dir (dirs VK_RIGHT) for consistency Used getPreferredSize in panel and .pack in frame rather than setting size on Frame Added (.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE) to close it properly Added a follow-edge function to keep the snake on the board and call it from the move and turn functions (I stole it from the other snake.clj) (question: was the 'if' in turn for efficiency or am I missing something? (I took it out)) Cheers Tom 2009/1/5 Stuart Halloway <stuart.hallo...@gmail.com> > > Since there has been so much back-and-forth about the Clojure snake, I > decided to write one [1]. Like Mark, my goal is to create a readable > version, but the details are quite different. > > I plan to use this as the code example for the Swing section in the > book. Feedback welcome. > > Stuart > > [1] > http://github.com/stuarthalloway/programming-clojure/tree/master/examples/snake.clj > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
my-stu-snake.clj
Description: Binary data