Question: Use python to solve a game design, one complete model is given, need to fill in blanks. Part 3 . Word Games (30%) For this
Use python to solve a game design, one complete model is given, need to fill in blanks.
Part 3 . Word Games (30%) For this part of the assignment you are going to write the class that will represent a board for a word game (e.g. Scrabble or Words with Friends). This part of the assignment is more difficult than the first, and will require you to work with less guidance. class GameBoard: This class represents the ganeboard itself You are requ ried to complete this class def init (self,width, height) The LetterTile Class This class is complete. You do not have to edit this class. The construetor for setting up the ganeboard pass your ode here def set-tile(self,x,y,tile) pass fyour code here Places a tile at a location on the board. The GameBoard Class This is the class that represents the board. It has a number of incomplete methods that you are required to implement. Please refer to the part3.py file for full description. def get tile(self,x,y) Returns the tile at a location on the board pass fyour code here def renove tile(aelf,x,Y) pass fyour oode here For the purpose of this assignment, a word is valid if it consists of any two or more characters e.g AFFEETTRTWZ is a valid word. The image below is an example Renoves the tile fron the board and returna the tile def get words(self) Words Found Retuns a list of the words on the board sorted in alphabetic order S AND pa88 your code here def top sooring words (self) Returns a list of the top scoring words If there is a single word, then the function should return a single iten list If iltilpe words share the highest seore, then the list should contain the words sorted alphabetical pass fyour code here The mark allocation for this section is as follows, 15% for correctly functioning program, 15% for def print board self)i quality of code produced for the application. Prints a visual representation of the board Please use the character tor unused apaces This nodule represents sone classes for a simple word gane fyour code here There are a number of inconplete nethods in the which you must inplement to make fully tunction def print board(self) About the gane The board's tile are indexed fron 1 to N, and the firt square (1,1) is in the top left A tile may be replaced by another tile, hence only one tile may occupy a space at any one tine. Prints a visual representation of the board Plea& user the-ch&racter for unxased board pass tyour code here class LetterTile This class is complete. You do not have to do anything to complete this clas def letters placed(sel): def init (sel. letter) Returns a count of all letters currently on the board pass #your code here self.letter letter.loMer if amea: def get_letter(self) This is just a sanple for testing you night want to add your own tests here boardGameBoard [10,10)1 Returns the letter associatedd with thi tile return self.letter eLettertilel e nLetterilel) def get score(self): Returns the soore assooiated with the letter tile LetterTilel o) return board.set tile(,1,d board.set tile(2,1. board.set tile(3,1,m) board. set-t ile(4 , i , o > print There areletters placed on the board. ".fornat(board.letters placed()) # Uneonnent below once you have implemented get words e for word in board.get worda) print (vord) Uneoarent below once you bave implmented top-8coring-words # print """" Top Scoring words "- for word in board.top scoring words() p' : 2, print(vord) t1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
