An AI for playing NES Tetris at a high level. Based primarily on search & heuristic, with high quality board evaluation through value iteration.
C++
463
745 commits
updated Sep 7, 2026
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:
fceux contains a Lua client for playing in the FCEUX emulator (primary client)console_client contains a python client that runs on Raspberry Pi to play on a real console.Then there are two components of the backend:
server contains the primary server, written in Node.js. It handles the request parsing, and the delegation to worker threads.cpp_modules contains modules that perform the core AI computation at literally 100x the speed of the original JS implementation. The main flow involves a Node server thread sending a game state to the C++ module, which returns the value of each possible move as an encoded JSON map.Clone or Extract:
Obtain NES Tetris ROM:
Open Command Line:
Win + R, type cmd, and press Enter.cd path/to/stackrabbit.Install Dependencies:
node install.js in the command line.Start the Application:
npm start.Setup FCEUX:
.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)Load Tetris ROM:
File > Open and select the Tetris ROM.Run Stackrabbit Script:
File > Lua > New Lua Script Window.path/to/stackrabbit/src/fceux/stackrabbit.lua.C++
99.0%
An AI for playing NES Tetris at a high level. Based primarily on search & heuristic, with high quality board evaluation through value iteration.
C++
463
745 commits
updated Sep 7, 2026
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:
fceux contains a Lua client for playing in the FCEUX emulator (primary client)console_client contains a python client that runs on Raspberry Pi to play on a real console.Then there are two components of the backend:
server contains the primary server, written in Node.js. It handles the request parsing, and the delegation to worker threads.cpp_modules contains modules that perform the core AI computation at literally 100x the speed of the original JS implementation. The main flow involves a Node server thread sending a game state to the C++ module, which returns the value of each possible move as an encoded JSON map.Clone or Extract:
Obtain NES Tetris ROM:
Open Command Line:
Win + R, type cmd, and press Enter.cd path/to/stackrabbit.Install Dependencies:
node install.js in the command line.Start the Application:
npm start.Setup FCEUX:
.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)Load Tetris ROM:
File > Open and select the Tetris ROM.Run Stackrabbit Script:
File > Lua > New Lua Script Window.path/to/stackrabbit/src/fceux/stackrabbit.lua.C++
99.0%