That solution seems really complicated. A simpler one is to have some kind of stalemate timer, after which any surviving units both retreat.