Giter Site home page Giter Site logo

nes-tetris-ai's Introduction

NES TETRIS AI

screencast.gif

Running

  • download Classic Tetris NES rom (I'm not sure about licensing of 30yo+ games, so I'm not including it in the repo. It's very easy to find though)
  • save it as public/roms/tetris.nes
  • npm i
  • npm run start

Moar

  • It's possible to move all the calculations to the Worker by setting WORKER to true in src/connfig.ts.
  • Even it logic in the workes is the same as the one for the browser'smain thread, I just copied the code (together with configuration) because I didn't want to spend time on forcing imports to work in the Worker (or inportScripts in the browser).
  • The algorithm isn't optimized for speed yet, so the non-blocking Worker version doesn't really work as expected
  • To skip the loading screen on each refresh:
    • start the game
    • pause it right after the first tetramino is visible (Q)
    • run nes.save(0) in the console.
    • index.ts will load previously saved state if available
    • it's possible to have multiple starting points ("saves"), just increment the argument passed to the load/save methods
  • The best result I get so far was ~517k points, what was more than enough to qualify to Classic Tetris World Championship last year. 2019 threshold was ~650k, so we're not there yet ;).
  • Feel free to open pull requests with improvements.

nes-tetris-ai's People

Contributors

michalbe avatar

Stargazers

Szymon Piłkowski avatar Maciej Budzyński avatar

Watchers

 avatar James Cloos 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.