Matching different images in a memory game

122 views
Skip to first unread message

Xavier Romero

unread,
Feb 27, 2019, 5:53:16 AM2/27/19
to MIT App Inventor Forum
Hi people,

I just finished a memory game where you have to match equal images to complete the game. My problem is that i actually want to match two different images (f.e : a footballer girl with a footballer guy), i have no idea how to do that so I would appreciate the help.

Thanks ! :D

Ghica

unread,
Feb 27, 2019, 7:22:01 AM2/27/19
to MIT App Inventor Forum
What you could do, is to keep a list, where each element is a list of two elements: the name of a picture and the name of its matching picture.
You can then use lookup in pairs to find the matching element, given an element: http://appinventor.mit.edu/explore/ai2/support/blocks/lists.html#lookupinpairs
Show your blocks if you need more help.
Cheers, Ghica

ABG

unread,
Feb 27, 2019, 8:14:32 AM2/27/19
to MIT App Inventor Forum
A more general solution would be to have the second column in 
the image lookup table contain a text category name, for example "football".

So for your game, two images would match if their category names are equal.

There are some more complex games, where images might match if
they have multiple categories (like sex, sport, color) associated with them
and the list of categories for the first image intersects with the list
of categories for the second image.

That would be a topic for another post.

ABG

Reply all
Reply to author
Forward
0 new messages