Processes the game logic for the given matrix and moves. Args: size (int): Size of the game board. matrix (List[str]): Initial game matrix. moves (List[Tuple[int, int]]): List of moves as (x, y) coordinates. Returns: int: The total score obtained. >>> pr
(size: int, matrix: list[str], moves: list[tuple[int, int]])
| 241 | |
| 242 | |
| 243 | def process_game(size: int, matrix: list[str], moves: list[tuple[int, int]]) -> int: |
| 244 | """Processes the game logic for the given matrix and moves. |
| 245 | |
| 246 | Args: |
| 247 | size (int): Size of the game board. |
| 248 | matrix (List[str]): Initial game matrix. |
| 249 | moves (List[Tuple[int, int]]): List of moves as (x, y) coordinates. |
| 250 | |
| 251 | Returns: |
| 252 | int: The total score obtained. |
| 253 | >>> process_game(3, ['aaa', 'bbb', 'ccc'], [(0, 0)]) |
| 254 | 6 |
| 255 | """ |
| 256 | |
| 257 | game_matrix = [list(row) for row in matrix] |
| 258 | total_score = 0 |
| 259 | |
| 260 | for move in moves: |
| 261 | pos_x, pos_y = move |
| 262 | game_matrix, score = play(game_matrix, pos_x, pos_y, size) |
| 263 | total_score += score |
| 264 | |
| 265 | return total_score |
| 266 | |
| 267 | |
| 268 | if __name__ == "__main__": |
no test coverage detected