Skip to content

Commit

Permalink
Update tic_tac_toe.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Coding4Hours authored Jul 9, 2024
1 parent 7c5298d commit 1b61ded
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tic_tac_toe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1b61ded

Please sign in to comment.