fix double digit bug in position_within_limits? and add stalemate