Well, I think there is only one rule that you didn't get right: It is OK for an attacker to enter a destroyed enemy base (the piece simply goes back to the corresponding base at the other side of the board). I've played enough games against the program that I am fairly confident I have the rules right.
The rule works like this:
As you already wrote, attacker can enter destroyed base but an attacker cann't come back to destroyed base.
E.g.: attacker is at height 3 beside enemy's base, he can go through it, doesn't matter destroyed or not, but if his home base at height 3 is destroyed he will be also destroyed.
As i see now in your source code above you already implemented this rule correctly. So base=-1 means destroyed base (and is drawn with "*").