No older revisions available
No older revisions available
Describe MineSweeper/김민경 here.
~cpp #MineSweeper #MineSweeper size1=0 size2=0 data=[] check=[] def in_put(): global size1 global size2 size1,size2=input('사이즈를 입력하세요(n1,n2 형식으로 입력하세요)') for i in range(size1): check.append([0 for j in range(size2)]) for i in range(size1): temp=raw_input() data.append(temp) def process(): dx=[-1,-1,-1,0,0,1,1,1] dy=[-1,0,1,-1,1,-1,0,1] for x in range(size1): for y in range(size2): if data[x][y]=='*' : check[x][y]='*' for i in range(8): if x+dx[i]>=0 and x+dx[i]<size1 and y+dy[i]>=0 and y+dy[i]<size2: if data[x+dx[i]][y+dy[i]]=='*' and check[x][y]!='*': check[x][y]=check[x][y]+1 def output(): for i in range(size1): for j in range(size2): print check[i][j], print if __name__=="__main__": in_put() process() output()