Cyborg Earthworm»Blog
Anton Swifton
Before exploring possibilities for speeding up the computations in Tile Machine, I decided to add one more feature to the prototype: small challenges that allow the player to make incremental progress in the game. Trying to beat the whole game at once is difficult, I spent many hours trying to do that and only got to the average game length of 150 rows. Another reason why challenges are useful is that making patterns for all tetrominoes is a lot of work. It's much more enjoyable to make a program just for one tetromino, optimize it and extend it to handling other tetrominoes later. Thus the first several challenges don't involve the whole set of 7 tetrominoes. There are currently 16 challenges, and I will be adding more later.

Another small improvement is that the program is now stored in browser's local memory and persists when the tab is updated or closed and re-opened. If you need to start over from scratch, you can use the "Reset Program" button. This will erase the program from the local memory, though, so if you want to keep it, you need to download it.
Anton Swifton
I am planning to build a higher quality desktop version with a better UI and more advanced testing features. The idea is to use C and Windows API for UI. Another alternative is to keep doing it in javascript and just improve the current version. The current plan is to go with C, because I think that it will be easier to optimize the matching code (which is currently the only bottleneck) in C than in js. Also, I think that a Windows UI will be better than a browser UI. Also, I think that handling saves will be easier and the result will be better. I'm not completely sure about any of that, though.

When I was making the prototype I couldn't answer two questions:
1. Is the game interesting? Will other people enjoy playing it? I'm still not completely convinced that making a higher quality version is something worth doing. If I will be the only person playing the game, I can play the lousy browser version and be happy. Thus, if you like playing the prototype, please let me know. If you have read the tutorial and still don't understand how to play, please let me know as well.
2. What is the best way to implement it? I'm neither a professional nor an experienced programmer, so any advice is very appreciated. Most of my decisions about implementation are not permanent and will be tested against alternatives.

Here are some ideas that I intend to implement, but first I'm going to introduce some terms.
1. Game length is the number of rows deleted in one game.
2. Stats run is a run that doesn't display the game, but only runs it for many times (currently it's 50 000 tetrominoes) to get data about how the program works. Usually there are many games in one stats run, and currently a stats run measures the average game length, as well as the smallest and the largest. (This is a goofy term, but the best I could come up with)

Gameplay ideas:
1. Exclusions. Sometimes a pattern is generally beneficial, but harmful in some special situations. The player will be able to describe those situations and tell the computer to drop the match in that case.
2. A polyomino editor to let the player introduce their own polyominoes.
3. A default position of a tetromino that is used when no patterns fit.
4. Allow assigning the same priority to several patterns. Currently if a pattern is matched, no patterns below it are looked at. We can allow two or more patterns to be at the same level.
5. To make the game more difficult, generate semi-random sequences of tetrominoes that don't fit into the landscape.
6. Make the playfield of variable size.
7. Let the player create test cases that consist of a starting position and a sequence of polyominoes. Maybe even create some default tests.

UI ideas:
1. Allow to make groups of patterns for conciseness.
2. Allow to mute (comment out) a pattern.
3. Generate symmetric patterns automatically.
4. The patterns should be draganddroppable. I'm tired of pressing ^ and v buttons.
5. Add keyboard controls.
6. Nice pictures instead of labels for polyominoes.
7. Make a better tutorial to give people a painless start. Maybe I will make a temporary video tutorial for the prototype, if this will be helpful.
8. Make quests like "Achieve an average game length of 100 with T, L and Gamma tetrominoes".
9. Maybe integrate the tutorial into quests.

Technical ideas:
1. In the matching code, replace loops over arrays with binary operations. Hopefully, this will speed it up. To do that, store both patterns and the playing field as an array of int32 instead of a 2d array of ints.
2. Try to run computations on a video card. I've heard that it's sometimes faster than using CPU.
3. A rudimentary VCS so that the player doesn't have to navigate in numerous "program(87).txt" files. Maybe draw the tree of versions.

Ideas for getting insight into how the program works:
1. Count how many times each pattern was invoked during the most recent stats run. This will supposedly show useless patterns.
2. Display a graph of how average length of a game converges during a stats run.
3. Display a graph of Distribution of lengths of games over a stats run.
4. Make deterministic or quasirandom testing.
5. Save sequences that fill the stack fast.
6. Automatically generate positions that aren't matched by any pattern.

Unresolved questions:
1. Open source or closed source?
2. How to assess efficiency of a program? This is a big mathematical question. I will write a separate blog post about it.
3. Should I use a UI library? Is there a good UI library for Windows?
4. Currently the programs are being saved in JSON. Is it better to use some other format? If not, same question about using a library.

Edit (2019, May 20):
I'm evicting old screenshots from the front page, so here is how the game looked when this post was written.