Completed match 3 card algorithm.