Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python program. Make a simple matching game using the graphics package. Users will click on cards one at a time, to flip them over to

Python program. Make a simple matching game using the graphics package. Users will click on cards one at a time, to flip them over to find pairs. Only complete checkpoint A, thank you

yourlastnameP2.py, a blank template for Project 2: http://www.cs.sonoma.edu/cs115/S17/proj/p2-files/yourlastnameP2.py

graphics.py: http://www.cs.sonoma.edu/cs115/S17/proj/p2-files/graphics.py

match_graphics.py, a support library for this project: http://www.cs.sonoma.edu/cs115/S17/proj/p2-files/match_graphics.py

icons.zip: http://www.cs.sonoma.edu/cs115/S17/proj/p2-files/icons.zip

image text in transcribedimage text in transcribedimage text in transcribed

http://mcsp.wartburg.edu/zelle/python/graphics/graphicsode13.html

Building up cards[i][j] to resemble the game board

The goal is to create a 5x5 array called cards, where element cards[i][j] has the name of the image that should appear in row i, column j.

(1) First, lets make a list of 25 things. The list should obey some constraints:

Each of these 25 things should be taken from the list images (which has 13 things in it, the names of the icons)

The list should have one (1) random thing from images.

The list should have two of everything else (24) from images.

(2) Once slist exists and obeys these constraints, shuffle it:

slist = shuffle(slist) 

(3) Now, figure out how to turn slist into a 5x5 array of 25 things.

How? Here is the basic code:

 cards = [] for i in range(5): row = [] for j in range(5): k = ????? # fix me item = slist[k] row.append(item) cards.append(row) return cards 

The trick is figuring out how to compute k.

Download the following files into your PyCharm directory for Project 02: yourlast nameP2.py, a blank template for Project 2 graphics py match graphics.py, a support library for this project. Cons Zip Do not modify match graphice.py. The file icons.zip should be unzipped to create the directory icons/ which holds a series of gif files. Do not rename these graphics or their parent directory, since the file names are listed in match graph The directory icons/ needs to be in the same directory as graphics .py, as match graphics.py and as your code. Checkpoint A (5 points) For Checkpoint A, you will need to demonstrate a program that draws the game board with all the cards shown. You need to be able to display the following window to complete the checkpoint

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions