Fix mancala catching empty board, ben is a boomer

This commit is contained in:
AllinolCP 2022-02-07 09:08:29 +07:00 committed by GitHub
parent 98f8c8ae02
commit de00f8867c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,7 @@ class MancalaLogic(ITable):
continue continue
opposite_hollow = 12 - hollow opposite_hollow = 12 - hollow
if hand == 1 and self.board[hollow] == 0: if hand == 1 and self.board[hollow] == 0 and self.board[opposite_hollow] > 0:
if (self.current_player == 1 and hollow in range(0, 6)) or (self.current_player == 2 and hollow in range(7, 13)): if (self.current_player == 1 and hollow in range(0, 6)) or (self.current_player == 2 and hollow in range(7, 13)):
self.board[my_mancala] += self.board[opposite_hollow] + 1 self.board[my_mancala] += self.board[opposite_hollow] + 1
self.board[opposite_hollow] = 0 self.board[opposite_hollow] = 0