オセロです
pythonで実行したらできると思います
バグってたらごめんなさい。その際、良ければどんなバグがあったか教えていただけると助かります。
def start(): global banmen,okenai banmen=[[-1 for i in range(8)] for j in range(8)] for i in range(1,9): for j in range(1,9): num=(i-1)*8+j if num<10: num="0"+str(num) else: num=str(num) banmen[i-1][j-1]=num banmen[4][4]="●" banmen[3][3]="●" banmen[4][3]="○" banmen[3][4]="○" print() for i in range(8): print_banmen="" for j in range(8): count=count_notturnkoma("○","●",i,j) if count>0 or banmen[i][j]=="○" or banmen[i][j]=="●": print_banmen+=banmen[i][j] else: print_banmen+="・" print_banmen+=" " print(print_banmen) print() control(0) def control(turn): print() if turn==0: print("白の順番です。打つ手の番号を入力してください。") te=input() if len(te)==2 and te[0] in num and te[1] in num and 1<=int(te[0])*10+int(te[1])<=64 and banmen[(int(te)-1)//8][(int(te)-1)%8]!="○" and banmen[(int(te)-1)//8][(int(te)-1)%8]!="●": ban_ope(turn,te) else: print("有効な番号を入力してください") control(turn) else: print("黒の順番です。打つ手の番号を入力してください。") te=input() if len(te)==2 and te[0] in num and te[1] in num and 1<=int(te[0])*10+int(te[1])<=64: ban_ope(turn,te) else: print("有効な番号を入力してください") control(turn) print() def ban_ope(turn,te): if turn==0: me="○" you="●" else: me="●" you="○" if te[0]=="0": te=te[1] te=int(te) i=(te-1)//8 j=(te-1)%8 if not 0<=i<8 or not 0<=j<8: print("適切な数値を入力してください") control(turn) return count=count_turnkoma(me,you,i,j) if count==0: print("有効な手を入力してください") control(turn) if count>0: banmen[i][j]=me okeru=0 anti_okeru=0 koma=0 for i in range(8): print_banmen="" for j in range(8): count=count_notturnkoma(you,me,i,j) if count>0 or banmen[i][j]=="○" or banmen[i][j]=="●": print_banmen+=banmen[i][j] else: print_banmen+="・" print_banmen+=" " if count>0 and not banmen[i][j]=="○" and not banmen[i][j]=="●": okeru+=1 if banmen[i][j]=="●" or banmen[i][j]=="○": koma+=1 anti_count=count_notturnkoma(me,you,i,j) if anti_count>0 and not banmen[i][j]=="○" and not banmen[i][j]=="●": anti_okeru+=1 print(print_banmen) if koma==64: print("対局終了!") finish() elif okeru==0: if anti_okeru==0: print("どっちも置けない!") print() finish() else: print("置ける場所がない!") print() ### for i in range(8): print_banmen="" for j in range(8): count=count_notturnkoma(me,you,i,j) if count>0 or banmen[i][j]=="○" or banmen[i][j]=="●": print_banmen+=banmen[i][j] else: print_banmen+="・" print_banmen+=" " print(print_banmen) ### control(turn) else: okenai=0 if turn==0: control(1) else: control(0) def count_turnkoma(me,you,i,j): count=0 temp=0 for k in range(1,i+1): if banmen[i-k][j]!=me and banmen[i-k][j]!=you: break elif banmen[i-k][j]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): banmen[i-l][j]=me break temp=0 for k in range(1,min(j+1,i+1)): if banmen[i-k][j-k]!=me and banmen[i-k][j-k]!=you: break elif banmen[i-k][j-k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): banmen[i-l][j-l]=me break temp=0 for k in range(1,8-i): if banmen[i+k][j]!=me and banmen[i+k][j]!=you: break elif banmen[i+k][j]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): banmen[i+l][j]=me break temp=0 for k in range(1,min(8-i,8-j)): if banmen[i+k][j+k]!=me and banmen[i+k][j+k]!=you: break elif banmen[i+k][j+k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): banmen[i+l][j+l]=me break temp=0 for k in range(1,j+1): if banmen[i][j-k]!=me and banmen[i][j-k]!=you: break elif banmen[i][j-k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): banmen[i][j-l]=me break temp=0 for k in range(1,min(8-i,j+1)): if banmen[i+k][j-k]!=me and banmen[i+k][j-k]!=you: break elif banmen[i+k][j-k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): banmen[i+l][j-l]=me break temp=0 for k in range(1,8-j): if banmen[i][j+k]!=me and banmen[i][j+k]!=you: break elif banmen[i][j+k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): banmen[i][j+l]=me break temp=0 for k in range(1,min(i+1,8-j)): if banmen[i-k][j+k]!=me and banmen[i-k][j+k]!=you: break elif banmen[i-k][j+k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): banmen[i-l][j+l]=me break return count def count_notturnkoma(me,you,i,j): count=0 temp=0 for k in range(1,i+1): if banmen[i-k][j]!=me and banmen[i-k][j]!=you: break elif banmen[i-k][j]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): pass #banmen[i-l][j]=me break temp=0 for k in range(1,min(j+1,i+1)): if banmen[i-k][j-k]!=me and banmen[i-k][j-k]!=you: break elif banmen[i-k][j-k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): pass #banmen[i-l][j-l]=me break temp=0 for k in range(1,8-i): if banmen[i+k][j]!=me and banmen[i+k][j]!=you: break elif banmen[i+k][j]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): pass #banmen[i+l][j]=me break temp=0 for k in range(1,min(8-i,8-j)): if banmen[i+k][j+k]!=me and banmen[i+k][j+k]!=you: break elif banmen[i+k][j+k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): pass #banmen[i+l][j+l]=me break temp=0 for k in range(1,j+1): if banmen[i][j-k]!=me and banmen[i][j-k]!=you: break elif banmen[i][j-k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): pass #banmen[i][j-l]=me break temp=0 for k in range(1,min(8-i,j+1)): if banmen[i+k][j-k]!=me and banmen[i+k][j-k]!=you: break elif banmen[i+k][j-k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): pass #banmen[i+l][j-l]=me break temp=0 for k in range(1,8-j): if banmen[i][j+k]!=me and banmen[i][j+k]!=you: break elif banmen[i][j+k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): pass #banmen[i][j+l]=me break temp=0 for k in range(1,min(i+1,8-j)): if banmen[i-k][j+k]!=me and banmen[i-k][j+k]!=you: break elif banmen[i-k][j+k]==you: temp+=1 else: if temp!=0: count+=temp for l in range(1,k): pass #banmen[i-l][j+l]=me break return count def finish(): kuro=0 siro=0 for i in range(8): for j in range(8): if banmen[i][j]=="○": siro+=1 if banmen[i][j]=="●": kuro+=1 print() print(" 結 果 発 表 ") print() print(" ○... ",siro) print(" ●... ",kuro) print() if siro>kuro: print(" ○白の勝ち!! ") if siro<kuro: print(" ●黒の勝ち!! ") if siro==kuro: print(" 引 き 分 け ") exit() num=["0","1","2","3","4","5","6","7","8","9"] start()