Nytro Posted January 29, 2014 Report Posted January 29, 2014 Applying Artificial Intelligence to Nintendo Tetris Abstract In this article, I explore the deceptively simple mechanics of Nintendo Tetris. Afterwards, I describe how to build an AI that exploits them. Table of Contents Abstract Table of Contents Try It Yourself About Preliminaries Download Run Configuration The Mechanics of Nintendo Tetris Representing Tetriminos Rotating Tetriminos Spawning Tetriminos Picking Tetriminos Shifting Tetriminos Dropping Tetriminos Slides and Spins Level 30 and Beyond Lines and Statistics Coloring Tetriminos Game Mode Legal Screen Demo The Kill Screen Endings 2 Player Versus Music and Sound Effects Play States and Render Modes The Algorithm Overview Searching for Lock Evaluation Function Other Factors AI Training Java Version About Packages AI Classes and Interfaces Invoking the AI Displaying the Playfield Other Projects Gamepad Version Try It Yourself About For those lacking the persistence, patience and time necessary to master Nintendo Tetris, I created an AI to play it for you. Finally, you can experience level 30 and beyond. You can witness the score max out while the line, level and statistics counters wraparound indefinitely. Find out what colors appear in levels higher than any human has ever reached. Discover how long it can go. Preliminaries To run the AI, you'll need FCEUX, the all-in-one NES/Famicom emulator. The AI was developed for FCEUX 2.2.2, the most recent version at the time of this writing. You'll also need the Nintendo Tetris ROM file (USA version). Google might be able to help you to track it down. Download Extract lua/NintendoTetrisAI.lua from this source zip. Run Start up FCEUX. From the menu bar, select File | Open ROM... In the Open File dialog box, select the Nintendo Tetris ROM file and press Open. The game will launch. From the menu bar, select File | Lua | New Lua Script Window... From the Lua Script window, enter the path to NintendoTetrisAI.lua or hit the Browse button to navigate to it. Finally, press Run. The Lua script will direct you to the first menu screen. Leave the game type as A-Type, but feel free to change the music using the arrow keys. On slower computers, the music may play choppy; you might want to disable it completely. Press Start (Enter) to advance to the next menu screen. In the second menu, you can change the starting level using the arrow keys. Press Start to begin the game. The AI will take over from there. From the second menu screen, after you select the level, if you hold down gamepad button A (use Config | Input... to modify the keyboard mapping) and press Start, the resulting starting level will be 10 plus the selected value. The highest starting level is 19.Articol: Applying Artificial Intelligence to Nintendo Tetris Quote