Why are parts of my game so buggy?

Here is the link to my game

The problem is that the Red General Never comes back down, and when I occasionally do get one side to defeat the general, it doesn’t move to the cage.
I’ve given up trying to fix it as whatever I do doesn’t work.
Can you guys tell me what I’m doing wrong or how to fix it?