Inspiration
Memory match is a difficult thing to code, so I really wanted to give it a go in python- which I am not so familiar with. Repl does not allow too many imports and does not allow you to add your own images either, so it was quite the challenge to complete this project.
What it does
This game gets the coordinates of where the user clicked and stores that in a tuple which then gets stored in a list. It also gets the color of the turtle wherever they clicked and stores that in a list too. Only the first two indexes of the list are stored(0, 1) to mimic two clicks. The minimum and maximum x and y coordinates of the squares are stored in an array. These are used to determine whether or not thee cards are matching. If they are, a white square is drawn over the matching cards. If they are not, then the blue square(the color of the other side of the card) will be drawn back.
How I built it
I built this using python with turtle in Repl.
Challenges I ran into
The biggest challenge was getting the white square to be drawn over the cards that match. There was also a small bug which did not allow us to click cards from a down to up pattern.
Accomplishments that I'm proud of
I am proud I figured out how to draw the white square over the cards that match and how to fix the bug of the game not allowing us to click cards from a down to up pattern.
What I learned
I learned many things, but the main thing I learned was that functionality always comes first before performance. I was so focused on performance in the beginning and wanted to change every minor performance issue. But after I set that aside and focused more on functionality, in the end, after I finished everything related to functionality, the performance problems were much easier to solve. I also learned the importance of using tuples when storing the x, y coordinates of the click.
What's next for Memory Match Game
Next, I want to garbage collect the cards that are matched instead of drawing a white square over them. I will learn how to do this in python and update the game. I also want to randomize the colors of the cards.
Log in or sign up for Devpost to join the conversation.