Coder Social home page Coder Social logo

tictactoe's Introduction

TicTacToe

This is a 1 player game of TicTacToe againt an AI. The AI is implemented using the minimax algorithm that choses the best possible move for any given scenario.

It is almost imposible to beat this AI as in the worst case scenario this bot will follow a path that will result in a draw.

MiniMax Algo

Getting Started


Prerequisties

You will require the following tools to compile / execute this application

  • any C++ compiler (g++, clang, MingW, etc.)
  • This code is platform independent, it will compile / run on both Windows and Unix.

Compiling

Use the following command in a terminal to create an executable file from this source code

g++ main.cpp draw.cpp gameloop.cpp ai.cpp board.cpp

Note: I have used g++, but you can use any compiler of your choice. If don't wish to compile this source code yourself you can download the executeable version of the same from the releases, that corresponds to your system.

Executing the program

If you are on Windows you simply double click on the executable file or alternatively you can run the same using the 'CMD' by using the following command

a.exe

Note: Here 'a.exe' is the name of the executable file.

If you are on any Unix platform you can use the following commands in a terminal

$ cd /path/to/folder/having/executable

$ ./a.out

Note: Here 'a.out' is the name of the executable file.

Game in action

GIF

Authors

  • Vinayak Goswami - Initial work - vini7148

tictactoe's People

Contributors

vini7148 avatar

Stargazers

 avatar Vignesh Goswami avatar Arnav Balyan 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.