Using Tetris Like MS Paint

Check out Samus looking boss in this pixelated image. Who would have thought of using Tetris as a canvas for these types of graphics? Coming up with the original idea of strategically clearing and leaving Tetris pieces to end up with what is shown above is hard enough. But how in the heck do you implement the algorithm that generated this programmatically?

First off, two thing should not be surprising about this. It wasn’t manually generated during normal gameplay. That would be beyond savant level. The other thing to note is that the order in which pieces occurred was not random, but strategically calculated by the algorithm. The challenge is not only to occupy and clear the correct pixels, but to make sure the correctly colored pieces remain.

You need to see the fast-motion video embedded after the break to fully appreciate the coding masterpiece at work. We’re not going to try to paraphrase how the algorithms functions, but get comfy with the link above which walks through all of the theory (in addition to supplying the code so you can try it yourself).

[via Reddit]

11 thoughts on “Using Tetris Like MS Paint

  1. The Tetris play field is supposed to be 10 blocks wide.

    So, not random pieces, and not the standard play field.

    While this reduces it down to a definite NON-TETRIS hack, it’s more than I could do in a hurry.

  2. at last im liberated from the label of crazy!

    i just KNEW there was a pattern.
    it’s what ive been telling people for years…
    you should see me play, i use the button that drops the piece
    ALL the way down instantly and play a LOT faster then most people.

    the first few levels go much faster that way.
    and subconciously knowing the next 3 pieces
    helps with beating other people’s top scores too.

    too bad it takes days of playing several hours each
    to warm up to the patterns. once your there,
    you can trash anybody’s highscore list in less then an hour.

    KUDOS FOR BEING ABLE TO CALCULATE THE PATTERENS!
    i always thought about how hard that would be to do.
    it would be eaiser to teach something HOW to learn.

    PS: im talking about tetris with ONLY one next-piece displayed.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.