let exhaustive_search ~start ~childgen ~goaltest ~combinator =
let res = ref [] in
let rec search start akku =
(* see if we have reached a goal*)
if goaltest start then
(*add the current solution to the list of results*)
match (combinator start true akku) with
Some solution -> res := solution :: !res
| None -> ()
else ();
(* produce all children and descend their paths *)
let childs = childgen start in
let path = combinator start false akku in
let rec loop childs =
match childs with
child :: childs ->
(* descend *)
search child path;
(* look at sibblings *)
loop childs
| [] -> ()
in
loop childs
in
search start None;
!res