> If a move can be played where the opponent only has one response and afterward a mate in two exists then do that move.
You won't catch all mates in three with this logic - the opponent might have more than one response, all of them leading to mate in two.
I'm a programmer, but I've never tried to write chess programs - however this sounds a lot like recursion is needed. Something like:
function mate(x)
if x = 1 and (criteria for mate fulfilled) then leave
else if mate(x-1) then leave
The words that jump out at me are recursion, iteration, and mathematical induction. You can already do it for n=1. Now if you can do it for n=k, then can you also do it for n=k+1? It would seem that you can by applying whatever logic allowed you to jump from n=1 to n=2.