If you have an extension that might not be worth extending a full ply, you could extend it 0.5 plies instead and only if you get two of those in the same branch the branch is extended with one ply.
The easiest way to make this work is change the way the search handles the depth altogether.
In Mediocre the call to alphaBeta from the root will look like this:
eval=-alphaBeta(board,current_depth*PLY-PLY,-beta,-alpha,true,1);Where PLY is a fixed number that represents a full ply, 16 for instance. So if we wanted to search to 10 plies we would call alphaBeta with 10*16-16 = 144, which means we call it with 9 plies left to go.
If we wanted to extend one ply we add 16 to the call, so the call would be depth-PLY+16.
To extend 0.5 plies the call would be depth-PLY+8 and so on.
When we run out of 'depth' the quiescent search is called and this happens pretty much automatically like this:
if(depth < PLY) do_quiescent();Meaning we do not have a full ply left to search so we start the quiescent search (which does not keep track of depth so we do not have to worry about it there).
Fractional plies is very easy to implement (basically replace all depth-1 with depth-PLY) and is very handy to have.