TechieYan Technologies

Tic-Tac-Toe game using python

Abstract

In this tic-tac-toe game two people play the game. They place either an x or an o in a grid of three by three. You win by placing your letter to fill a complete row or column or diagonally across the sudoku field.

Tic-Tac-Toe game using python

Code Description & Execution

Program Methodology

This project is created to build a simple Tic-Tac-Toe game using python. In the program main function is defined  a utility is created to welcome  the player into  game two lists are created in the main function xstate and zstate .turn variable is created where 1 is equal to x’s turn and 0 is equal to o’s turn.a while loop is used if turn is equal 1 print x’s turn. 

A value variable is created which is a input and same with 0. A function def is created named print board xstate and zstate parameters are passed in it. In this poject we are creating eight ares to display x and o .

Another function is defined named chech win in the variable win lists are created and for loop is used in it and in if statement if the wins if x is equal to 3 print x won.And same with z state

How to Execute?

Note: Make sure you have added path while installing the software’s.

https://techieyantechnologies.com/2022/07/how-to-install-anaconda/

https://techieyantechnologies.com/2022/06/get-started-with-creating-new-environment-in-anaconda-configuring-jupyter-notebook-and-installing-libraries-using-requirements-txt-2/

  1. Install the prerequisites/software’s required to execute the code from reading the above blog which is provided in the link above.
  2. Press windows key and type in anaconda prompt a terminal opens up.
  3. Go to the directory where your requirement.txt file is present, not just requirement.txt, if you want to execute any .py or .ipynb files, you need to go to that specific folder or path, where they are saved.
  4. <<directory of your file:>>. E.g., If my file is in d drive, then.
  5. Type d:
  1. cd d:\License-Plate-Recognition-main    #CHANGE PATH AS PER YOUR PROJECT, THIS IS JUST AN EXAMPLE

          7. If your project is in c drive, you can ignore step 4 and go with step 5

          8. Run pip install -r requirements.txt or conda install requirements.txt (Requirements.txt is a text file consisting of all the necessary libraries required for executing this python file. If it gives any error while installing libraries, you might need to install them individually.), example: pip install “module_name”.

Results

Tic-Tac-Toe game using python result

Issues Faced

  1. We might face an issue while installing specific libraries, in this case, you might need to install the libraires manually. Example: pip install “module_name/library” i.e., pip install pandas
  2. Make sure you have the latest or specific version of python, since sometimes it might cause version mismatch.

Click Here To Download This Code And Associated File.

Conclusion

The Python Tic Tac Toe sport is created using the fundamental capabilities of Python and you should now not locate something puzzling. We’ve used fundamental if-else conditions together with feature calls based totally on person input for showing help messages.

 

+91 7075575787