2048: Difference between revisions
Content added Content deleted
m (update for newer Gtk versions) |
m (shown the rules in a bullet list, used indentation for examples, moved one rule to explain about adding '''2''' tiles. added whitespace, used a different fontsize for the example tiles being shown..) |
||
Line 6: | Line 6: | ||
Implement a 2D sliding block puzzle game where blocks with numbers are combined to add their values. |
Implement a 2D sliding block puzzle game where blocks with numbers are combined to add their values. |
||
The rules are that on each turn the player must choose a direction (up, down, left or right) and all tiles move as far as possible in that direction, some more than others. Two adjacent tiles (in that direction only) with matching numbers combine into one bearing the sum of those numbers. A move is valid when at least one tile can be moved, if only by combination. A new tile with the value of 2 is spawned at the end of each turn at a randomly chosen empty square, if there is one. To win, the player must create a tile with the number 2048. The player loses if no valid moves are possible. |
|||
;Rules of the game: |
|||
:* The rules are that on each turn the player must choose a direction (up, down, left or right). |
|||
:* All tiles move as far as possible in that direction, some more than others. |
|||
:* Two adjacent tiles (in that direction only) with matching numbers combine into one bearing the sum of those numbers. |
|||
:* A move is valid when at least one tile can be moved, if only by combination. |
|||
:* A new tile with the value of '''2''' is spawned at the end of each turn at a randomly chosen empty square (if there is one). |
|||
⚫ | |||
:* To win, the player must create a tile with the number '''2048'''. |
|||
:* The player loses if no valid moves are possible. |
|||
The name comes from the popular open-source implementation of this game mechanic, [https://gabrielecirulli.github.io/2048/ 2048]. |
The name comes from the popular open-source implementation of this game mechanic, [https://gabrielecirulli.github.io/2048/ 2048]. |
||
⚫ | |||
⚫ | |||
⚫ | |||
[2][2][2][2] |
|||
⚫ | |||
<big><big> [2][2][2][2] </big></big> |
|||
⚫ | |||
⚫ | |||
......[4][4] |
|||
<big><big> ......[4][4] </big></big> |
|||
⚫ | |||
⚫ | |||
.........[8] |
|||
<big><big> .........[8] </big></big> |
|||
⚫ | |||
⚫ | |||
...[2][2][2] |
|||
<big><big> ...[2][2][2] </big></big> |
|||
⚫ | |||
⚫ | |||
......[2][4] |
|||
<big><big> ......[2][4] </big></big> |
|||
⚫ | |||
⚫ | |||
......[4][2] |
|||
<big><big> ......[4][2] </big></big> |
|||
⚫ | |||
⚫ | |||
* Win condition. |
|||
* Lose condition. |
|||
⚫ | |||
* Check for a win condition. |
|||
* Check for a lose condition. |
|||
<br><br> |
<br><br> |
||
=={{header|AArch64 Assembly}}== |
=={{header|AArch64 Assembly}}== |
||
{{works with|as|Raspberry Pi 3B version Buster 64 bits}} |
{{works with|as|Raspberry Pi 3B version Buster 64 bits}} |