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
Consider a multiprocessor system and a multithreaded program written using the many-to-many threading model. Let the number of u
Montano1993 [528]

Answer:

At the point when the quantity of bit strings is not exactly the quantity of processors, at that point a portion of the processors would stay inert since the scheduler maps just part strings to processors and not client level strings to processors. At the point when the quantity of part strings is actually equivalent to the quantity of processors, at that point it is conceivable that the entirety of the processors may be used all the while. Be that as it may, when a part string obstructs inside the portion (because of a page flaw or while summoning framework calls), the comparing processor would stay inert. When there are more portion strings than processors, a blocked piece string could be swapped out for another bit string that is prepared to execute, in this way expanding the use of the multiprocessor system.When the quantity of part strings is not exactly the quantity of processors, at that point a portion of the processors would stay inert since the scheduler maps just bit strings to processors and not client level strings to processors. At the point when the quantity of bit strings is actually equivalent to the quantity of processors, at that point it is conceivable that the entirety of the processors may be used at the same time. Be that as it may, when a part string hinders inside the piece (because of a page flaw or while summoning framework calls), the relating processor would stay inert. When there are more portion strings than processors, a blocked piece string could be swapped out for another bit string that is prepared to execute, along these lines expanding the usage of the multiprocessor framework.

4 0
3 years ago
What is integrated circuit package ​
enyata [817]

Answer:

Explanation:

, integrated circuit packaging is the final stage of semiconductor device fabrication, in which the block of semiconductor material is encapsulated in a supporting case that prevents physical damage and corrosion.

4 0
3 years ago
Read 2 more answers
An Ocean Thermal Energy Conversion (OTEC) power plant built in Hawaii in 1987 was designed to operate between the temperature li
lukranit [14]

Answer:

Detailed solution is given below

4 0
3 years ago
Read 2 more answers
Define schema &amp; Instance...<br><br><br>don't spam..<br>​
zubka84 [21]

Answer:

<h3>Hey there ! </h3><h3>Here is your Answer Buddy | </h3>

<h3>• Define Instance :- </h3>

  • The data stored in database at a particular moment of time is called instance of database.

<h3>• Define Schema :- </h3>

  • Database schema defines the variable declarations in tables that belong to a particular database

<h3><u>The value of these variables at a moment of time is called the instance of that database.</u></h3><h3 />

Explanation:

<h3>Hope this helps !! </h3>
4 0
3 years ago
Read 2 more answers
All of these are true about GMA (MIG) welding EXCEPT that:
Hatshy [7]

Answer:

the welding gun liner regulates the shielding gas.

Explanation:

The purpose of the welding gun liner is to properly position the welding wire from the wire feeder till it gets to the nozzle or contact tip of the gun. <em>Regulation of the shielding gas depends on factors such as the speed, current, and type of gas being used. </em>In gas metal arc welding, an electric arc is used to generate heat which melts both the electrode and the workpiece or base metal.

The electric arc produced is shielded from contamination by the shielding gas. The heat generated by the short electric arc is low.

3 0
3 years ago
Other questions:
  • A short-circuit experiment is conducted on the high-voltage side of a 500 kVA, 2500 V/250 V, single-phase transformer in its nom
    5·1 answer
  • Water at 20 °C is flowing with velocity of 0.5 m/s between two parallel flat plates placed 1 cm apart. Determine the distances f
    5·1 answer
  • Match the words in the left column to the appropriate blanks in the sentences on the right. Note that some words may be used mor
    14·1 answer
  • An automobile having a mass of 900 kg initially moves along a level highway at 100 km/h relative to the highway. It then climbs
    7·1 answer
  • As the impurity concentration in solid solution of a metal is increased, the tensile strength:________.a) decreasesb) increasesc
    9·1 answer
  • Air at 80 °F is to flow through a 72 ft diameter pipe at an average velocity of 34 ft/s . What diameter pipe should be used to
    10·2 answers
  • The Torricelli's theorem states that the (velocity—pressure-density) of liquid flowing out of an orifice is proportional to the
    5·1 answer
  • Niagara Falls is capable of producing a total power output of 2.575 MW at steady-state during the night when flow over the falls
    14·2 answers
  • Describe how you might use the concept of parts presentation to help a classroom full of children complete a craft project. Disc
    5·1 answer
  • When block C is in position xC = 0.8 m, its speed is 1.5 m/s to the right. Find the velocity of block A at this instant. Note th
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!