12/6/2023 0 Comments My -first -tic tac toe. py![]() ![]() Winv = for j in range( 0, lenboa, 2)] for i in range( 0, lenboa, 2)] Winh = for j in range( 0, lenboa, 2)] for i in range( 0, lenboa, 2)] #Win conditions: Horizontal, Vertical, Main Diagonal, Other Diagonal #List representing the win for each piece (player)-X and O #Checks victory conditions for the game by checking board If occupied, then ask player for another move''' '''Check board position is not already occupied before placing piece. ![]() Playerpos = input( 'Please enter a number from 1 to 9 to place your piece on the board: ') While playerpos not in '123456789' or playerpos = '': #Initiate and input player move, making sure it is a number from 1 to 9 #Add last set of column borders in the last rowÄef player( playerpiece, board, movesmap): #Add borders to the odd numbered rows and columns #Generate 2d-grid-array with empty space as placeholder for elementsÄ«oard = * ( numrows + 2) for _ in range( numrows + 2)]
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |