Using the `yetris` command (with examples)

Using the `yetris` command (with examples)

Tetris is a classic puzzle game that has been enjoyed by millions of players worldwide. While it is typically played on a computer or a gaming console, there is a fun and nostalgic way to play Tetris right in your terminal with the yetris command. In this article, we will explore the various use cases of the yetris command and provide code examples, motivations, explanations, and example outputs for each use case.

Starting a Tetris game

To start a Tetris game, simply execute the following command:

yetris

Motivation: Starting a Tetris game allows you to relax and have fun while challenging your puzzle-solving skills. It can be a great way to take a break from work or to spend some leisure time.

Explanation: The yetris command starts a clone of the game Tetris in the terminal. It launches a new game session with an initial grid and a random Tetrimino (a geometric shape used in Tetris) dropping from the top of the grid.

Example output:

[GAME START]
Score: 0
Lines cleared: 0

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┗━━━━━━━━━━━━┛

To move the dropping Tetrimino horizontally, you can use the Left and Right arrow keys:

LEFT ARROW | RIGHT ARROW

Motivation: Navigating the piece horizontally allows you to position it strategically within the grid, creating opportunities for clearing lines and accumulating points.

Explanation: The Left arrow key moves the Tetrimino one step to the left, while the Right arrow key moves it one step to the right. This allows you to control the horizontal placement of the Tetrimino within the grid.

Example output:

[GAME IN PROGRESS]
Score: 0
Lines cleared: 0

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┗━━━━━━━━━━━━┛
   Move: 1/3
   Next: ███   Hold: ███
   Score: 0   Lines cleared: 0

Rotating the piece clockwise or counterclockwise

To rotate the dropping Tetrimino clockwise or counterclockwise, you can use the x and z keys:

x | z

Motivation: Rotating the piece allows you to change its orientation, fitting it into tight spaces or creating better opportunities for line clears.

Explanation: The x key rotates the Tetrimino clockwise, while the z key rotates it counterclockwise. This allows you to adjust the orientation of the Tetrimino while it is dropping.

Example output:

[GAME IN PROGRESS]
Score: 0
Lines cleared: 0

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃       ███  ┃
   ┃       █    ┃
   ┃       █    ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┗━━━━━━━━━━━━┛
   Move: 1/3
   Next: ███   Hold: ███
   Score: 0   Lines cleared: 0

Holding a piece

To hold a piece for later use, you can use the c key:

c

Motivation: Holding a piece allows you to save it for strategic purposes, such as using it when the current Tetrimino does not fit well or when you want to delay its placement.

Explanation: The c key allows you to hold the current Tetrimino and replace it with a previously held one (if any). You can only hold one piece at a time, and swapping the held piece with the current piece becomes possible once per Tetrimino.

Example output:

[GAME IN PROGRESS]
Score: 0
Lines cleared: 0

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃       ███  ┃
   ┃       █    ┃
   ┃       █    ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┗━━━━━━━━━━━━┛
   Move: 1/3
   Next: ███   Hold: █
   Score: 0   Lines cleared: 0

Soft dropping the piece

To make the piece drop faster, you can use the Down arrow key:

DOWN ARROW

Motivation: Soft dropping the piece allows you to quickly bring it down the grid, making it easier to reach desired positions.

Explanation: The Down arrow key accelerates the dropping speed of the Tetrimino, causing it to move downward at a faster rate than usual. This can be beneficial for avoiding collision with other pieces or for quickly positioning the Tetrimino.

Example output:

[GAME IN PROGRESS]
Score: 0
Lines cleared: 0

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃      ███   ┃
   ┗━━━━━━━━━━━━┛
   Move: 1/3
   Next: ███   Hold: █
   Score: 0   Lines cleared: 0

Hard dropping the piece

To instantly drop the piece to the bottom of the grid, you can use the Spacebar:

SPACEBAR

Motivation: Hard dropping the piece allows you to quickly place it at the desired location without waiting for it to naturally drop. This can be useful when you need to clear lines efficiently or when you want to make quick progress in the game.

Explanation: The Spacebar causes the Tetrimino to instantly drop to the lowest possible position within the grid. This provides a shortcut to placing the Tetrimino without waiting for it to descend naturally.

Example output:

[GAME IN PROGRESS]
Score: 0
Lines cleared: 0

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┗━━━━━━━━━━━━┛
[GAME OVER]
Score: 300
Lines cleared: 6

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┗━━━━━━━━━━━━┛

Pausing/unpausing the game

To pause or unpause the game, you can use the p key:

p

Motivation: Pausing the game allows you to take a break or attend to other activities without losing your progress. Unpausing the game allows you to resume playing where you left off.

Explanation: The p key toggles the game between paused and unpaused states. When the game is paused, the Tetrimino stops dropping, and the game screen freezes. When the game is unpaused, the Tetrimino continues to drop, and the game screen updates accordingly.

Example output (pausing the game):

[GAME PAUSED]
Score: 0
Lines cleared: 0

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┗━━━━━━━━━━━━┛

Example output (unpausing the game):

[GAME UNPAUSED]
Score: 0
Lines cleared: 0

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┗━━━━━━━━━━━━┛

Quitting the game

To quit the game, you can use the q key:

q

Motivation: Quitting the game allows you to exit the current session and return to the terminal prompt.

Explanation: The q key ends the current game, and the terminal session returns to its normal state. This allows you to quit the game whenever you want, without losing progress or having to close the terminal window.

Example output:

[GAME QUIT]
Score: 0
Lines cleared: 0

   ┍━━━━━━━━━━━━┑
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┃            ┃
   ┗━━━━━━━━━━━━┛

Related Posts

How to use the command unsquashfs (with examples)

How to use the command unsquashfs (with examples)

Unsquashfs is a command-line tool used to uncompress, extract, and list files in squashfs filesystems.

Read More
How to use the command ppmrelief (with examples)

How to use the command ppmrelief (with examples)

PPMrelief is a command that allows users to produce a relief of a PPM image.

Read More
How to use the command choco info (with examples)

How to use the command choco info (with examples)

This command allows users to display detailed information about a package with Chocolatey, a package manager for Windows.

Read More