All your parameter names should have descriptive names. You have an odd mix of good names, and poor, single-character names. You have doc-strings that give a basic idea of what each function does.You're following proper naming conventions.Besides a few things (below), your formatting is good and consistent.Your function names are nice and fairly descriptive.Winner = check_winner(board_arr, switch_turn(user)) #check if last user's input won User = switch_turn(user) #switch user's turn User_turn(board_arr, user) #prompt player input and modify board Print_board(board_arr) #print board strictly containing user input Print_board_numbered(board_arr) #print numbered board #diagonal from right, if 3 in a row (covered=3) current user wins #diagonal from left, if 3 in a row (covered=3) current user wins #check horizontals, if 3 in a row (covered=3) current user wins #check verticals, if 3 in a row (covered=3) current user wins """Check if there is currently a winner returns string of user (O or X) """Change current user turn (O or X) returns string of user Slot = int(input("Type a numbered slot: "))-1 While type(slot) is not int or slot = len(b) or type(b) = str: """Reads user's move input and modified the game board list appropriately """returns copy of board list with all integers replaced with empty spaces returns list #print horizontal line (part of print board functions) Do the comments contain sufficient detail to understand the code? Are the functions separated into their individual mechanisms/purposes properly? Is it, overall, a decently written algorithm? import random I'm open to and looking for any sort of feedback. It's not a school project or anything, I just thought this would be fun to code for practice. I wrote a Tic-Tac-Toe game for two players, where each player uses the same keyboard.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |