GregoryCannon / StackRabbit

An AI for playing NES Tetris at a high level. Based primarily on search & heuristic, with high quality board evaluation through value iteration.
434 stars 45 forks source link

StackRabbit

An AI that plays NES Tetris at a high level. Primarily based on search & heuristic, with high-quality board eval through value iteration.

Due to the logistics of playing NES Tetris, there are two different clients for interacting with the main AI backend:

Then there are two components of the backend:

How to Set Up

Requirements

Steps

  1. Clone or Extract:

    • Clone this repository or extract the zip file from the releases page.
  2. Obtain NES Tetris ROM:

    • Legally acquire the ROM for NES Tetris. You can use TetrisGYM.
  3. Open Command Line:

    • Press Win + R, type cmd, and press Enter.
    • Navigate to the folder for Stackrabbit using cd path/to/stackrabbit.
  4. Install Dependencies:

    • Run npm i in the command line.
  5. Start the Application:

    • If the previous command runs without errors, execute npm start.
  6. Setup FCEUX:

    • Open the FCEUX folder.
    • Add all .lua files (excluding itn12.lua, mime.lua, and socket.lua, put them in C:/path/to/fceux/lua) from the Luasocket repository to C:/path/to/fceux/lua/socket/. (if there is no lua folder, create it and the socket folder inside)
  7. Load Tetris ROM:

    • In FCEUX, click File > Open and select the Tetris ROM.
  8. Run Stackrabbit Script:

    • In the FCEUX window, go to File > Lua > New Lua Script Window.
    • In the new window, browse and run path/to/stackrabbit/src/fceux/stackrabbit.lua.
    • Open level 19 and let it start!