Giter Club home page Giter Club logo

tetris-ai's Introduction

Tetris AI

Demo of my current best AI so far: http://yuweixu.com/tetris-ai/

This is my attempt write a Tetris AI. In highschool, I worked on a Tetris Battle clone for a final project. However, I never had a chance to write an AI. Instead of building on top of my old code, I am using a simple Tetris I found on github. The code is very hacky because it's a lot of experimentation.

Brief Summary of AI

Currently, the AI considers every possible position that the next piece can be placed and calculates a score. This score depends on four features: the total height of each column, sum of the height differences between neighbouring columns, number of lines cleared, and number of holes.

Initially, the AI generates 1000 sets of random weights. Each set of weights is used to simulate a tetris game. The sets that clear the most lines are used for producing the next generation of random weights. This is repeated for many generations, eventually producing sets that can clear many lines. I'll add more detail once I'm satisfied with the algorithm.

Checkout the neural-network branch for the AI trained using neuralevolution

More info on Genetic Algorithms: https://en.wikipedia.org/wiki/Genetic_algorithm

Original repo and credits for creating the game: https://github.com/dionyziz/canvas-tetris

tetris-ai's People

Contributors

dionyziz avatar shkesar avatar c2brosflee avatar

Stargazers

Merve Deniz Şenelen avatar John Manos avatar TheGreatRambler avatar Wang Junming avatar Raymond Velasquez avatar  avatar

Watchers

James Cloos avatar yx avatar

tetris-ai's Issues

Doesn't work!

I downloaded the code and opened index.html...

It doesn't show anything...just a blank screen

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.