When does middle game starts and when end game?
The middle game normally starts when minor pieces are developed and sometimes both opponents have castled.
The endgame starts when there are 1 or 2 pieces (minor or major pieces) left on the board. According to me btw