Return True if the given letter has won the game. >>> is_winner([' ', 'X','X','X',' ',' ',' ',' ',' ',' '], 'X') True >>> is_winner([' ']*10, 'O') False
(board: List[str], le: str)
| 71 | |
| 72 | |
| 73 | def is_winner(board: List[str], le: str) -> bool: |
| 74 | """ |
| 75 | Return True if the given letter has won the game. |
| 76 | |
| 77 | >>> is_winner([' ', 'X','X','X',' ',' ',' ',' ',' ',' '], 'X') |
| 78 | True |
| 79 | >>> is_winner([' ']*10, 'O') |
| 80 | False |
| 81 | """ |
| 82 | return ( |
| 83 | (board[7] == le and board[8] == le and board[9] == le) |
| 84 | or (board[4] == le and board[5] == le and board[6] == le) |
| 85 | or (board[1] == le and board[2] == le and board[3] == le) |
| 86 | or (board[7] == le and board[4] == le and board[1] == le) |
| 87 | or (board[8] == le and board[5] == le and board[2] == le) |
| 88 | or (board[9] == le and board[6] == le and board[3] == le) |
| 89 | or (board[7] == le and board[5] == le and board[3] == le) |
| 90 | or (board[9] == le and board[5] == le and board[1] == le) |
| 91 | ) |
| 92 | |
| 93 | |
| 94 | def get_board_copy(board: List[str]) -> List[str]: |
no outgoing calls
no test coverage detected