1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Arada [10]
4 years ago
8

A board is a common concept that appears in many games such as Monopoly, Tic Tac Toe, Connect 4, Chess, and Checkers. For this a

ssignment, you will be creating a simple board class that we will likely incorporate into future projects We are also going to go just a little bit beyond having a single board and allow the user to create multiple boards that they can then switch between.
An Example RunEnter the name of your board: Tic Tac ToeEnter the number of rows for your board: 3Enter the number of columns for your board: 3Enter the blank character to be used on your board: *Tic Tac Toe 0 1 20 * * *1 * * *2 * * *Select your action from the list below.1. Fill Spot2. Erase Spot3. Switch Board4. Create Board5. Quit

Engineering
1 answer:
vovangra [49]4 years ago
8 0

Answer:

Kindly check the code screenshot in the attached images below.

Explanation:

Program Files

filename: board.py

from typing import Iterable, List, TypeVar, Any

class Board:

def __init__(self, name:str, row:int, column:int, char:str):

self.name = name

self.row = row

self.column = column

self.char = char

def print_board(self, name:str, row:int, column:int, char:int):

name = name.strip()

print(name)

rowPrint = []

for i in range(int(column)+1):

if i == 0:

colTitle = ' '

else:

colTitle = colTitle + ' ' + str(i-1)

print(colTitle)

for i in range(int(row)):

rowPrint.append(str(i) + (' ' + str(char.strip())) * column)

print(rowPrint[i])

return rowPrint, colTitle

def erase_board(self, name:str, row:int, char:str, erase_row:int, erase_col:int, rowPrint:list, colTitle:list) -> list:

print(name)

print(colTitle)

for i in range(int(row)):

if i == erase_row:

newString = rowPrint[i][:((int(erase_col)+1)*2)] + str(char.strip()) + rowPrint[i][((int(erase_col)+1)*2)+1:]

rowPrint[i]=newString

print(rowPrint[i])

else:

print(rowPrint[i])

return rowPrint

def fill_board(self, name:str, row:int, fill_char:str, fill_row:int, fill_col:int, rowPrint:list, colTitle:list)->list:

print(name)

print(colTitle)

for i in range(int(row)):

if i == fill_row:

newFillString = rowPrint[i][:((int(fill_col)+1)*2)] + str(fill_char.strip()) + rowPrint[i][((int(fill_col)+1)*2)+1:]

rowPrint[i]= newFillString

print(rowPrint[i])

else:

print(rowPrint[i])

return rowPrint

def switch_action(self, name:str, colTitle:list, rowPrint:list)->None:

print(name)

print(colTitle)

for i in rowPrint:

print(i)

def new_board_save(self, row:int, column:int, char:str)->list:

rowPrint = []

for i in range(int(column) + 1):

if i == 0:

colTitle = ' '

else:

colTitle = colTitle + ' ' + str(i - 1)

for i in range(int(row)):

rowPrint.append(str(i) + (' ' + str(char)) * column)

return rowPrint, colTitle

You might be interested in
A group of scientists studied the environmental impact of internal combustion engines burning hydrocarbon fuels. The scientist e
wel

Answer: Combustion of Hydrocarbons

Explanation:

The Independent variable in an experiment is the one whose effect on the dependent variable is being measured. The independent variable therefore is controlled to see the effect it will have in the experiment.

In this experiment, the scientists combusted different types of hydrocarbons (diesel, gasoline, natural gas and a gasoline/ethanol mixture) as they aimed to find out the effect that this burning would have on the environment thereby making the combustion of hydrocarbons the independent variable.

7 0
3 years ago
An escalator in a shopping center is designed to move 50 people, 75 kg each, at a constant speed of 0.6 m/s at 450 slope. Determ
REY [17]

Answer:

Power required to drive the escalator shall be equal to the rate at which the energies of the persons is increased.

Energy=n\times mass\times g\times h\\\\\therefore Power=n\times mass\times g\times \frac{dh}{dt}\\\\Power=50\times 75\times 9.81\times 0.6sin(45)\\\\Power=15.607kW

As we infer from the above equation If the velocity of the escalator is doubled then the Power required will also be doubled and become 31.215kW

3 0
4 years ago
Critical Thinking Scenario The Vice President for Compliance Management, Alexander Goodenuff, supports the position taken by Hen
Kisachek [45]

Answer:

True, True

Explanation:

1st Scenario: Purchase of new contamination equipment would indicate that the plant had been violating environmental regulations and reporting false data. So, Cathy and Henry must not purchase and install new contamination equipment unless the data indicates serious violatino of environmental regulations.

2nd Scenario: Company has the responsibiltiy to report contamination in plant water to regulatory agencies and Cathy Martin has been assigned this responsibility to report on behalf of the company. Reporting "adjusted" or inaccurate data is against the business ethics. So, professionally Cathy Martin is responsible for her reports to regulatory agencies.

8 0
4 years ago
Ceramics has the weakness of resisting high compression force but low tensile force. a)-True b)-False
Nesterboy [21]

Answer: b) False

Explanation:Ceramic is brittle in nature therefore it has a tendency that it is strong during the compression and it tends to be weak during the high tensile forces. While the tensile forces are applied , ceramics are not able to yield the stress and cause breakage of the material due to high tension but does not face any fault during the compression.

7 0
4 years ago
Which of the following identifies the three main steps in the design process of an engineer?
ikadub [295]

Answer:

define the problem, do background research and specify requirements

8 0
3 years ago
Other questions:
  • What is the maximum number of 12-2 with ground nonmetallic-sheathed cables permitted in an 18-cubic-inch device box if two singl
    11·2 answers
  • PLZ HURRY IM ON A TIMER
    6·1 answer
  • List and describe three basic Boolean operations commonly used in
    10·1 answer
  • thermodynamics A nuclear power plant based on the Rankine cycle operates with a boiling-water reactor to develop net cycle power
    9·1 answer
  • The speed of sound is 1150 ft/s convert to mile/h
    7·1 answer
  • Which of the following justifies the need for an already-certified engineer to continue to take classes?
    15·1 answer
  • Determine how much concrete you will need for a slab which is 50 feet by 30 feet wide and 1 foot thick
    15·1 answer
  • A hypothetical metal alloy has a grain diameter of 1.7 102 mm. After a heat treatment at 450C for 250 min, the grain diameter ha
    8·1 answer
  • The following is a correlation for the average Nusselt number for natural convection over spherical surface. As can be seen in t
    13·1 answer
  • What regulates labeling of food, drugs, and cosmetics?
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!