The array 'cards' contains a list of numbers that are connected to one (in this case out of 5) cards. In the void loop is checked whether the scanned card contains a list which corresponds to one of the lists inside 'cards'. If so, it writes the number of the place inside the array 'cards' to the serial port. If not, it writes '6' to the serial port.
That will be a problem if you decide to add more cards. Writing -1 for card not known means that that value will remain constant, no matter how many cards are added.