On 20/08/12 12:34, Jim - FooBar(); wrote:
On 20/08/12 10:12, nicolas.o...@gmail.com wrote:
(defn generate [board next-boards]
;; next-boards return a seq of MoveAndBoard
(BoardAndChildren. board
(r/map (fn [m]
(MoveAndTree.
On 20/08/12 10:12, nicolas.o...@gmail.com wrote:
(defn generate [board next-boards]
;; next-boards return a seq of MoveAndBoard
(BoardAndChildren. board
(r/map (fn [m]
(MoveAndTree.
(:move m)
(defn generate [board next-boards]
;; next-boards return a seq of MoveAndBoard
(BoardAndChildren. board
(r/map (fn [m]
(MoveAndTree.
(:move m)
(generate (:board m) next
Hi Nicolas,
as you can see I couldn't sleep without trying out your snippet! :-)
Unfortunately, your code gives me a:
NullPointerException
clojure.lang.Numbers.ops (Numbers.java:942)
clojure.lang.Numbers.gt (Numbers.java:227)
clojure.core/max-key (core.clj:4434)
clojure.core/max-
A correction for the wrong part:
(defn my-max ([x y] (if (nil? x) y
(if (nil? y) x
(max x y
([] nil))
(defn tree-value ^double [tree evaluate ^long depth]
(let [children (:children tree)]
(if (or (zero? depth))
(evaluate (:board t
>
> thanks a lot Nicolas...I'll definitely play around with your code tomorrow
> morning...if you say you can go up to level 5 in 11 sec this is really good
> performance -I can't wait to explore the code...I'll let you know of any
> comments of mine soon!
>
>
Of course, don't trust this code. I ha
On 19/08/12 21:09, nicolas.o...@gmail.com wrote:
By the way, I just found an obvious bug in that code, but
that should be easy to correct.
(if (= res Double/NEGATIVE_INFINITY) (evaluate (:board tree))
res
This is obviously wrong.
thanks a lot Nicolas...I'll definitely pla
By the way, I just found an obvious bug in that code, but
that should be easy to correct.
(if (= res Double/NEGATIVE_INFINITY) (evaluate (:board tree))
res
This is obviously wrong.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To
Hi Jim,
I tried a bit.
The performance of this is not perfect but seems not horrible.
It can do a level 5 exploration in 11 sec on my computer, with a
branching factor of 30.
(Of course, there is very little computation for the next move.)
The generation is now lazy, but the depth is used in the e
HI nicolas,
first of all thanks for your time...I do appreciate it...Ok let's see,
On 19/08/12 13:01, nicolas.o...@gmail.com wrote:
You might use the fact that -Infinity is a neutral element for max.
(Or the smallest long if you work with longs).
Alternatively you can represent your value as e
>
> How do I construct a combining fn out of 'max-key' and is there an idiom or
> a pattern for doing so?
You might use the fact that -Infinity is a neutral element for max.
(Or the smallest long if you work with longs).
Alternatively you can represent your value as either a number or nil,
nil bei
11 matches
Mail list logo