Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Probably should put a few functions hereabouts def inputCard ( file _ name: str ) - > tuple: with open ( file _ name,

# Probably should put a few functions hereabouts
def inputCard(file_name: str)-> tuple:
with open(file_name, 'r') as a:
lines = a.readlines()
b = lines[0].strip()
verifiers =[[bool(int(number)) for number in line.strip().split(',')] for line in lines[1:]]
return (b, verifiers)
def getVerifierInput(input_: str)-> list:
character = input_.lower().split(',')
indices =[ord(chars)- ord('a') for chars in character]
return sorted(indices)
def guessToIndex(guess: int)-> tuple:
with open("verifierAddress.in",'r') as a:
lines = a.readlines()
for line in lines:
guess_value, x, y = line.strip().split(',')
if int(guess_value)== guess:
return (int(x), int(y))
return None
def checkVerifier(gameCard: tuple, guess: int)-> bool:
_, verifiers = gameCard
x, y = guessToIndex(guess)
return verifiers[x][y]
def listCriteria(gameCards: list)-> str:
criteria_= "You have {} criteria
".format(len(gameCards))
for index, gameCard in enumerate(gameCards):
criterion = gameCard[0]
criteria_+="{}){}
".format(chr(65+ index), criterion)
return criteria_.strip()
def showTurnHistory(guesses: list, history: list)-> str:
headers ="xyz A B C D E
------------------
"
rows =[]
for guess, res in zip(guesses, history):
row ="{:03d}".format(guess)
for r in res:
if r ==0:
row +=""
elif r ==1:
row +="X "
elif r ==2:
row +="O "
rows.append(row.rstrip())
return headers +"
".join(rows)
def showVerifier(verifier: list)-> str:
output =""
for row in verifier:
output +="".join(["O" if cell else "X" for cell in row])+"
"
return output.strip()
if __name__=="__main__":
# This is not part of the tests, so you can use this
# to help check your code is working.
pass I am having too issues "Returned O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O
O O O O O O O O O O O O and expected O O O X X O O O O O X O
O O O O O X X X O O X O
O X O O O X O O O O X O
O X O X O X O X X O X O
O X X X O O X O X X O O
O O X O O O O O X O O O
O O O X O X O X X O O X
X O O X O X O X O O X X
O O O O X X X O O O X O
O O X X O O O O O X O O
O O X X X O O X X O O O
O O O O O O O O O O O O" "The turn history output doesn't match! Pay careful attention to the spaces
We expected:
xyz A B C D E
------------------
124 X X O
214 X X O
351 X X O
But was:
xyz A B C D E
------------------
124 X X O
214 X X O
351 X X O"

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

The paleolithic age human life, short write up ?

Answered: 1 week ago

Question

Using Language That Works

Answered: 1 week ago

Question

4. Are my sources relevant?

Answered: 1 week ago