let score heuristic node = alphabeta heuristic node min_int max_int

-let estimate~~_basic~~ state =

let black = (get_count state Black)

and white = (get_count state White) in

-let estimate_mc playouts state = Ai_montecarlo.estimate state 0 playouts 30

-let estimate_hybrid playouts state =

- let e = estimate_basic state in

- (max 100 playouts) * e + estimate_mc playouts state

+ if not (can_put state) then

+ if black > 2 && white <= 2 then max_int

+ else if black <= 2 && white > 2 then min_int

- let find_best state lastmove depth ~~playouts ~~=

+ let find_best state lastmove depth =

let root = build state lastmove depth in

-(* print_force_stat ();*)

-(* let positions = count_positions root in*)

-(* let nplayouts = playouts / positions in*)

let children = match force root with Node (_, _, c) -> c in

- let scores = List.map (score ~~(~~estimate~~_basic)~~) children in

+ let scores = List.map (score estimate) children 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 =

val mutable last_move = Init

- let selected = find_best state Init 3 15000 in

+ let depth = (* reduced when too few stones are present *)

+ if get_count state Black > 3 && get_count state White > 3 then 7

+ let selected = find_best state Init 5 in

| Node(_, Put i, _) -> last_move <- Put i ; i

| _ -> failwith "no put found"

let before = Unix.gettimeofday() in

- let selected = find_best state Init 6 30000 in

+ let depth = (* reduced when one player can jump *)

+ if get_count state Black > 3 && get_count state White > 3 then 7

+ let selected = find_best state Init depth in

let after = Unix.gettimeofday() in

Printf.printf "time: %f\n%!" (after -. before);

| Node(_, Move (f, g), _) -> last_move <- Move (f, g) ; f, g

| _ -> failwith "no move found"

- let selected = find_best state Init ~~6 30000~~ in

+ let selected = find_best state Init 4 in

| Node(_, Fly (f, g), _) -> last_move <- Fly (f, g) ; f, g

| _ -> failwith "no fly found"

end_of_turn state; (* unrolled later *)

- let selected = find_best state last_move 4 ~~10000 ~~in

+ let selected = find_best state last_move 4 in

| Node(_, Capture i, _) -> last_move <- Capture i ; i

| _ -> failwith "no capture found"