
Show HN: Build Your Own Tetris Playing Program - mattbrenman
https://github.com/mbrenman/TetrisPlayground?a=a
======
mattbrenman
I built this Tetris Playground for a class, and I built a few bots to play
against it. I'd love to see what other people could build to play on it. The
goal was to make it work in a way that building new bots would be very
straightforward and not involve understanding or writing Tetris game code.

I'd love any feedback on the system, and pull requests are absolutely welcome!
Thanks for looking!

~~~
guru_meditation
Huge thumbs up for making the effort to share a simulated environment.

Having these kinds of "toy" environments can result in more research into some
interesting problems.

Over the course of years I taught or helped teach several classes and I
implemented a bunch of one-off systems for evaluating AI agents.

Feedback on the system:

    
    
       * Implementation:
         * I encourage a more modern use of C++, certain choices
             unnecessarily complicate the code and make it less
             flexible.
         * Example:
    
      	Piece *p = new Piece(curPiece->getPieceID());
            ...
            delete p;
    
          * (use unique_ptr instead)
    
         * Example 2:
           in game/Piece.h you do not advertise constness on
           simpler getter accessors.
    
         * Example 3:
           * the constants in game/Constants.h make
             experimentation in Runtime not flexible enough.
             There's no reason why most if not all of these 
             constants should not be configuration parameters
             for a game.
    
         * Example 4:
           * Instead of documenting some errors with cerr,
             consider using exceptions. 
    
       * Include a proper build file. I recommend CMake as it is
         available for all popular platforms and easy to read for
         simple projects like this. Otherwise a simple Makefile 
         will do.
    
     * Features:
       * Provide a way to automatically evaluate:
         * A single agent performance using one or more proposed
           scores.
         * Agents against each others using the ELO system
       * Simulate all nuances of the Tetris game
       * Compare agent performance to that of human players
       * Provide bindings to other languages that are fun to hack
         in, such as Python and Lua. Extra credits to make the 
         bindings accessible to languages that do not share the 
         same machine model, such as JVM-based Scala/Java/Clojure
         or functional languages such as Haskell or O'Caml.
         ... maybe Arc or Racket bindings as well? ;))

------
xigency
This is cool. One more note along the lines of creating interfaces for more
languages--it might be useful to create a client/server architecture so an AI
application written in any language could interface. Still, this is something
I would like to experiment with as a C++ programmer.

Edit: I also think it's great that you include your paper as a write-up.

------
sgnl
Which Tetris engine does this follow? The newer engine found in most recent
releases of the game or is it off the basic GB/NES engine?

