another solution this one is recursive...but is it minimax?