Skip to content

Commit 5850a5b

Browse files
style: format code with autopep8
Format code with autopep8 This commit fixes the style issues introduced in 3f7b716 according to the output from Autopep8. Details: None
1 parent 36c6942 commit 5850a5b

File tree

1 file changed

+10
-1
lines changed
  • Terminal Tic Tac Toe(AI)

1 file changed

+10
-1
lines changed

Terminal Tic Tac Toe(AI)/app.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import random
22

3+
34
def pb(b):
45
for r in b:
56
print('|'.join(r))
67
print('-'*5)
78

9+
810
def iw(b, p):
911
return any(all(c == p for c in r) for r in b) or any(all(b[i][j] == p for i in range(3)) for j in range(3)) or all(b[i][i] == p for i in range(3)) or all(b[i][2-i] == p for i in range(3))
1012

13+
1114
def id(b):
1215
return all(all(c != '.' for c in r) for r in b)
1316

17+
1418
def gec(b):
1519
return [(i, j) for i in range(3) for j in range(3) if b[i][j] == '.']
1620

21+
1722
def mm(b, d, im):
1823
s = {'X': 1, 'O': -1, 'draw': 0}
1924
if iw(b, 'X'):
@@ -39,6 +44,7 @@ def mm(b, d, im):
3944
bs = min(bs, s)
4045
return bs
4146

47+
4248
def gbm(b):
4349
bs = float('-inf')
4450
bm = None
@@ -51,6 +57,7 @@ def gbm(b):
5157
bm = (i, j)
5258
return bm
5359

60+
5461
def main():
5562
b = [['.' for _ in range(3)] for _ in range(3)]
5663
p = 'X'
@@ -66,7 +73,8 @@ def main():
6673
print("It's a draw!")
6774
break
6875
if p == 'X':
69-
r, c = map(int, input("Enter row and column (0-2) separated by space: ").split())
76+
r, c = map(int, input(
77+
"Enter row and column (0-2) separated by space: ").split())
7078
if b[r][c] != '.':
7179
print("Invalid move. Try again.")
7280
continue
@@ -78,5 +86,6 @@ def main():
7886
b[r][c] = 'O'
7987
p = 'X'
8088

89+
8190
if __name__ == "__main__":
8291
main()

0 commit comments

Comments
 (0)