AI Block Battle
This competition is inspired on one of the classic games, but now two bots will be battling each other. The idea is to survive as long as long as you can, while making it as hard as possible for your opponent to do the same. Whoever survives the longest will win! Below, the rules for this competition will be explained in detail, but keep in mind this competition is still in Beta. We are currently figuring out what works the best in terms of rules and the point system, so if you have any suggestions, please post them on the discussion page
Every game round a new shape (piece) will be spawned at the top of both bots' playing field. This will always be the same piece type for both bots. Your bot must now place the piece on the bottom of the field or on top of the blocks of other pieces by moving it left, right, or down, and by turning it. Once both players have placed their piece, the next piece will spawn. The next piece type that will spawn is always known to the bots beforehand.
When one row in the field is completely filled up with blocks of different pieces, it will be removed and all blocks above that row will move down. Points can be earned this way and with those points the field of your opponent is automatically filled up from the bottom with (removable) garbage lines. See section "The point system" for a more detailed explanation of how points are earned and when you send lines to your opponent. Moreover, every 15 rounds both bots automatically get one solid (non-removable) line on the bottom of their field. This is done so games must eventually end. When one of the bots' field is filled up to the point that a new piece will spawn in a non-empty cell or when a garbage line or solid line pushes blocks over the top-edge of the field, that bot loses the game. So it is important to keep your field as empty as possible, but at the same time to get as much points as you can to make it hard for your opponent.
There are 7 different pieces that can spawn each round. The piece that will spawn next is always indicated, and each type has an equal chance of being spawned next. On the right all different piece types are visible. From top-left to bottom-right they are called I, J, L, O, S, T and Z. The pieces are oriented in the way they will spawn. The grid indicates the matrix that contains the piece, and for piece rotations, this matrix is rotated. Rotations that result in the piece being inside a non-empty cell or outside the field are not possible, except at the top of the field.
Tip: If you want to implement rotations for your bot, create the same matrix for the piece and do a matrix transposition and then invert the columns or rows for a rotation to the right or left respectively.
The point system
As explained above, points can be earned by removing lines, and those points are used to send garbage lines to your opponent. These fill up the field from the bottom and move all other blocks up. Garbage lines will have either 1 hole or 2 holes, which will alternately spawn. The holes are placed randomly. Every 3 points your bot gets, 1 garbage line is sent to your opponent.
|Single line clear||0|
|Double line clear||3|
|Triple line clear||6|
|Quadruple line clear||10|
Now the amount of points that are earned will be explained. On the left there is an overview of all the different line-clears that are possible, with the amount of points that are rewarded for them. Clearing a single line is not worth any points, but removing more at the same time will result in points. Clearing the maximum of 4 lines at the same time will reward 10 points, which sends 3 garbage lines to the opponent immediately! Furthermore, there is a combo system which allows for more points to be earned when lines are removed in succession. The combo-counter goes up by 1 every time points are earned in succession and will be set to 0 again when no lines are removed in a round. So clearing one line will not increase the combo-counter, but it will also not reset it. The amount of extra points earned per round is equal to the combo-points before the piece is placed, but the points are only given if at least 1 line is cleared and the counter is not reset. So for example, in round 10 your bot removes 2 lines, which earn it 3 points and the combo-counter is set to 1. Then in round 11 it removes 2 lines again, which is also worth 3 points, but now the combo-counter is 2, and 1 additional point is awarded. If points are earned in round 12 as well, 2 additional points are rewarded, and so on.
Finally, there are two additional ways to score points, the first of which is achieving a perfect clear. This is simply clearing the whole field of blocks and rewards 18 points, which sends 6(!) garbage lines to the opponent, but is it actually pretty hard to achieve. Any additional points gotten during the perfect clear are not counted.
The other way to score additional points is using T-spins to clear lines. A T-spin is achieved by fitting a T piece in a hole that can only be reached by a rotation. Clearing one line with a T-spin is called a single T-spin, and clearing two lines is called a double T-spin. An example of a double T-spin is shown to the right. If the T piece would have rotated counter-clockwise once more, it would have been a single T-spin. T-spins are detected by checking if the last move was a turnleft or turnright, and 3 out of 4 corners of the T shape bounding box are occupied with blocks in the field. Turning the block and then turning it back to pass the above check does not work.
End of the game
There are only 2 ways the game can end: when a piece spawns in a non-empty cell or when a solid line pushes blocks over the top-edge of the playing field. When this happens to one of the bots, the other bot will win. When this happens to both bots at the same time, the game is a draw. Games will always end, because when the bots keep their fields empty, the point system will eventually fill up the whole field with solid lines.
Besides the normal shift and turn moves, there is one additional move: skip. Skips can only be used when your bot has at least one skip available, which can be earned by performing a quadruple clear or a double T-spin. By letting your bot output "skip" when a move is requested, the current piece will be removed from the field and the current move will be skipped. This can be used when you get a piece that will not fit nicely in your current field.
The timeout settings are the same as for our newer competitions. You get an initial maximally filled timebank of 10 seconds and each time a move is requested 500ms will be added to your timebank. The engine will give the amount of time left in your timebank each time it asks your bot for a move. If your bot does not respond before the timeout, no moves will be done and if it doesn't respond twice, your bot will be shut down. Bots that do not output anything at all, a.k.a. fail their input test, can not be placed in the ranked matches.
When uploading your bot, you can upload a
file. Make sure you either put the source files directly in the compressed folder, or in their respective class folders. So do not put a folder with the source files in the compressed folder, or your bot won't compile.
Game viewer hotkeys