Commits

Anonymous committed f5bc195

small fix

Comments (0)

Files changed (1)

mills/ai_alphabeta.ml

   let find_best state lastmove depth =
     reset_force ();
     let root = build state lastmove depth in
-    reset_force ();
     let children = match force root with Node (_, _, c) -> c in
     let scores = List.map (score estimate) children in
-    let better = if (get_turn state) mod 2 = 0 then (<) else (>) in
+    let better = if (get_turn state) mod 2 = 0 then (<=) else (>=) in
     let init = if (get_turn state) mod 2 = 0 then max_int else min_int in
     let rec select nodes scores selected score =
       if nodes = [] then selected
     
     method put state =
       let depth = (* reduced when too few stones are present *)
-        if get_count state Black > 3 && get_count state White > 3 then 7
-        else 4
+        if get_count state Black > 3 && get_count state White > 3 then 8
+        else 5
       in 
-      let selected = find_best state Init 5 in
+      let selected = find_best state Init depth in
       match selected with
       | Node(_, Put i, _) -> last_move <- Put i ; i
       | _ -> failwith "no put found"
     method move state =
       let before = Unix.gettimeofday() in
       let depth = (* reduced when one player can jump *)
-        if get_count state Black > 3 && get_count state White > 3 then 7
-        else 4
+        if get_count state Black > 3 && get_count state White > 3 then 8
+        else 5
       in 
       let selected = find_best state Init depth in      
       let after = Unix.gettimeofday() in