Skip to content

Fixed Battleship game ends abruptly if given bad input #622#674

Merged
ChrisLovering merged 4 commits into
python-discord:mainfrom
rijusougata13:main
Apr 12, 2021
Merged

Fixed Battleship game ends abruptly if given bad input #622#674
ChrisLovering merged 4 commits into
python-discord:mainfrom
rijusougata13:main

Conversation

@rijusougata13
Copy link
Copy Markdown
Contributor

@rijusougata13 rijusougata13 commented Apr 11, 2021

Relevant Issues

Closes #622

Description

self.match = re.fullmatch("([A-J]|[a-j]) ?((10)|[1-9])", message.content.strip())
I changed the regular expression match to full match .

Reasoning

Basically pattern.match will return if any prefix of that pattern matches.
pattern.fullmatch will return true when the whole string matches

Screenshots

Additional Details

Did you:

  • Join the Python Discord Community?
  • If dependencies have been added or updated, run pipenv lock?
  • Lint your code (pipenv run lint)?
  • Set the PR to allow edits from contributors?

@ks129
Copy link
Copy Markdown
Contributor

ks129 commented Apr 11, 2021

@rijusougata13 Thanks for your contribution! Please fill pull request template fully and give why and what you changed. Thanks.

@rijusougata13 rijusougata13 changed the title Fixed #622 Fixed Battleship game ends abruptly if given bad input #622 Apr 11, 2021
@rijusougata13
Copy link
Copy Markdown
Contributor Author

@ks129 is it okay now?

Copy link
Copy Markdown
Contributor

@ks129 ks129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@rijusougata13
Copy link
Copy Markdown
Contributor Author

so then we can merge and close the issue

@ChrisLovering ChrisLovering enabled auto-merge April 12, 2021 21:42
@ChrisLovering ChrisLovering merged commit 634ec30 into python-discord:main Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Battleship game ends abruptly if given bad input

3 participants