Python Forum
Python Tic Tac Toe with Functions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Tic Tac Toe with Functions
#3
1. Move variables that do not change to the global scope as constants.
2. Avoid DRYness (note that you are repeating variables like "+---+---+---+"
3. Removed unused declaration (this is not C), (as example see answer=None)
4. Consider using a class instead of passing the game_board as param
5. If you really need to pass a list (like game_board) consider using a copy of
it (is passed by ref and this can have side effects)
5. Consider a more concise style (see how legal_move can be simplified)
6. Your logic can be simplified
7. Write some unit tests
Reply


Messages In This Thread
Python Tic Tac Toe with Functions - by jorisnl - Jul-31-2023, 04:00 PM
RE: Python Tic Tac Toe with Functions - by codingismycraft - Nov-26-2023, 04:28 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020