Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
An introduction to the memory game code challenge.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Hi there, Pythonistas.
0:04
Now that you have some OOP
knowledge under your belt,
0:06
it's time to put it to the test.
0:10
[SOUND] We're going to make a memory game.
0:12
This is the same game you may remember
from childhood, where you have
0:15
a set of cards face down, and
you flip two over to see if they match.
0:20
If they don't,
you flip them back over and try again.
0:25
If they do match, then they stay face
up until you've matched all the cards.
0:29
Let's open up Workspaces and
check this out.
0:35
Here we have two files,
cards.py and game.py.
0:40
Our game will have two classes,
a card class in cards.py, and
0:46
a game class in game.py.
0:51
The memory game has a set of
cards placed into a grid.
0:53
Let's look at what the final
product will look like.
0:58
Here we can see the grid, and
it's asking us for our first location.
1:02
We'll need column and row headers so
1:08
the player can give us
the location of their guess.
1:10
Inside of the grid will be a set of cards,
but they are hidden when the game starts.
1:16
The player will need to give us two
locations, and if they don't match,
1:22
we'll need to let the player know and
then have them try again.
1:27
If the cards do match, the grid needs
to update to show the matched cards.
1:39
When all the cards have been matched,
the game ends.
1:47
Let's get to it.
1:51
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up