mirror of
https://github.com/neogeek23/Tic-Tac-Toe.git
synced 2026-02-04 10:58:17 +00:00
Add files via upload
This commit is contained in:
parent
25b213a924
commit
8ab1ce875c
@ -137,7 +137,7 @@ class Board:
|
|||||||
result = ""
|
result = ""
|
||||||
for i in range(self.__dimensions):
|
for i in range(self.__dimensions):
|
||||||
result += str(random.randrange(start, stop))
|
result += str(random.randrange(start, stop))
|
||||||
if i < self.__dimensions:
|
if i < self.__dimensions - 1:
|
||||||
result += "."
|
result += "."
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ class Board:
|
|||||||
return self.__get_random_coordinate(center, center + 1)
|
return self.__get_random_coordinate(center, center + 1)
|
||||||
|
|
||||||
def place_random(self, token):
|
def place_random(self, token):
|
||||||
return self.place_token(self.__get_random_coordinate(0, self.__dimensions + 2), token)
|
return self.place_token(self.__get_random_coordinate(0, self.__dimensions + 1), token)
|
||||||
|
|
||||||
def __is_winning_move(self, coordinate, player):
|
def __is_winning_move(self, coordinate, player):
|
||||||
intersecting_paths = list()
|
intersecting_paths = list()
|
||||||
@ -298,6 +298,7 @@ while not board.is_full() and not board.has_winner():
|
|||||||
print("Remaining attempts: " + str(3 - move_attempts) + " failure will result in random placement.")
|
print("Remaining attempts: " + str(3 - move_attempts) + " failure will result in random placement.")
|
||||||
coordinate_move = input("Player " + str(player_to_play + 1) + " please input coordinates (<nth index>.<nth - 1 "
|
coordinate_move = input("Player " + str(player_to_play + 1) + " please input coordinates (<nth index>.<nth - 1 "
|
||||||
"index>. ... .<3rd index>.<rows>.<cols>) of move: ")
|
"index>. ... .<3rd index>.<rows>.<cols>) of move: ")
|
||||||
|
move_attempts += 1
|
||||||
move_result = board.place_token(coordinate_move, board.players[player_to_play])
|
move_result = board.place_token(coordinate_move, board.players[player_to_play])
|
||||||
|
|
||||||
if move_result > 0 and move_attempts >= 3:
|
if move_result > 0 and move_attempts >= 3:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user