protected virtual MoveGenerationResults GenerateMoves(int currentPly, Sides currentSide, out List <Move> moves) { moves = _PlyInfo[currentPly].Moves; int kingAttackCount = _ScratchBoard.KingAttackCount(currentSide); if (kingAttackCount > 0) { MoveGenerator.GenerateCheckEscapes(_ScratchBoard, kingAttackCount, moves); if (moves.Count == 0) { // We are mated. return(MoveGenerationResults.Mated); } } else { MoveGenerator.GenerateAll(_ScratchBoard, moves); } return(MoveGenerationResults.NotMated); }