Am 07.11.2011 14:01, schrieb Milton Silva: > > > On Nov 7, 12:41 pm, Milton Silva <milton...@gmail.com> wrote: >> On Nov 7, 9:14 am, Dennis Haupt <d.haup...@googlemail.com> wrote: >> >>>>> The main thing to keep in mind is that when coming from java/scala, >>>>> you'll have a hard time adjusting to clojure, and you're making it >>>>> harder by trying something so inherently full of state. I understand >>>>> the need to tackle problems that we like, but without a good >>>>> understanding of the language you're going to have a really hard time, >>>>> and that reflects in your code. >> >>> what would you have done differently? >> >> Generally, I think the best approach is, to represent everything with >> seqs, work with them and then display them. Something close to >> thishttps://github.com/ztellman/penumbra/blob/master/test/example/game/as... > > Maybe this last post isn't very clear. Look at your split-asteroid. > that fn is either doing much more than splitting asteroids or you have > the wrong representation of asteroids. I have no idea which is it > because I cannot understand it(It is doing too much at a time). Now > look at the split-asteroid in the resource I gave you. >
my function *really* splits the asteroid into two parts. it breaks off a randomly generated part where the bullet hit the asteroid and returns 2 new asteroids, both having sub-polygons of the original asteroid. there are some transformations and area operations involved which makes the function more complex than yours - especially because it's not possible without making some java calls which in turn have side effects. i can rewrite the function to make it look more simple (e.g. extract the polygon operations), but i cannot reduce the total complexity significantly. what i learned so far: * assoc has a batch mode * destructuring in a function signature. * -> * ->> * lots of little things i think i'll rewrite my asteroids as soon as i find the time (vacation is over) and make the second version more beautiful. and remove that IRender-protocol that someone suggested. it turned out that i either have to use it also for collision checks because it knows the polygon or add redundancy because the polygon is needed at two spots. -- -- 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 Note that posts from new members are moderated - please be patient with your first post. 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