Tic-tac-toe (American English), noughts and crosses (British English), or Xs and Os is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a horizontal, vertical, or diagonal row wins the game. Total lines of code without comments: 220 Total lines of code without comments: 258 Total numbe of functions developed: 7
- def tic_tac_toe() : This is the main function of the program which consists all the functions and methods
- def draw() : The function of draw function is to draw a board of 3x3 dimension for user inputs for the game
- def p1() : This function takes the position value where he wants to place his/her cross
- def p2() : This function takes the position value where he wants to place his/her nought
- def choose_number() : This function takes an integer input from 1 to 9 from the players and passes them to p1() and p2() function
- def check_win() : This is the main function of the program which consists all the functions and methods
- def check(player) : This function check if the player exists already and also sends the index value
Libraries used
- Pandas
Operations and modules used from Pandas library
- File importing and reading function, dataframe data structures, concatenation, sort, index resetting
- User data (Name and Age) has been taken as dictionary form and getting stored in dataframe data structure
Operations and modules used from Python library
- Used namespace for importing pandas as pd
- if, else, elif, for, while, print, global etc operations has been used.