This is the same game that you can find in the games section of StencylForge (search for "Demo-" to find this and all of my other demos there), so please feel free to take a look at it and try to understand the coding for yourself.
As for the game, the goal is to decrease your opponent's HP to 0. Each card has 4 attributes: rank (how good it is, which is shown by the color of the card [blue, green, yellow, orange, red]), attack (how hard it hits), HP (how much it can withstand), and delay (how long until the first attack).
Attacks hit the leftmost card, so a good strategy is to start with a card that has high HP to soak up damage and play attackers after it. If there are no cards in the field area to take an attack, the card attacks the opponent directly... but be careful! How hard you hit will also be sent back at the card (so expect a lot of self-destruction for those cards). Good luck!