Giter VIP home page Giter VIP logo

tic-tac-toe's Introduction

tic-tac-toe

This is a Tic Tac Toe game that you can play against an easy, medium or hard bot

Introduction

This is a small project of mine, completed in one day. I initally made it for a bet with a colleague, who told me he was unbeatable in this very simple game. So I created this bot to show him, that even he would lose.

The Code

Easy Bot

This one just randomly selects a avaiable slot on the board. Nothing more there

Medium bot

This one iterates through all available slots and if there is a move the human player could make in order to win, it blocks it. if there isn't it just chooses the next available slot.

Unbeatable Bot

This one was a bit tricky and the algorithm behind is called minimax I think. But after reading a few tutorials about it, it is clear to me know what it does. It basically iterates through all available moves, makes a move, switches the perspective to the humans perspective and calls it self. So it recursively gets all possibillities the game could end and chooses the best move to make in order to win

Roadmap

To be honest: I don't know if I even come back to this, but in case I do there are a few things I would want to add:

  1. Maybe an online mode (very low priority)
  2. There is always more one can add to something like that

P.S.: I am sorry if I made spelling mistakes or some other mistakes

tic-tac-toe's People

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.