<jupyter_start><jupyter_text>this Game has a small flaw don't choose filled places in the board ohterwise it will stop you can work to fix this!!!!<jupyter_code># Step One (1)

def player_indentification():
    
    # Iam making this while loop in case of player hits a wrong input 
    while True:
        player_id = input('you wnat to be player 1 or 2')
        if player_id in ['1','2'] :
            print( f'you are player {int(player_id)}')
            print('you chooce X id')
            return int(player_id)
        else:
            print('please choose carefuley!')
            continue


# Step Two (2)

def player_markeer():
    marker = input('you whant to be "X" or "O" : ')
    return marker

# Step Three (3)

def player_position():
    pos = input('enter your play: ')
    return pos

# Step Four (4)

def player_move():
    move = input('enter your move: ')
    

# Step Five (5)

def player_turn():
    print('player 2 ')
    player2move = input('enter your move: ')
    if player2move in range(1,10):
        pos
        

# Step Six (6)

def marker_choose():
    mark = input('You wnat to go for "X" or "O" :')
    return mark
    

# Step Seven (7)

from IPython.display import clear_output

def board_display(board):
    clear_output()
    print(board[7],'|',board[8],'|',board[9])
    print('----------')
    print(board[4],'|',board[5],'|',board[6])
    print('----------')
    print(board[1],'|',board[2],'|',board[3])

# Step Eight (8)

def choose_position():
    while True:
        pos = int(input('Enter your move position (form 1:9): '))
        return pos

# Step Nine (9)

def position_check(board,i):
    if board[i] == 'x' or board[i] =='o' :
        print()
        print('You choose full position try again')
        return False     
    else:
        pass 
    

# Step Ten (10)

def winning_check(board):
    
    for i in range(1,len(board)-3) :
        
        # check for horizontal line winning condintion
        
        if board[i] == 'x':
            if board[i] == board[i+1] and board[i] == board[i+2]:
                
                return True
            else:
                pass
        
        # check for horizontal line winning condintion
        
            if i in range(1,4):   
                if board[i] == board[i+3] and board[i] == board[i+6]:
                    
                    return True
                else:
                    pass
                
        elif board[i] == 'o':
        
        # check for horizontal line winning condintion
        
            if board[i] == board[i+1] and board[i] == board[i+2]:
                
                return True
            else:
                pass
        
        # check for horizontal line winning condintion
        
            if i in range(1,4):   
                if board[i] == board[i+3] and board[i] == board[i+6]:
                    
                    return True
                else:
                    pass
        else:
            pass


# Step Elevne(11)

def continue_playing():
    ask = input('Want to continue playing "Y" or"N"')
    return ask

from IPython.display import clear_output

def play_game():
    
                                           # writing the complete Game Here!!

    clear_output()

    print('Welcom to Tic Tac Toe Game! My first Game Ever!!!!!!!!!!')

# in case user didn't choose x or o characters

    while True:
    
        markers = ['x','o']
        player1 = player_markeer()
        if player1 not in markers:
            print('You must choose "X" or "O" ')
            continue
        else:
            break

    markers.remove(player1)
    player2 = markers[0]
    board = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']

    board_display(board)

    play = True

    while play:
    
        p1 = True
    
   # first player Turn

        while p1:
        
            print('Player 1 ',player1,' choose position')
            pos = choose_position()
        
            check = position_check(board,pos)
            if check == False:
                    continue
            else:
                pass
        
            board[pos] = player1
        
            board_display(board)
         
        # winning check for player one
        
            win = winning_check(board)
        
            if win == True:
            
                print('congratulations!! you won')
            
                decision = continue_playing()
            
                if decision == 'y':
                    %rerun
                elif decision == 'n':
                    play = False
                    break
        
            else:
                p1 = False
                continue
        
    # second player Turn
    
        while not p1:
            
            print('Player 2 ',player2,' choose position')
        
            pos = choose_position()
            
            check = position_check(board,pos)
        
            if check == False:
                continue
            else:
                pass
        
            
            board[pos] = player2
            
            board_display(board)
            
        # winning check for player 2
            
            win = winning_check(board)
        
            if win == True:
            
                print('congratulations!! you won')
            
                decision = continue_playing()
            
                if decision == 'y':
                    %rerun
                    break
                elif decision == 'n':
                    play = False
                    break
            else:
                p1 = True
                continue
                    
            
        
        
play_game()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10247533321793319, 'fraction_numerical': 0.011251514626969016, 'mean_word_length': 1.2197464464079908, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '412667', 'license': 'Unlicense', 'n_tokens_mistral': 1631, 'n_tokens_neox': 1553, 'n_words': 463, 'path': 'mini_projects/Tic Tac Toe Game my work.ipynb', 'repo_name': 'Mahmoud-shabban/Udacity_data_analysis_track_fwd_initiative', 'size': '5777'}