anchor.diff:  -module(four_par).
  --export([find_hash/2, test/0, run/0]).
  +-export([sfind_hash/2, find_hash/2, listener/4, hash_process/3, test/0, run/0]).
   
   -record(params, {base, n, zeroes}).
   
  
positive.code: listener(CreatorPid, Params, Procs, Result) ->
  	receive
  		{start, N} ->
  			StartProc = fun(P, PN) -> spawn(?MODULE, hash_process, [self(), P, PN]) end,
  			NewProcs = [StartProc(Params#params{n = PN}, PN) || PN <- lists:seq(1, N-1)],
  			listener(CreatorPid, Params, NewProcs, Result); %% just *assume* this is the first thing that happens, so no procs exist by now
  		{ack, SenderPid} ->
  			listener(CreatorPid, Params, [P || P <- Procs, P /= SenderPid], Result);
  		{done, SenderPid, N} ->
  			NewProcs = [P || P <- Procs, P = SenderPid],
  			[Pid ! kill || Pid <- Procs], %% send kill to all others now
  			NewRes = case {Result, N} of
  				{unset, R} -> R;
  				R when N > Result -> R;
  
negative.code: 	end.
  
  find_hash(Base, Zeroes) ->
  	P = #params{base = Base, n = 0, zeroes = Zeroes},
  	L = spawn(?MODULE, listener, [self(), P, [], unset]),
  	L ! {start, 8},
  	receive
  		{result, ComputedResult} ->
  			io:format("~p", [ComputedResult])
  	end.
  
  sfind_hash(Base, Zeroes) ->
  	spawn(?MODULE, find_hash, [Base, Zeroes]).
  
  test() ->
  	609043 = find_hash("abcdef", 5),
  