Git Product home page Git Product logo

tictactoe's Introduction

TicTacToe

Tic Tac Toe game implementation using minimax algortihm

In a Tic Tac Toe game two players, X and O, take turns to mark the spaces in a 3X3 grid. The winner will be the player who first succeeds in placing three of his/her marks in a horizontal, vertical, or diagonal row. This is a program for a computer (X player) to play with a human (O player) on Tic Tac Toe game given an initial status of the game. The initial status of the game is represented by a string of 9 characters. For example, the game status can be expressed using string “OOO_OX_XX". The program always plays the winning strategies and try to defeat the human player if possible. The program tries to play a maxmin strategy first. If the maxmin strategy is not beneficial it will play a minmax strategy to minimize the payoff of the other player.

The sample input and output are shown below: Example 1: "XXO_O_XO_" The computer chooses to fill the cell #4 1 X X O X O X O The Computer Won! Example 2: "XXOOO_X__" The computer chooses to fill the cell #6 X X O O O X X Human player please select a cell number to fill: 1 Not a valid move, please try again. Please select a cell to fill: 8 Thanks. Now the board looks like: X X O O O X X O The computer chooses to fill the cell #9 X X O O O X X O X The game is finished. No one won the game.

tictactoe's People

Contributors

amankochhar avatar

Watchers

James Cloos avatar  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.