Open yunjiangster opened 2 years ago
The bound function drop_piece below is basically dropping a piece at the (5, column) coordinate of the board, if (0, column) hasn't been occupied. What's the point of doing that? Isn't it supposed to drop a piece at a general coordinate?
class board(): def __init__(self): self.init_board = np.zeros([6,7]).astype(str) self.init_board[self.init_board == "0.0"] = " " self.player = 0 self.current_board = self.init_board def drop_piece(self, column): if self.current_board[0, column] != " ": return "Invalid move" else: row = 0; pos = " " while (pos == " "): if row == 6: row += 1 break pos = self.current_board[row, column] row += 1 if self.player == 0: self.current_board[row-2, column] = "O" self.player = 1 elif self.player == 1: self.current_board[row-2, column] = "X" self.player = 0
The bound function drop_piece below is basically dropping a piece at the (5, column) coordinate of the board, if (0, column) hasn't been occupied. What's the point of doing that? Isn't it supposed to drop a piece at a general coordinate?