ffss
This commit is contained in:
parent
d6ce3d2579
commit
24601be13c
6
main.py
6
main.py
@ -16,12 +16,12 @@ class TicTacToe:
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
while True:
|
while True:
|
||||||
self.board.make_move(self.player1.token, self.player1.make_random_move(self.board.emptyFields))
|
self.board.make_move(self.player1.token, self.player1.choose_random_field(self.board.emptyFields))
|
||||||
self.board.print()
|
self.board.print()
|
||||||
if self.board.isWin(self.player1.token, self.player1.name):
|
if self.board.isWin(self.player1.token, self.player1.name):
|
||||||
break
|
break
|
||||||
|
|
||||||
self.board.make_move(self.player2.token, self.player2.make_random_move(self.board.emptyFields))
|
self.board.make_move(self.player2.token, self.player2.choose_random_field(self.board.emptyFields))
|
||||||
self.board.print()
|
self.board.print()
|
||||||
if self.board.isWin(self.player2.token, self.player2.name):
|
if self.board.isWin(self.player2.token, self.player2.name):
|
||||||
break
|
break
|
||||||
@ -66,7 +66,7 @@ class Player:
|
|||||||
self.token = token
|
self.token = token
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
def make_random_move(self, emptyFields):
|
def choose_random_field(self, emptyFields):
|
||||||
return random.choice(emptyFields)
|
return random.choice(emptyFields)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user