Write endgame generation subroutine