From 1b61ded9eafcadebc9a5a3621520148186039a3b Mon Sep 17 00:00:00 2001 From: Coding4Hours <138321129+Coding4Hours@users.noreply.github.com> Date: Mon, 8 Jul 2024 18:49:05 -0700 Subject: [PATCH] Update tic_tac_toe.py --- tic_tac_toe.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tic_tac_toe.py b/tic_tac_toe.py index dee8474..9c70b59 100644 --- a/tic_tac_toe.py +++ b/tic_tac_toe.py @@ -38,9 +38,12 @@ def update_readme(board, status): possible_moves = [i+1 for i, v in enumerate(board) if v == ' '] moves_str = "Possible moves:\n\n" for move in possible_moves: - issue_title = f"move {move}" - encoded_title = urllib.parse.quote(issue_title) - moves_str += f"- [Move {move}](../../issues/new?title={encoded_title})\n" + if board[move] == 'X' or board[move] == 'O': + pass + else: + issue_title = f"move {move}" + encoded_title = urllib.parse.quote(issue_title) + moves_str += f"- [Move {move}](../../issues/new?title={encoded_title})\n" new_content = re.sub(r'## Current Board\n\n.*?\n\n', f'## Current Board\n\n{board_str}\n\n', content, flags=re.DOTALL) new_content = re.sub(r'## Game Status\n\n.*', f'## Game Status\n\n{status}', new_content)