Arduino version of Card Match memory game

Hello all!

Do you remember the good old Card Match memory game?

I'm trying to make a version based on sound pairs rather than image pairs, and interactive flowers rather than cards.

I'm well on my way with the code but one thing I can't figure out is the following:

I want the player to pick 2 flowers ('cards') per attempt, one by one.

while flower 1 is picked it lights up and makes a sound.
while flower 2 is picked it lights up and makes a sound.
now, check if they are a pair. (the pairs can be pre-programmed)
if flower 1 and 2 are a pair, they stay lit.
else both are dimmed.

Question 1: How do I check if they are a pair?
Question 2: How do I 'save' a pair as completed and keep them lit during the remainder of the game?
Question 3: How do I dim the flowers in the failed attempts without dimming the already completed pairs?

If you could help me out I would be very grateful :slight_smile:

Thanks in advance,

Dennis

Check a pair by using an array containing a number for each card position. The card chosen is an arry index. If the two array indexes have the same number in them it is a pair.

Save a pair by having an array that you save the card numbers that have already been chosen and found to be a match.

Question 3 depends on your hardware but the data will come from another array giving the brightness of each card.