Giter Site home page Giter Site logo

tic_tac_toe-game's Introduction

1stproject

Python program to play tic-tac-toe using minimax algo and using random function of python. Mukul Lakra 200101069

Command to run the python program:

python3 200101069_Assign04.py

Explanation:

Then the program will run and as soon as it will run , it will firstly ask you that which difficulty level you want to play. Press 1 for hard difficulty and 0 for easy difficulty. Then it will ask you that which symbol you want to take for that tic-tac-toe game. Press 1 for 'X' and 0 for 'O' Then it will ask you whether you want to go first or not. Press 1 if you want to go first and 0 if you want to go second. Then it will run computer's move and ask you to place your move by entering a integer between 1 and 9 based on the ordering printed at the beginning of the output. In easy level , computer's move is made by generating a random integer between 1 and 9 and playing that move if that box is empty or else generate any other number. In hard level , computer only makes the optimal or best possible move and it is implemented using minimax algorithm. The board is printed after every move so that user can see that which place is empty. Finally computer decides that who has won or whether its a draw. As the game gets over , the program asks you whether you want to play another game or not. Press 1 if you want to play another game , 0 otherwise. And then it will again ask you about the difficulty level and so on.

Warning: When it will ask you to choose difficulty or symbol or whether you want to go first or whether you want to play again , just enter an integer because if you enter a string and as I have used int(input()) and as string is not convertible to integer , an error will be raised and the program will terminate unexpectedly.


tic_tac_toe-game's People

Contributors

msd7797 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.