Re: Countdown numbers game in clojure.core.logic
Looks nice and short to me. Again I don't have the time to ponder optimizations so I'm curious myself how it could be made faster. David On Thu, Dec 13, 2012 at 9:22 PM, Adam Clements adam.cleme...@gmail.comwrote: Hi, so I chose this problem as my first foray into core.logic too My solution is here https://github.com/AdamClements/countdown/blob/master/src/countdown/core.clj My solution is a little slow, depending on how tricky a problem it is, it can take from milliseconds to seconds. I ran [75 9 1 3 4] with a each target from 0 to 999 and got an average time of 824ms (including a lot where the search was exhausted). In the solvable ones it usually returns quicker than that. Like I said, this is my first attempt at logic programming, so if anyone can see how to make my solution more concise/elegant/faster, tips are much appreciated! Thanks Adam Clements On Saturday, August 18, 2012 3:36:01 PM UTC+1, David Powell wrote: I just had a go of solving the Numbers Game from the UK gameshow Countdown [1] in clojure.core.logic. https://gist.github.com/**3374505 https://gist.github.com/3374505 It works, but it is a bit slow. Anybody got any ideas on better approaches? [1] http://en.wikipedia.org/**wiki/Countdown_(game_show)#**Numbers_roundhttp://en.wikipedia.org/wiki/Countdown_(game_show)#Numbers_round -- Dave -- 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 -- 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
Re: Countdown numbers game in clojure.core.logic
Hi, so I chose this problem as my first foray into core.logic too My solution is here https://github.com/AdamClements/countdown/blob/master/src/countdown/core.clj My solution is a little slow, depending on how tricky a problem it is, it can take from milliseconds to seconds. I ran [75 9 1 3 4] with a each target from 0 to 999 and got an average time of 824ms (including a lot where the search was exhausted). In the solvable ones it usually returns quicker than that. Like I said, this is my first attempt at logic programming, so if anyone can see how to make my solution more concise/elegant/faster, tips are much appreciated! Thanks Adam Clements On Saturday, August 18, 2012 3:36:01 PM UTC+1, David Powell wrote: I just had a go of solving the Numbers Game from the UK gameshow Countdown [1] in clojure.core.logic. https://gist.github.com/3374505 It works, but it is a bit slow. Anybody got any ideas on better approaches? [1] http://en.wikipedia.org/wiki/Countdown_(game_show)#Numbers_round -- Dave -- 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
Countdown numbers game in clojure.core.logic
I just had a go of solving the Numbers Game from the UK gameshow Countdown [1] in clojure.core.logic. https://gist.github.com/3374505 It works, but it is a bit slow. Anybody got any ideas on better approaches? [1] http://en.wikipedia.org/wiki/Countdown_(game_show)#Numbers_round -- Dave -- 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
Re: Countdown numbers game in clojure.core.logic
On Sat, Aug 18, 2012 at 10:36 AM, David Powell djpow...@djpowell.net wrote: I just had a go of solving the Numbers Game from the UK gameshow Countdown [1] in clojure.core.logic. https://gist.github.com/3374505 It works, but it is a bit slow. Anybody got any ideas on better approaches? [1] http://en.wikipedia.org/wiki/Countdown_(game_show)#Numbers_round -- Dave I don't have time to offer a better solution but your approach seems pretty brute force. You need to encode some knowledge into the game. First I would eliminate actually searching over * and /. This because it seems to me that it would be useful to know ahead of time what other numbers can be produced from the cards - for example values between the large card and 10. I would also continue to use the larger card (and numbers derived from it) until we are close to the solution. Hope this helps, David -- 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