Compression - pcaston2/tupo GitHub Wiki

#Compression

Compression re-orders the cards so they are in the correct order for combat. This is stored in a map. It does not dictate their play order. The ordering is such that the commander is in first position, the alive assaults are in the order they were played, followed by dead units, empty space, and structures. However, any structures which have Wall are placed at the end of the array, with the most recently played wall at the end position.

The purpose of this is so that when a card attacks, it can check to see if an assault is alive on the other side of the array. If it is not, then a check is done to see if there is a structure with wall at the end. If there is, that is the target of the attack. If there is no such structure, the commander is attacked.

An example:

C A A - - - S S
0 1 5 - - - 3 7