Question: do this code, do not use ord, continue , chegg, do not import, just fix my code, so it runs correctly def read _ file
do this code, do not use "ord", "continue" "chegg", do not import, just fix my code, so it runs correctly
def readfilefilename:
with openfilename, r as file:
width intfilereadline
height intfilereadline
grid
for i in rangeheight:
row file.readlinestripsplit
grid.appendrow
return grid
def makeemptygridgrid:
emptygrid
for row in grid:
emptyrow
for i in row:
emptyrow.append
emptygrid.appendemptyrow
return emptygrid
def updategridgrid:
directions
for i in rangelengrid:
for j in rangelengrid:
if gridij:
minecount
for dx dy in directions:
x y i dx j dy
if x lengrid and y lengrid and gridxyX:
minecount
gridij strminecount
def diganswergrid, coordinate, userview:
x ordcoordinate orda
y intcoordinate
userviewxy answergridxy
def counttotalmovesuserview:
return sumrowcount for row in userview
def printgridgrid:
width lengrid
height lengrid
for i row in enumeratereversedgrid:
printfheight i :djoincell for cell in row
printjoinchrorda i for i in rangewidth
def determinegamestatusgrid userview:
for i row in enumerategrid:
for j cell in enumeraterow:
if cell X and userviewij:
return False
return True'
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
