diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2022-10-01 09:04:50 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2022-10-01 09:04:50 +0200 |
| commit | b473f7ce3895eccaf7691f6fc9296cb3c695a189 (patch) | |
| tree | ee26300cebed966fab631ebc2549b0d58a68f8d2 /src/blog | |
| parent | 152a9ea1ee5f12cae69448a4971adaa1b2fbcc17 (diff) | |
| download | sebastiano.tronto.net-b473f7ce3895eccaf7691f6fc9296cb3c695a189.tar.gz sebastiano.tronto.net-b473f7ce3895eccaf7691f6fc9296cb3c695a189.zip | |
Added blog post
Diffstat (limited to 'src/blog')
| -rw-r--r-- | src/blog/2022-10-01-tetris/tetris.md | 147 | ||||
| -rw-r--r-- | src/blog/blog.md | 1 | ||||
| -rw-r--r-- | src/blog/feed.xml | 7 |
3 files changed, 155 insertions, 0 deletions
diff --git a/src/blog/2022-10-01-tetris/tetris.md b/src/blog/2022-10-01-tetris/tetris.md new file mode 100644 index 0000000..de21b05 --- /dev/null +++ b/src/blog/2022-10-01-tetris/tetris.md | |||
| @@ -0,0 +1,147 @@ | |||
| 1 | # The man page reading club: tetris(6) | ||
| 2 | |||
| 3 | Sometimes you just need to relax and have some fun :-) | ||
| 4 | |||
| 5 | ## Boredom | ||
| 6 | |||
| 7 | *"Phew, that was a long read!" you think as you reach the end of the | ||
| 8 | `sh(1)` manual page. After such an intense brain-workout you would | ||
| 9 | normally have a nice walk outside - but the Geiger counter on the wall | ||
| 10 | tells you that this might not be a good idea in this timeline. Your second | ||
| 11 | choice would be to have a beer and listen to some good music or watch a | ||
| 12 | movie, but none of these options is available in the bunker. It's almost | ||
| 13 | as if the nuclear winter is... bad?* | ||
| 14 | |||
| 15 | *You try to think what else you can do to ease your boredom. | ||
| 16 | There's no internet, no books, no videogames... wait a minute!* | ||
| 17 | |||
| 18 | ``` | ||
| 19 | $ man man | ||
| 20 | ``` | ||
| 21 | |||
| 22 | *You scroll down until you see the list of available sections, and | ||
| 23 | you find the one you were looking for:* | ||
| 24 | |||
| 25 | ``` | ||
| 26 | 6 Games. | ||
| 27 | ``` | ||
| 28 | |||
| 29 | *Yes! You thought you saw this | ||
| 30 | [some time ago](https://sebastiano.tronto.net/blog/2022-05-29-man), | ||
| 31 | but you had ignored it. You also remember that the `intro(1)` page | ||
| 32 | mentioned analogous intoductory pages for each section. So you type:* | ||
| 33 | |||
| 34 | ``` | ||
| 35 | $ man 6 intro | ||
| 36 | ``` | ||
| 37 | |||
| 38 | *And so you discover that the folder `/usr/games` contains dozens of | ||
| 39 | games and other fun little programs. These are already installed in your | ||
| 40 | system, no need to download files or insert CD roms.* | ||
| 41 | |||
| 42 | *There is so much choice, so many games you have never heard of. But for | ||
| 43 | this time you decide to go with a classic.* | ||
| 44 | |||
| 45 | ## tetris(6) | ||
| 46 | |||
| 47 | *Follow along at [man.openbsd.org](https://man.openbsd.org/OpenBSD-7.1/tetris)* | ||
| 48 | |||
| 49 | Before starting the game it is better to learn the rules, so let's type | ||
| 50 | `man tetris` first! | ||
| 51 | |||
| 52 | ``` | ||
| 53 | DESCRIPTION | ||
| 54 | The tetris command runs a display-based game. The object is to fit | ||
| 55 | shapes together to form complete rows, which then vanish. When the | ||
| 56 | shapes fill up to the top, the game ends. | ||
| 57 | ``` | ||
| 58 | |||
| 59 | The default control keys are listed below: | ||
| 60 | |||
| 61 | ``` | ||
| 62 | j move left | ||
| 63 | k rotate 1/4 turn counterclockwise | ||
| 64 | l move right | ||
| 65 | <space> drop | ||
| 66 | p pause | ||
| 67 | q quit | ||
| 68 | ``` | ||
| 69 | |||
| 70 | Some of the options are quite straightforward: `-c` to play in "classic | ||
| 71 | mode", with a slightly different graphics and shapes that turn clockwise; | ||
| 72 | `-l` to specify a level; `-p` to show the next shape that will drop, in | ||
| 73 | exchange for a lower score; `-s` to print the highscores and exit. The | ||
| 74 | most interesting is `-k`: | ||
| 75 | |||
| 76 | ``` | ||
| 77 | -k keys | ||
| 78 | The default control keys can be changed using the -k option. The | ||
| 79 | keys argument must have the six keys in order; remember to quote | ||
| 80 | any space or tab characters from the shell. | ||
| 81 | ``` | ||
| 82 | |||
| 83 | The sections PLAY and SCORING explain the gameplay and the criteria for | ||
| 84 | assigning points. There is also an ENVIRONMENT section with a single line: | ||
| 85 | |||
| 86 | ``` | ||
| 87 | LOGNAME Name displayed in high score file. | ||
| 88 | ``` | ||
| 89 | |||
| 90 | This means that you can set that shell variable to have your score | ||
| 91 | saved in the `$HOME/.tetris.score` file under a different name - | ||
| 92 | this can be useful for example when lending your pc to someone else | ||
| 93 | to let them play. | ||
| 94 | |||
| 95 | ## Having fun | ||
| 96 | |||
| 97 | *"Enough of this reading, let's just play!"* | ||
| 98 | |||
| 99 | *You decide to remap the keys to play with your left hand, and to use the | ||
| 100 | old nick name you used on online forums, when the internet still existed. | ||
| 101 | And why not trying the "classic" mode as well?* | ||
| 102 | |||
| 103 | ``` | ||
| 104 | $ LOGNAME=porkynator tetris -c -k 'asd pq' | ||
| 105 | ``` | ||
| 106 | |||
| 107 | *And you start playing the night away* | ||
| 108 | |||
| 109 | ``` | ||
| 110 | Score: 47 [] [] | ||
| 111 | [] [] | ||
| 112 | [] [] | ||
| 113 | [] [] [] | ||
| 114 | [] [][] [] | ||
| 115 | [] [] [] | ||
| 116 | [] [] | ||
| 117 | [] [] | ||
| 118 | [] [] | ||
| 119 | [] [] | ||
| 120 | [] [] | ||
| 121 | [] [] | ||
| 122 | [] [] | ||
| 123 | [] [] | ||
| 124 | [] [] | ||
| 125 | [] [] | ||
| 126 | [] [][] | ||
| 127 | [][][] [][] | ||
| 128 | [][][][] [][] | ||
| 129 | [][][][] [][] | ||
| 130 | [][][][][][][][][][][][] | ||
| 131 | |||
| 132 | a - left s - rotate d - right <space> - drop p - pause q - quit | ||
| 133 | ``` | ||
| 134 | |||
| 135 | ## Conclusions | ||
| 136 | |||
| 137 | This was a short and unimportant post meant to cool down after last month's | ||
| 138 | double post on the shell. I'll take it as an excuse to mention that `/usr/games` | ||
| 139 | [won't be in the default `$PATH`](https://undeadly.org/cgi?action=article;sid=20220810120423) | ||
| 140 | starting from OpenBSD 7.2. If you want to have a fun tetris session, | ||
| 141 | in the future you might have to specify the full path | ||
| 142 | |||
| 143 | ``` | ||
| 144 | $ /usr/games/tetris | ||
| 145 | ``` | ||
| 146 | |||
| 147 | or just update your `$PATH`. | ||
diff --git a/src/blog/blog.md b/src/blog/blog.md index a1227f7..8399626 100644 --- a/src/blog/blog.md +++ b/src/blog/blog.md | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | [RSS Feed](feed.xml) | 3 | [RSS Feed](feed.xml) |
| 4 | 4 | ||
| 5 | * 2022-10-01 [The man page reading club: tetris(6)](2022-10-01-tetris) | ||
| 5 | * 2022-09-20 [The man page reading club: sh(1) - part 2: commands and builtins](2022-09-20-sh-2) | 6 | * 2022-09-20 [The man page reading club: sh(1) - part 2: commands and builtins](2022-09-20-sh-2) |
| 6 | * 2022-09-13 [The man page reading club: sh(1) - part 1: shell grammar](2022-09-13-sh-1) | 7 | * 2022-09-13 [The man page reading club: sh(1) - part 1: shell grammar](2022-09-13-sh-1) |
| 7 | * 2022-09-10 [Long live netbooks!](2022-09-10-netbooks) | 8 | * 2022-09-10 [Long live netbooks!](2022-09-10-netbooks) |
diff --git a/src/blog/feed.xml b/src/blog/feed.xml index d8e7876..1cf4313 100644 --- a/src/blog/feed.xml +++ b/src/blog/feed.xml | |||
| @@ -9,6 +9,13 @@ Thoughts about software, computers and whatever I feel like sharing | |||
| 9 | </description> | 9 | </description> |
| 10 | 10 | ||
| 11 | <item> | 11 | <item> |
| 12 | <title>The man page reading club: tetris(6)</title> | ||
| 13 | <link>https://sebastiano.tronto.net/blog/2022-10-01-tetris</link> | ||
| 14 | <description>The man page reading club: tetris(6)</description> | ||
| 15 | <pubDate>2022-10-01</pubDate> | ||
| 16 | </item> | ||
| 17 | |||
| 18 | <item> | ||
| 12 | <title>The man page reading club: sh(1) - part 2: commands and builtins</title> | 19 | <title>The man page reading club: sh(1) - part 2: commands and builtins</title> |
| 13 | <link>https://sebastiano.tronto.net/blog/2022-09-20-sh-2</link> | 20 | <link>https://sebastiano.tronto.net/blog/2022-09-20-sh-2</link> |
| 14 | <description>The man page reading club: sh(1) - part 2: commands and builtins</description> | 21 | <description>The man page reading club: sh(1) - part 2: commands and builtins</description> |
