Git Product home page Git Product logo

dqn-tictactoe's Introduction

DQN-TicTacToe

my demo of DQN with TicTacToe

The Reward of the Environment

  • 1 - win
  • 0 - anything else

The Agent

The agent in the demo is special in the sense that it doesn't only do the right moves for only one player (X\O) but predict the best move in each position whatever the turn.

In each position s the agent will predict the best action a using the Q-learning equation:

  • a = argmax_a'(Q(s, a'))

The Training

In order to train the agent we will use a relay memory approach which will sample random Transitions (current state, action, reward, next state. where current state isn't terminal) and train the agent on them. for a given Transition the agent be trained using the following equation: if current state isn't terminal: // next state is not none

  • Q(current_state, action) = reward - max_a'(Q(next_state, a'))

Translating that to human language we get "the best that i can do in the current position is the reward to the next position plus the worst action (to me) that my enemy can do to me". in our case we can remove the reward term since any reward to a non-terminal state is always 0, so will use:

  • Q(current_state, action) = - max_a'(Q(next_state, a'))

if current state is terminal: // next state is none

  • Q(current_state, action) = reward

dqn-tictactoe's People

Contributors

sdos280 avatar

Watchers

 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.