Coder Social home page Coder Social logo

unbeatable_tictactoe's Introduction

Unbeatable TicTacToe - The frustrating AI

Why is it unbeatable?

Tic Tac Toe is a mecanical game, it has a finite, small number of possible combinations. You can teach an AI to always win or draw. Here is a small explanation.

First of all, it's not artificial intelligence. There are a couple of rules that make sure that you always win or draw (or in this case, that the AI wins or draws):

  1. If AI begins, it takes a random corner.
  2. If the player begins with a corner, AI takes the center. If not, AI takes a corner.
  3. Check for player doublets (dangerous doublets) and fill the holes to avoid loosing.
  4. If AI has a corner, AI tries to take another corner (this is the strategy to win... errr, to check if the player is attentive).
  5. If necessary, play randomnly.

So next time you play with a friend, try these simple rules. You'll be unbeatable as well.

Remember that loosing at Tic Tac Toe is linked with lack of attention. And maybe you be can inattentive, but a program cannot.

unbeatable_tictactoe's People

Contributors

ffivaz 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.