Git Product home page Git Product logo

ai-for-game-playing's Introduction

AI for Game Playing: Atari Breakout AI (Deep Q-Network)

Atari Breakout AI

This is an implementation of the classic Atari game Breakout, where an AI plays the game using Deep Q-Network (DQN) learning. The game is created using the Pygame library, and the DQN algorithm is implemented using PyTorch. The AI learns to play Breakout by interacting with the game environment and optimizing its actions based on rewards obtained during gameplay.

Requirements

Install requirements using the following command:

pip install -r requirements.txt

Run the code

cd src/
python net_dqn_test.py 

Train the net

cd src/
python net_dqn_train.py 

AI Training

The AI uses the DQN algorithm to learn how to play Breakout. During training, it explores different actions in the game and observes the rewards obtained. The AI's goal is to maximize its rewards by adjusting its actions based on the Q-values learned from the DQN.

Deep Q-Network (DQN) Learning

The training process of the Atari Breakout AI involves using Deep Q-Network (DQN) learning, which is a form of reinforcement learning. DQN combines Q-learning, a value-based RL algorithm, with deep neural networks to approximate the Q-values of different state-action pairs.

Q-Value Function

In DQN, the AI aims to learn the Q-value function, denoted as $Q(s, a)$, which represents the expected cumulative reward for taking action $a$ from state $s$ and then following the optimal policy thereafter. The Q-value function can be defined recursively as follows:

$$ Q(s, a) = R(s, a) + \gamma \cdot \max[Q(s', a')] $$

where:

  • $R(s, a)$ is the immediate reward obtained by taking action $a$ in state $s$.
  • $γ$ is the discount factor, representing the importance of future rewards compared to immediate rewards.
  • $s'$ is the next state after taking action $a$ in state $s$.
  • $a'$ is the action taken in the next state $s'$.

ai-for-game-playing's People

Contributors

sergeygasparyan avatar

Watchers

Kostas Georgiou 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.