Python编程调试、讲解Python程序语言、data设计程序辅导

- 首页 >> Matlab编程
1. Mini-Project – Mini groups' compositions (two students)
2. Mini-Project - Rendering
In this mini-project, you will develop in Python the famous deduction game Mastermind. This game
was created by Mordecai Meirowitz in 1970 and its license belongs to Hasbro, Inc.
The rules are quite famous, but if you are not familiar with them you can consult for example
wikipedia (Links to an external site.).
We first restrain ourselves to a one player game, the hidden pattern being chosen randomly by the
computer.
You must use Tkinter to implement your GUI. An object-oriented approach is highly recommended.
Here are some examples of attributes you can use: number of colors, numbers of pegs, number of
trials, the hidden pattern, the current guessed pattern, the tkinter root, some tkinter widgets (canvas,
buttons, etc.). This list is not exhaustive.
Hint: model colors by integers greater than or equal to 1, and the hidden pattern by a list of such
integers.
Obviously, one of the first methods you will develop compare the hidden pattern to a guessed pattern.
It returns the number of pegs in the guessed pattern which are correct in both color and position, and
the number of pegs in the guess pattern which are correct in color but not in position.
In a first time, we will use the classical rules, i.e. a game with six colors, a hidden pattern of four pegs
and ten trials.
Here is an example of visualization, feel free to customize it:
To add a peg to the current guessed pattern, the player clicks on a color disk at the top of the window.
The erase button allows the player to delete the current line before it was tested.
The test button allows the player to test the current line after it was completed.
Here is an example of an ongoing game:
At the right of line, the number of pegs in the guessed pattern which are correct in both color and
position are in red, and the number of pegs in the guess pattern which are correct in color but not in
position are in white.
Here is an example of a finished game:
The result is displayed with a message box.
Here is another example:
The correct answer is then displayed at the bottom of the window.
After that, a new game is proposed to the player with a message box:
In addition to the previous functionalities, you are free to implement one or several of the following
bonuses:
• A two-player game, the first one choses the hidden pattern and the second one tries to find it.
• An artificial intelligence, see for example Knuth's one.
• A game with any numbers of colors, pegs in the hidden pattern and trials.
• The possibility to save an ongoing game and to resume it later.
Submission: before 18h(Beijing Time) of 16, Dec,2020 by sending a mail to
zhongwei.shen@university-365.com
3. Mini-Project - Oral Defense
Date: 18, Dec
Duration: 10min for a demonstration and Q&A session.
You will present your work with a powerpoint look alike document.
Your group will be evaluated according to the following scale:
• Oral Fluency: 3 points
• Introduction and project summary: 2 points
• Quality of argumentation: 4 points
• Pertinent choice of exposed elements: 3 points
• Demonstration: 3 points
• Q&A: 5 points

站长地图