Hi Leen,
to give you just a little hint how it could work I give you an overview how Quark is doing it:
First I remember the score of the last move. If it's the initial position or a book move I remember 0.00.
Now my time routine gives back 2 times: First the approx time Quark should use for the move and the max time Quark should use. (Just to handle fail low issues when short before the cut or very low in time)
So what's happening now in the search ? Well, in the tree it is the usual: timeused>timeavail stop search. But I change timeavail at the root search from time to time:
a) when I search the first move of an iteration (the best move so far) I double timeavail. (With a max as described above) This is just to make sure that the move will be fully searched. (But sometimes this fails anyway, you know that the search can explode from iteration to iteration - some do try here anyway to complete the search)
b) when the first move is a fail low (and here I mean a fail low of -0.30 under the expected score from previous move) I research with timeavail=4*approxtime. And I let the timeavail that high as long no other move get's back in the expected window. So I keep timeavail=4*approxtime also for the other moves in the root search
c) when the first move fails very high (well, the margin is matter of taste) and I have used more then 1/2 approxtime I stop search.
d) when the first move looks okay and is in the window of the expected score I set timeavail=approxtime for the rest of the moves
e) when I find a new candidate for being bestmove I double timeavail also. (timeavail=2*approxtime). Exception: fail-low situation, then timeavail stays at 4*approxtime
f) when in fail low situation a move is back in the expected window I set timeavail back to approxtime
g) when after an iteration more then 1/2 timeavail is used I stop the search, it's unlikely that the next iteration will be completed.
That's more or less what Quark is doing. It shouldn't be to complicate to implement that and I think it would help Queen also to defend in dangerous situations. Also you can save some time with rule g... Of course all the values are matter of taste, I use here just what my stomach says, I have no idea wether other values would do a better job.
Ah, about the easy move. Well, I have there just a rule for single move possible: timeavail=min(10seconds,approxtime/10)
This means it will not take more then 10 seconds or a tenth of the usual approxtime when just a single move is possible. I give it some seconds to find a good pondering move. This is still somehow buggy in Quark, but at least it should work that way...
I hope this helps a bit or give you an idea how to implement it yourself.
Greets, Thomas