speed optimization of endgame evaluation