Question: For this assignment, you will write a program that simulates playing a board game with 2 - 4 players. The players each have 8 tiles

For this assignment, you will write a program that simulates playing a board game with 2 - 4 players. The players each have 8 tiles with which to construct words. The object of the game is to see who can construct the most words with their tiles. If two (or more) players can construct an equal number of words, then the game ends in a tie. Write a program that simulates the game.

(1st part)

The file GameTiles.txt contains all of the tiles needed for the game. The file lists a letter and then how many tiles exist that contain that letter. Read the information from the file into a dictionary. Use the information from that dictionary to "deal" a tile to each player (one at a time: first deal a tile to player1, then to player2, then to player3, etc. Only deal to the active players (many games may be played and sometime players will sit out for a round; active players are players who plan on playing this particular game) - repeating the process until all players have 8 tiles each). The eight tile represents the players "hand". Remember, you cannot deal out more tiles than exists in the dictionary. For example, there is only one 'X' tile, thus only one person could possibly have this tile in their hand.

(2nd part)

Next you need to find all of the words that can be made with the 8 tiles for each player. Because the same tasks will be done for each player's hand, you should create a function called deal_tiles to perform this task. The function can call other functions if you like. The CROSSWD.TXT file contains all of the official words that can be created by the players. You will also need to a dictionary containing all letters and their point values. You can find the letters and their matching scores in the file GameTiles.txt. You will need to read in the information from this file and build a dictionary. You will also need to read the pickled data from tile_scores.dat into a dictionary called scores which will hold the information on how many points each tile is worth.

(3rd part)

Find all of the valid words that can be made from the CROSSWD.TXT file using only the tiles available in each players hand. Make sure you are consistent about capitalization. Make sure you handle repeated letters: once a letter from the rack has been used, it can't be used again. Finally, write the code to determine the scores for each valid word, using the scores dictionary from above.Then display each player's hand and list of words (with each word's score). An example input and output for a player is as follows:

(4th part)

Lastly, you need to determine and congratulate the winner or let the users know if there is a tie. The player who was able to contruct the most words wins.

Hint for this assignment: consider using lists to keep track of wining players

(output example)

Player 1's hand: ZAEFIEEC

Word Scores and Words 1: feeze - 17 points 2: feaze - 17 points 3: faze - 16 points 4: fiz - 15 points 5: fez - 15 points 6: zee - 12 points 7: fice - 9 points 8: face - 9 points 9: cafe - 9 points 10: fie - 6 points 11: fee - 6 points 12: if - 5 points 13: ice - 5 points 14: fa - 5 points 15: ef - 5 points 16: cee - 5 points 17: ace - 5 points 18: ai - 2 points 19: ae - 2 points

https://uhcl.blackboard.com/bbcswebdav/pid-2780074-dt-content-rid-27621368_1/xid-27621368_1

tile_scores.dat: (TextEdit file)

}q(XaqKXcqKXbqKXeqKXdqKXgqKXfqKXiqKXhq KXkq KXjqKXmqKXlq KXoqKXnqKXqqKXpqKXsqKXrqKXuqKXtqKXwqKXvqKXyqKXxqKXzqK u.

CROSSWD.TXT: (random word generator)

fallals fallback fallbacks fallen faller fallers fallfish fallfishes fallible fallibly falling falloff falloffs fallout fallouts fallow fallowed fallowing fallows falls false falsehood falsehoods falsely falseness falsenesses falser falsest falsetto falsettos falsie falsies falsification falsifications falsified falsifies falsify falsifying falsities falsity faltboat faltboats falter faltered falterer falterers faltering falters fame famed fameless fames famiglietti familial familiar familiarities familiarity familiarize familiarized familiarizes familiarizing familiarly familiars families family famine famines faming famish famished famishes famishing famous famously famuli famulus fan fanatic fanatical fanaticism fanaticisms fanatics fancied fancier fanciers fancies fanciest fanciful fancifully fancily fancy fancying fandango fandangos fandom fandoms fane fanega fanegada fanegadas

Game_Tiles.txt:

A, 10

B, 2

C, 2

D, 4

E, 12

F, 2

G, 3

H, 2

I, 9

J, 1

K, 1

L, 4

M, 2

N, 6

O, 8

P, 2

Q, 1

R, 6

S, 4

T, 6

U, 5

V, 2

W, 2

X, 1

Y, 2

Z, 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!