Giter Site home page Giter Site logo

tic-tac-toe's Introduction

Tic-Tac-Toe

The game uses tic-tac-toe game mode to allow players to play against the computer or physical opponents

The overall flow of the game works as such -

The game begins by initializing an empty 3x3 board, represented as a list of lists.

The main function is called, which enters a loop that continues until the game is won or the board is full.

Within the loop, the draw_board function is called to print the current state of the board to the console.

<p>The get_human_move function is called to allow the human player to enter their move. This function prompts the user to enter a column and row, and then places an "X" at that position on the board if it is a valid move.</p>

<p> The has_winner function is called to check if the game has been won by the human player. If the function returns True, the loop is broken and the game ends.</p>

<p>If the game is not yet won, the draw_board function is called again to update the board with the human player's move.</p>

<p>The get_computer_move function is called to allow the computer player to make a move. This function generates a random column and row, and then places an "O" at that position on the board if it is a valid move.</p>

<p>The has_winner function is called again to check if the game has been won by the computer player. If the function returns True, the loop is broken and the game ends.</p>

<p>If the game is not yet won, the loop continues and the players take turn making moves until the game is won or the board is fun </p>

Create a pull request and make amazing contributions to this repo

tic-tac-toe's People

Contributors

beautyscribbles avatar

Watchers

 avatar

tic-tac-toe's Issues

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.