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
| Source | Type | Target | W |
|---|---|---|---|
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: self | 12 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: vertical | 9 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: rows | 8 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: row | 8 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: get_board | 7 |
| Auto Topic: cols | CO_OCCURS | Auto Topic: dominoesgame | 7 |
| Auto Topic: col | CO_OCCURS | Auto Topic: dominoesgame | 6 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: legal_moves | 5 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: perform_move | 5 |
| Auto Topic: def | CO_OCCURS | Auto Topic: dominoesgame | 5 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: raise | 4 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: valueerror | 4 |
| Auto Topic: copy | CO_OCCURS | Auto Topic: dominoesgame | 4 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: is_legal_move | 3 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: int | 3 |
| Auto Topic: dominoesgame | CO_OCCURS | Auto Topic: isinstance | 3 |
Evidence Chunks
| Source | Confidence | Mentions | Snippet |
|---|---|---|---|
assignments CIS5210-Assignments/M4/homework4.pdf | 0.65 | 6 | ... 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.63 | 5 | ... 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.63 | 5 | ) >>> 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.59 | 3 | ... 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.57 | 2 | ... 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.57 | 2 | >> 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.57 | 2 | ... 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.57 | 2 | ... 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.57 | 2 | ... 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.55 | 1 | ... 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.55 | 1 | class 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.55 | 1 | ... 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.55 | 1 | ... (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 ... |