Skip to content

Commit

Permalink
Update tictactoe.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptainPickard committed Oct 21, 2022
1 parent fa7c91d commit 9fe52d2
Showing 1 changed file with 28 additions and 43 deletions.
71 changes: 28 additions & 43 deletions ai_created/tictactoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
# print("It's a draw!")
# break




# Player 1:

# X
Expand All @@ -28,43 +25,31 @@
# O



# {

# (1,1): " ", (1,2): " ", (1,3): " ",
# (2,1): " ", (2,2): " ", (2,3): " ",
# (3,1): " ", (3,2): " ", (3,3): " "
# }





def print_board(board):
print("The board look like this: \n")

for i in range(3):
print(" ", end=" ")
for j in range(3):
if board[i*3+j] == 1:
print("X ", end=" ")
elif board[i*3+j] == 0:
print("O ", end=" ")
elif board[i*3+j] != -1:
print(board[i*3+j]-1, end=" ")
else:
print(" ", end=" ")

print()

def print_instruction():
print("Please use the following cell numbers to make your move")
print_board([2,3,4,5,6,7,8,9,10])

def get_input(turn):
valid = False
while not valid:
try:
player = input("Where would you like to place " + turn + " (1-9)? ")
player = int(player)
if player
# def print_board(board):
# print("The board look like this: \n")

# for i in range(3):
# print(" ", end=" ")
# for j in range(3):
# if board[i*3+j] == 1:
# print("X ", end=" ")
# elif board[i*3+j] == 0:
# print("O ", end=" ")
# elif board[i*3+j] != -1:
# print(board[i*3+j]-1, end=" ")
# else:
# print(" ", end=" ")

# print()

# def print_instruction():
# print("Please use the following cell numbers to make your move")
# print_board([2,3,4,5,6,7,8,9,10])

# def get_input(turn):
# valid = False
# while not valid:
# try:
# player = input("Where would you like to place " + turn + " (1-9)? ")
# player = int(player)
# if player

0 comments on commit 9fe52d2

Please sign in to comment.