Git Product home page Git Product logo

aritifical_intelligence_for_tictactoe's People

Contributors

coughball avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

aritifical_intelligence_for_tictactoe's Issues

AI can't think two steps ahead

In a situation where the AI has to think two steps ahead in order to prevent the player from winning it fails. A situation like this occurs when the player places his choice in two opposite diagonal places which creates two possibilities for him to win.

added a gif to illustrate the situation:

two_steps_bug

grid can reach impossible situations like [-1,-1,-1,0,0,0,1,0,0]

this is because I didn't take into account that when a pick is made, after each loop the board needs to behave like there was no pick - when coming back from recursion to the next loop iteration.
for example: (from the perspective of 1 as AI)
we started with [-1,0,0,0,0,0,1,0,0], first iteration MAX picks [-1,0,1,0,0,0,1,0,0] and goes into recursion, recursion doesnt effect this loop board because it is cloned (different board (array) pointing to a different place in memory), so the next iteration should represent the original board because it represents a situation that MAX decided to pick something different than [-1,0,1,0,0,0,1,0,0], but instead it continues with this pick and continues to [-1,1,1,0,0,0,1,0,0] -
ALREADY impossible situation, the game should be with played Alternately, cant have 3 x's and 1 o

one step bug

For some reason the AI wont prevent the player from winning in this situation, attached a gif with moves:

one_steps_bug

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.