Auto Topic: dominoesgame

auto_dominoesgame | topic

Coverage Score
1
Mentioned Chunks
13
Mentioned Docs
3

Required Dimensions

definitionpros_cons

Covered Dimensions

definitionpros_cons

Keywords

dominoesgame

Relations

SourceTypeTargetW
Auto Topic: dominoesgameCO_OCCURSAuto Topic: self12
Auto Topic: dominoesgameCO_OCCURSAuto Topic: vertical9
Auto Topic: dominoesgameCO_OCCURSAuto Topic: rows8
Auto Topic: dominoesgameCO_OCCURSAuto Topic: row8
Auto Topic: dominoesgameCO_OCCURSAuto Topic: get_board7
Auto Topic: colsCO_OCCURSAuto Topic: dominoesgame7
Auto Topic: colCO_OCCURSAuto Topic: dominoesgame6
Auto Topic: dominoesgameCO_OCCURSAuto Topic: legal_moves5
Auto Topic: dominoesgameCO_OCCURSAuto Topic: perform_move5
Auto Topic: defCO_OCCURSAuto Topic: dominoesgame5
Auto Topic: dominoesgameCO_OCCURSAuto Topic: raise4
Auto Topic: dominoesgameCO_OCCURSAuto Topic: valueerror4
Auto Topic: copyCO_OCCURSAuto Topic: dominoesgame4
Auto Topic: dominoesgameCO_OCCURSAuto Topic: is_legal_move3
Auto Topic: dominoesgameCO_OCCURSAuto Topic: int3
Auto Topic: dominoesgameCO_OCCURSAuto Topic: isinstance3

Evidence Chunks

SourceConfidenceMentionsSnippet
assignments
CIS5210-Assignments/M4/homework4.pdf
0.656... me(3, 3) >>> g.perform_move(1, 0, False) >>> g.get_board() [[False, False, False], [True, True, False], [False, False, False]] 3 8. In the DominoesGame class, write a methodgame_over(self, vertical) that returns whether the current player is unable to place any dominoes. >>> b = ...
assignments
CIS5210-Assignments/M4/homework4.pdf
0.635... is a two-dimensional list of Boolean values, whereTrue corresponds to a filled square andFalse corresponds to an empty square. 1 1. In the DominoesGame class, write an initialization method__init__(self, board) that stores an input board of the form described above for future use ...
assignments
CIS5210-Assignments/M4/homework4.pdf
0.635) >>> g.get_board() == g2.get_board() False 10. In the DominoesGame class, write a method successors(self, vertical) that yields all successors of the puzzle for the current player as (move, new-game) tuples, where moves themselves are (row, column) tuples. The second element of ...
assignments
CIS5210-Assignments/M4/homework4.pdf
0.593... nd (row, col + 1). This convention will 2 be followed throughout the rest of the section. >>> b = [[False, False], [False, False]] >>> g = DominoesGame(b) >>> g.is_legal_move(0, 0, True) True >>> g.is_legal_move(0, 0, False) True >>> b = [[True, False], [True, False]] >>> g = Dom ...
assignments
CIS5210-Assignments/M4/homework4.pdf
0.572... e a methodreset(self) which resets all of the internal board’s squares to the empty state. >>> b = [[False, False], [False, False]] >>> g = DominoesGame(b) >>> g.get_board() [[False, False], [False, False]] >>> g.reset() >>> g.get_board() [[False, False], [False, False]] >>> b = ...
assignments
CIS5210-Assignments/M4/homework4.pdf
0.572>> for m, new_g in g.successors(True): ... print m, new_g.get_board() ... (0, 1) [[True, True], [True, True]] Optional: In the DominoesGame class, write a methodget_random_move(self, vertical) which 4 returns a random legal move for the current player as a (row, column) tuple. Th ...
assignments
CIS5210-Assignments/M4/homework4.pdf
0.572... ailable to the current player, then subtract the number of moves available to the opponent. >>> b = [[False] * 3 for i in range(3)] >>> g = DominoesGame(b) >>> g.get_best_move(True, 1) ((0, 1), 2, 6) >>> g.get_best_move(True, 2) ((0, 1), 3, 10) >>> b = [[False] * 3 for i in range ...
assignments
CIS5210-Assignments/M4/homework4.py
0.572... ws < 0 or cols < 0: raise ValueError("rows and cols must be non-negative") board = [[False] * cols for _ in range(rows)] return DominoesGame(board) class DominoesGame(object): def __init__(self, board): if board is None: raise ValueError("board cannot be None") if not isinstance( ...
assignments
CIS5210-Assignments/M4/hw4-optimized.py
0.572... ws < 0 or cols < 0: raise ValueError("rows and cols must be non-negative") board = [[False] * cols for _ in range(rows)] return DominoesGame(board) class DominoesGame(object): __slots__ = ('board', 'rows', 'cols') def __init__(self, board): if board is None: raise ValueError("boa ...
assignments
CIS5210-Assignments/M4/homework4.pdf
0.551... 1), (1, 2)] >>> list(g.legal_moves(False)) [(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1)] >>> b = [[True, False], [True, False]] >>> g = DominoesGame(b) >>> list(g.legal_moves(True)) [(0, 1)] >>> list(g.legal_moves(False)) [] 7. In theDominoesGameclass, write a methodperform_m ...
assignments
CIS5210-Assignments/M4/homework4.py
0.551class DominoesGame(object): def __init__(self, board): if board is None: raise ValueError("board cannot be None") if not isinstance(board, list): raise TypeError("board must be a list of rows") self.rows = len(board) self.cols = len(board[0]) if self.rows else 0 for row in board: ...
assignments
CIS5210-Assignments/M4/homework4.py
0.551... vertical): for _ in self.legal_moves(vertical): return False return True def copy(self): return DominoesGame([row[:] for row in self.board]) def successors(self, vertical): for move in self.legal_moves(vertical): new_game = self.copy() new_game.perform_move(move[0], move[1], ver ...
assignments
CIS5210-Assignments/M4/hw4-optimized.py
0.551... (rows): row = b[r] for c in range(col_limit): if not row[c] and not row[c + 1]: return False return True def copy(self): return DominoesGame([row[:] for row in self.board]) def successors(self, vertical): for move in self.legal_moves(vertical): new_game = self.copy() new_game.per ...