What is the fastest possible stalemate by castling? It is known what the fastest stalemate is. But what but is the fastest possible stalemate in which castling must be the last move?
33 plies is my best result so far.
[FEN &quot;&quot;]

1. e4 h5 2. Qxh5 d6 3. Qxh8 Bh3 4. Qxg7 Bxg2 5. Qxg8 Bxf1 6. Qxf7+ Kd7 7. Qxf8 Kc6 8. Qxd8 e5 9. Qxd6+ Kb5 10. Qxc7 Bd3 11. Qxb8 Bxc2 12. Qxa8 Bd1 13. Qxa7 Kc4 14. Qxb7 Kd3 15. Nf3 Kc2 16. Qb3+ Kxc1 17. O-O

Castling for a pin isn’t the only possible motivation though. Here is another 33 plies sequence that shows motivation in protecting pieces and guarding squares.
[FEN &quot;&quot;]

1. f4 e5 2. fxe5 d6 3. exd6 Qg5 4. dxc7 Ke7 5. cxb8=Q Qxg2 6. Qxc8 Qxh2 7. Qxa8 Qxg1 8. Qxa7 g5 9. Qxb7+ Ke6 10. Qxf7+ Ke5 11. Qxf8 Qh2 12. Qxg8 Qh5 13. Qxh8+ Kf4 14. Qxh7 Kg4 15. Bg2 Kg3 16. Qxh5 g4 17. O-O
I’ve found a way to reduce the count down to 31 plies.
[FEN &quot;&quot;]

1. f4 e5 2. fxe5 d6 3. exd6 Qg5 dxc7 Qxg2 5. cxb8=Q Qxh2 Qxa7 Qxg1 7. Qxa8 Qg2 8. Bxg2 g5 9. Qxb7 g4 10. Qxc8+ Ke7 11. Qxf8+ Ke6 12. Qxf7+ Ke5 13. Qxg8 Kf4 14. Qxh8 h5 15. Qxh5 Kg3 16. O-O

White has only two non-capturing moves, the first pawn move and casting. Black uses up all of their moves without rest. Therefore, I think that 31 plies may be optimal unless a pawn capture can be shaved off.