文章预览
来源:投稿 作者:LSC 编辑:学姐 unset unset 一面 unset unset 1.自我介绍,我说了10min 2.Coding 原代码的fll和 over函数是空白的,完善下面代码的" Design an algorithm to fill the entire chessboard with gobang(五子棋), which means every grid on the board should be occupied by either a black or a white piece. The chessboard is a 2D array of size n x n, where n is an odd integer. The first player is Black, and the second player is White. The chessboard is initially empty. from enum import Enum class State(Enum): EMPTY = 0 BLACK = 1 WHITE = 2 # & & & & **** & & # **** & & & & ** # & & & & **** & & class Gobang: def __init__(self, size: int = 15): self.size = size self.chessboard: list[list[State]] = [ [State.EMPTY for _ in range(size)] for _ in range(size) ] def fill(self) -> None:
………………………………