develop #2

Merged
swarga merged 10 commits from develop into master 2020-12-25 04:59:51 +01:00
Showing only changes of commit 24601be13c - Show all commits

View File

@ -16,12 +16,12 @@ class TicTacToe:
def run(self):
Review

Ten cały blok kodu możnaby sprowadzić do:

  1. Gracz wykonuje ruch.
  2. Sprawdzamy, czy mamy wygranego (remis).
  3. Zmieniamy gracza.
  4. Wracamy do 1.
Ten cały blok kodu możnaby sprowadzić do: 1. Gracz wykonuje ruch. 2. Sprawdzamy, czy mamy wygranego (remis). 3. Zmieniamy gracza. 4. Wracamy do 1.
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()
if self.board.isWin(self.player1.token, self.player1.name):
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()
if self.board.isWin(self.player2.token, self.player2.name):
break
@ -66,7 +66,7 @@ class Player:
self.token = token
self.name = name
def make_random_move(self, emptyFields):
def choose_random_field(self, emptyFields):
return random.choice(emptyFields)