Your project for the semester will be to create a board game. Your game will consist of a series of cards that the user will receive. Each card will contain a scenario and the number of spaces to...

1 answer below »

Your project for the semester will be to create a board game. Your game will consist of a series of cards that the user will receive. Each card will contain a scenario and the number of spaces to either advance or move back on the board. You can choose the theme for the game. You will create a series of versions throughout the term to implement the program.


Final Game Specifications



  • Include pseudocode.

  • Create a story line and theme for your game, which will be explained in the game rules.

  • Create at least 10 “cards” from which the user can choose.

  • Use text-based graphics to enhance the user-friendliness of your game.

  • Include a scenario and a point value on each card.

  • Use an accumulator to keep track of the user’s position on the board.

  • Display the user’s position after each card is chosen.

  • Use a main menu to allow the user to play as many times as he/she wishes.

  • Use a text file to store the card scenarios and point values.

  • Read the card scenarios and point values from the text file and store the data in lists.

  • Use a random number generator to select a card.

  • Keep track of the cards that have been chosen and do not allow a card to be chosen more than once.

  • Use functions to maximize the efficiency of your code.


Versions



  1. Input/Output

  2. Decisions

  3. Looping/Repetition

  4. Lists/Files

  5. Functions

Answered Same DayAug 06, 2021

Answer To: Your project for the semester will be to create a board game. Your game will consist of a series of...

Abhishek Kumar answered on Aug 08 2021
149 Votes
import random
def initialize_game():
global gameLength,boardSize, position, notTraversed, cardsUsed, movesLeft
global clover, cards, frozen, cardsL
eft, victory, loss
cards = []
clover = []
gameLength = 10 #Number of moves the game allows
boardSize = 20
position = 0
notTraversed = 20 #stores the number of squares yet to be traversed
cardsUsed = [] #list of indices of the cards already used
movesLeft = 10
frozen = False #set to true when the player cannot move forward
cardsLeft = [] #stores the indices of the card still in play
victory = False
loss = False
def readScenarios():
"""Read each card scenario from a file. Each non-empty line of the file contains
a record separated with a |. The constituents of these record are - name of
the card, scenario, and the action to be taken.
"""
with open('scenarios.txt', 'r') as cardsFile:
global clover, cards
for card in cardsFile.readlines():
#This condition checks for existence of non-whitespace characters in a line.
if len(card.strip()) > 0:
#Split a record at '|' and store in a temporary list.
temp = card.split('|')
#Strip whitespace from every string in temp
temp = [x.strip() for x in temp]
if temp[0] == "Clover":
clover = temp.copy()
else:
cards.append(temp.copy())
def drawCard():
""" Draw a card. The actions for cards...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here