Work Guide: Project Python
Work Guide: Project Python
Project Python
Scrabble
ΕΡΓΑΣΙΑΘ2
Pi
Pi
• Online resources:
• Scrabble - Wikipedia : What is Scrabble and general rules of the game
Pi
• You can choose whether to work individually or in groups ( Ν max = 2, ie up to 2 people in the
group)
• B) You should be aware of the documentation of the entire code that makes up the
job
• Each improvement or expansion of the Game Scenario / Algorithm (in relation to what
I suggest in this Guide) is perfectly acceptable as long as they are satisfactory documented
and to me notified in a timely manner from the team to get my approval. Pi
Pi
Pi
• → Player: basic class from which Human and Computer are derived
• → Human: Player derivative class that describes how the human player plays
sak
(object
SakClass type)
getletters ()
(pulls out of the bag for him
player N letters)
PLAYER
putbackletters ()
(returns player letters
in the bag)
randomize_sak ()
("Prepares" the bag
Pi
in letters)
Player
Properties, Methods
Human Computer
• Player: Basic
• Human, Computer: derivatives of Player
Pi
Player
__init__, __repr__
…… ..
• Player: Basic
• Methods: init, repr and any other you judge
Pi
Human
__init__, __repr__,
play
… ..
Computer
__init__, __repr__,
play
… ..
Game
__init__, __repr__,
setup, run, end,
… ..
• Game: Basic
• Methods: init, repr, setup, run, end and whatever others you judge
• The method setup take the necessary actions at the start of the game
• If you work in a team the file name will include both AEMs one after
the other main-AEM1AEM2.py
• E.g. main-12343001.py
• The code of the classes will be entered in the main program with a command import
Pi
Pi
• The object will implement the " bag »Of the physical
game. That is, it will be a data structure that
contains the letters and their values ("points"
given by each letter) and the methods associated
with the "bag"
• The program then waits for the player to enter a word with the letters it has (an
example screen you see below - it is absolutely indicative - I do not mean to display
exactly these messages and your application)
Pi
• 4) If the word that typed the player is acceptable the program calculates the
points of the word and displays to the player his new score, along with a prompt
of the form ' Enter to continue '(eg see example of messages below)
Pi
• 5-2) Displays the letters of the computer and the word being played, along with the word score
and the overall score of the computer. He secretly fills in the letters of the PC and finally
returns to step 3.
• An example screen with these steps is shown below.
Pi
• 6) The game continues like this until something like this happens:
• 6-1) The player wishes to stop ( the does not find an acceptable word
to play and there are no letters to change) so it introduces the
character 'q' when it is his turn to type a word.
• 6-2) There are no more letters in the "bag" to replace what is missing,
either the player or the PC
Pi
• To save data to a file you will use pickle or json library (prefer json) which
you can read about in the 09-PythonFiles.pdf slide pack in the section 'Conserva
(pickle & json) Pi
Pi
Pi
Pi
• The permutations of a list of objects can easily be accessed in your code via the Pi
itertools.permutations () function
• SMART: The SMART algorithm is called first (as explained in scenario 1) and
creates a list of possible words that can be played
• FAIL: Then it is called FAIL. As a person does not always find the optimal word, the
FAIL algorithm introduces a degree of failure to play the optimal word found by
SMART.
• The FAIL algorithm takes as input the list of possible words generated by
SMART and chooses to play eg 2 the better or the 3 the
best word in the list (instead of the best first) depending on how you spell it.
• You can decide for yourself the details of the FAIL algorithm
so that FAIL simulates the memory / ability of a person who does not know all the words
or can not always find the best possible word. Pi
• In this scenario you should enrich (or replace) the greek7.txt file with another
that contains a larger or specialized wealth of words (remember: up to 7 letters).
Pi
• If the player chooses 'YES' the word is included in the word structure of the current
game to be recognized later.
• In this scenario at the end of the game you have to update the greek7.txt file with the
new words so that they are available in the next batch.
Pi
• In your work you should choose which scenario from the previous
ones you will implement in your code.
• If the work is done by group of 2 people should be implemented 2
different scenarios.
• When the player chooses' Settings at the beginning of the game your
schedule presents the possible scenarios and allows the player to
choose.
Pi
• sak = classes.SakClass ()
Pi
Pi
Pi
Pi
RIO ΣΤΙΚΟ
A CLASSES If the classes have been implemented as described. What methods have you
implemented in each class and what do they do (2 lines for each). Also if you
have implemented other classes
Which or which scenarios for the play algorithm have been implemented
Δ ALGORITHM - ( explain it to docstring especially if you have implemented one
play
particular scenario not suggested here) Pi
If they have been submitted all files which are necessary for your password to
Ζ ARCHIVES be executed correctly.
- (explain to docstring what files your work consists of)
Pi
ATTENTION: Incorrect execution of the code due to lack of a
file reduces your rating.
ΤΜ. INFORMATICS AUTH ST. DIMITRIADIS
(9) Deliverable
Pi
• Submit via elearning until deadline which will be announced in the exam you want to
submit the assignment Pi
• You can " share ”Exams as you want in the exams: June & September 2020 (and
February 2021 if you are a graduate)
• Caution: If you owe the course and it is taught again in the spring of 2021, you are
obliged to take a comprehensive review ( no points are held after February 2021)
Pi