Merge pull request #17503 from lujun9972/translate-MjAxNzA5MTggRnVuIGFuZCBHYW1lcyBpbiBFbWFjcy5tZAo=

translate done: 20170918 Fun and Games in Emacs.md
This commit is contained in:
Xingyu.Wang 2020-02-23 10:13:49 +08:00 committed by GitHub
commit 9b8e4a1ca3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 243 additions and 234 deletions

View File

@ -1,234 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (lujun9972)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Fun and Games in Emacs)
[#]: via: (https://www.masteringemacs.org/article/fun-games-in-emacs)
[#]: author: (Mickey Petersen https://www.masteringemacs.org/about)
Fun and Games in Emacs
======
Its yet another Monday and youre hard at work on those [TPS reports][1] for your boss, Lumbergh. Why not play Emacss Zork-like text adventure game to take your mind off the tedium of work?
But seriously, yes, there are both games and quirky playthings in Emacs. Some you have probably heard of or played before. The only thing they have in common is that most of them were added a long time ago: some are rather odd inclusions (as youll see below) and others were clearly written by bored employees or graduate students. What they all have in common is a whimsy and a casualness that I rarely see in Emacs today. Emacs is Serious Business now in a way that it probably wasnt back in the 1980s when some of these games were written.
### Tower of Hanoi
The [Tower of Hanoi][2] is an ancient mathematical puzzle game and one that is probably familiar to some of us as it is often used in Computer Science as a teaching aid because of its recursive and iterative solutions.
![Tower of Hanoi Screenshot](https://www.masteringemacs.org/static/uploads/hanoi.png)
In Emacs there are three commands you can run to trigger the Tower of Hanoi puzzle: M-x hanoi with a default of 3 discs; M-x hanoi-unix and M-x hanoi-unix-64 uses the unix timestamp, making a move each second in line with the clock, and with the latter pretending it uses a 64-bit clock.
The Tower of Hanoi implementation in Emacs dates from the mid 1980s — an awful long time ago indeed. There are a few Customize options (M-x customize-group RET hanoi RET) such as enabling colorized discs. And when you exit the Hanoi buffer or type a character you are treated to a sarcastic goodbye message (see above.)
### 5x5
![5x5 game grid](https://www.masteringemacs.org/static/uploads/5x5.png)
The 5x5 game is a logic puzzle: you are given a 5x5 grid with a central cross already filled-in; your goal is to fill all the cells by toggling them on and off in the right order to win. Its not as easy as it sounds!
To play, type M-x 5x5, and with an optional digit argument you can change the size of the grid. What makes this game interesting is its rather complex ability to suggest the next move and attempt to solve the game grid. It uses Emacss very own, and very cool, symbolic RPN calculator M-x calc (and in [Fun with Emacs Calc][3] I use it to solve a simple problem.)
So what I like about this game is that it comes with a very complex solver really, you should read the source code with M-x find-library RET 5x5 and a “cracker” that attempts to brute force solutions to the game.
Try creating a bigger game grid, such as M-10 M-x 5x5, and then run one of the crack commands below. The crackers will attempt to iterate their way to the best solution. This runs in real time and is fun to watch:
`M-x 5x5-crack-mutating-best`
Attempt to crack 5x5 by mutating the best solution.
`M-x 5x5-crack-mutating-current`
Attempt to crack 5x5 by mutating the current solution.
`M-x 5x5-crack-randomly`
Attempt to crack 5x5 using random solutions.
`M-x 5x5-crack-xor-mutate`
Attempt to crack 5x5 by xoring the current and best solution.
### Text Animation
You can display a fancy birthday present animation by running M-x animate-birthday-present and giving it your name. It looks rather cool!
![xkcd](https://imgs.xkcd.com/comics/real_programmers.png)
The animate package is also used by M-x butterfly command, a command added to Emacs as an homage to the [XKCD][4] strip above. Of course the Emacs command in the strip is teeechnically not valid but the humor more than makes up for it.
### Blackbox
The objective of this game I am going to quote literally:
> The object of the game is to find four hidden balls by shooting rays into the black box. There are four possibilities: 1) the ray will pass thru the box undisturbed, 2) it will hit a ball and be absorbed, 3) it will be deflected and exit the box, or 4) be deflected immediately, not even being allowed entry into the box.
So, its a bit like the [Battleship][5] most of us played as kids but… for people with advanced degrees in physics?
Its another game that was added back in the 1980s. I suggest you read the extensive documentation on how to play by typing C-h f blackbox.
### Bubbles
![Bubbles game](https://www.masteringemacs.org/static/uploads/bubbles.png)
The M-x bubbles game is rather simple: you must clear out as many “bubbles” as you can in as few moves as possible. When you remove bubbles the other bubbles drop and stick together. Its a fun game that, as an added bonus, comes with graphics if you use Emacss GUI. It also works with your mouse.
You can configure the difficulty of the game by calling M-x bubbles-set-game- where is one of: easy, medium, difficult, hard, or userdefined. Furthermore, you can alter the graphics, grid size and colors using Customize: M-x customize-group bubbles.
For its simplicity and fun factor, this ranks as one of my favorite games in Emacs.
### Fortune & Cookie
I like the fortune command. Snarky, unhelpful and often sarcastic “advice” mixed in with literature and riddles brightens up my day whenever I launch a new shell.
Rather confusingly there are two packages in Emacs that does more-or-less the same thing: fortune and cookie1. The former is geared towards putting fortune cookie messages in email signatures and the latter is just a simple reader for the fortune format.
Anyway, to use Emacss cookie1 package you must first tell it where to find the file by customizing the variable cookie-file with customize-option RET cookie RET.
If youre on Ubuntu you will have to install the fortune package first. The files are found in the /usr/share/games/fortunes/ directory.
You can then call M-x cookie or, should you want to do this, find all matching cookies with M-x cookie-apropos.
### Decipher
This package perfectly captures the utilitarian nature of Emacs: its a package to help you break simple substitution ciphers (like cryptogram puzzles) using a helpful user interface. You just know that more than twenty years ago someone really had a dire need to break a lot of basic ciphers. Its little things like this module that makes me overjoyed to use Emacs: a module of scant importance to all but a few people and, yet, should you need it there it is.
So how do you use it then? Well, lets consider the “rot13” cipher: rotating characters by 13 places in a 26-character alphabet. Its an easy thing to try out in Emacs with M-x ielm, Emacss REPL for [Evaluating Elisp][6]:
```
*** Welcome to IELM *** Type (describe-mode) for help.
ELISP> (rot13 "Hello, World")
"Uryyb, Jbeyq"
ELISP> (rot13 "Uryyb, Jbeyq")
"Hello, World"
ELISP>
```
So how can the decipher module help us here? Well, create a new buffer test-cipher and type in your cipher text (in my case Uryyb, Jbeyq)
![cipher](https://www.masteringemacs.org/static/uploads/cipher.png)
Youre now presented with a rather complex interface. You can now place the point on any of the characters in the ciphertext on the purple line and guess what the character might be: Emacs will update the rest of the plaintext guess with your choices and tell you how the characters in the alphabet have been allocated thus far.
You can then start winnowing down the options using various helper commands to help infer which cipher characters might correspond to which plaintext character:
`D`
Shows a list of digrams (two-character combinations from the cipher) and their frequency
`F`
Shows the frequency of each ciphertext letter
`N`
Shows adjacency of characters. I am not entirely sure how this works.
`M` and `R`
Save and restore a checkpoint, allowing you to branch your work and explore different ways of cracking the cipher.
All in all, for such an esoteric task, this package is rather impressive! If you regularly solve cryptograms maybe this package can help?
### Doctor
![doctor](https://www.masteringemacs.org/static/uploads/doctor.png)
Ah, the Emacs doctor. Based on the original [ELIZA][7] the “Doctor” tries to psychoanalyze what you say and attempts to repeat the question back to you. Rather fun, for a few minutes, and one of the more famous Emacs oddities. You can run it with M-x doctor.
### Dunnet
Emacss very own Zork-like text adventure game. To play it, type M-x dunnet. Its rather good, if short, but its another rather famous Emacs game that too few have actually played through to the end.
If you find yourself with time to kill between your TPS reports then its a great game with a built-in “boss screen” as its text-only.
Oh, and, dont try to eat the CPU card :)
### Gomoku
![gomoku](https://www.masteringemacs.org/static/uploads/gomoku.png)
Another game written in the 1980s. You have to connect 5 squares, tic-tac-toe style. You can play against Emacs with M-x gomoku. The game also supports the mouse, which is rather handy. You can customize the group gomoku to adjust the size of the grid.
### Game of Life
[Conways Game of Life][8] is a famous example of cellular automata. The Emacs version comes with a handful of starting patterns that you can (programmatically with elisp) alter by adjusting the life-patterns variable.
You can trigger a game of life with M-x life. The fact that the whole thing, display code, comments and all, come in at less than 300 characters is also rather impressive.
### Pong, Snake and Tetris
![tetris](https://www.masteringemacs.org/static/uploads/tetris.png)
These classic games are all implemented using the Emacs package gamegrid, a generic framework for building grid-based games like Tetris and Snake. The great thing about the gamegrid package is its compatibility with both graphical and terminal Emacs: if you run Emacs in a GUI you get fancy graphics; if you dont, you get simple ASCII art.
You can run the games by typing M-x pong, M-x snake, or M-x tetris.
The Tetris game in particular is rather faithfully implemented, having both gradual speed increase and the ability to slide blocks into place. And given you have the code to it, you can finally remove that annoying Z-shaped piece no one likes!
### Solitaire
![solitaire image](https://www.masteringemacs.org/static/uploads/solitaire.png)
This is not the card game, unfortunately. But a peg-based game where you have to end up with just one stone on the board, by taking a stone (the o) and “jumping” over an adjacent stone into the hole (the .), removing the stone you jumped over in the process. Rinse and repeat until the board is empty.
There is a handy solver built in called M-x solitaire-solve if you get stuck.
### Zone
Another of my favorites. This times its a screensaver or rather, a series of screensavers.
Type M-x zone and watch what happens to your screen!
You can configure a screensaver idle time by running M-x zone-when-idle (or calling it from elisp) with an idle time in seconds. You can turn it off with M-x zone-leave-me-alone.
This ones guaranteed to make your coworkers freak out if it kicks off while they are looking.
### Multiplication Puzzle
![mpuz](https://www.masteringemacs.org/static/uploads/mpuz.png)
This is another brain-twisting puzzle game. When you run M-x mpuz you are given a multiplication puzzle where you have to replace the letters with numbers and ensure the numbers add (multiply?) up.
You can run M-x mpuz-show-solution to solve the puzzle if you get stuck.
### Miscellaneous
There are more, but theyre not the most useful or interesting:
* You can translate a region into morse code with M-x morse-region and M-x unmorse-region.
* The Dissociated Press is a very simple command that applies something like a random walk markov-chain generator to a body of text in a buffer and generates nonsensical text from the source body. Try it with M-x dissociated-press.
* The Gamegrid package is a generic framework for building grid-based games. So far only Tetris, Pong and Snake use it. Its called gamegrid.
* The gametree package is a complex way of notating and tracking chess games played via email.
* The M-x spook command inserts random words (usually into emails) designed to confuse/overload the “NSA trunk trawler” and keep in mind this module dates from the 1980s and 1990s with various words the spooks are supposedly listening for. Of course, even ten years ago that wouldve seemed awfully paranoid and quaint but not so much any more…
### Conclusion
I love the games and playthings that ship with Emacs. A lot of them date from, well, lets just call a different era: an era where whimsy was allowed or perhaps even encouraged. Some are known classics (like Tetris and Tower of Hanoi) and some of the others are fun variations on classics (like blackbox) — and yet I love that they ship with Emacs after all these years. I wonder if any of these would make it into Emacss codebase today; well, they probably wouldnt — theyd be relegated to the package manager where, in a clean and sterile world, they no doubt belong.
Theres a mandate in Emacs to move things not essential to the Emacs experience to ELPA, the package manager. I mean, as a developer myself, that does make sense, but… surely for every package removed and exiled to ELPA we chip away the essence of what defines Emacs?
--------------------------------------------------------------------------------
via: https://www.masteringemacs.org/article/fun-games-in-emacs
作者:[Mickey Petersen][a]
选题:[lujun9972][b]
译者:[lujun9972](https://github.com/lujun9972)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.masteringemacs.org/about
[b]:https://github.com/lujun9972
[1]:https://en.wikipedia.org/wiki/Office_Space
[2]:https://en.wikipedia.org/wiki/Tower_of_Hanoi
[3]:https://www.masteringemacs.org/article/fun-emacs-calc
[4]:http://www.xkcd.com
[5]:https://en.wikipedia.org/wiki/Battleship_(game)
[6]:https://www.masteringemacs.org/article/evaluating-elisp-emacs
[7]:https://en.wikipedia.org/wiki/ELIZA
[8]:https://en.wikipedia.org/wiki/Conway's_Game_of_Life

View File

@ -0,0 +1,243 @@
[#]: collector: (lujun9972)
[#]: translator: (lujun9972)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Fun and Games in Emacs)
[#]: via: (https://www.masteringemacs.org/article/fun-games-in-emacs)
[#]: author: (Mickey Petersen https://www.masteringemacs.org/about)
Emacs 中的游戏与乐趣
======
又是周一,你正在为你的老板 Lumbergh 努力倒腾那些 [无聊之极的文档 ][1]。为什么不玩玩 Emacs 中类似 zork 的文本冒险游戏来让你的大脑从单调的工作中解脱出来呢?
但说真的Emacs 中既有游戏,也有古怪的玩物。有些你可能有所耳闻。这些玩意唯一的共同点就是,它们大多是很久以前就添加到 Emacs 中的:有些东西真的是相当古怪(如您将在下面看到的),而另一些则显然是由无聊的员工或毕业生编写的。
它们中都带着一种奇思妙想和随意性,这在今天的 Emacs 中很少见。
Emacs 现在变得十分严肃,在某种程度上,它已经与 20 世纪 80 年代那些玩意被编写出来的时候大不一样。
### 汉诺塔
[汉诺塔 ][2] 是一款古老的数学解密游戏,有些人可能对它很熟悉,因为它的递归和迭代解决方案经常被用与计算机科学教学辅助。
![Tower of Hanoi Screenshot](https://www.masteringemacs.org/static/uploads/hanoi.png)
Emacs 中有三个命令可以运行汉诺塔:`M-x hanoi` 默认为 3 个碟子; `M-x hanoi-unix``M-x hanoi-unix-64` 使用 unix 时间戳的位数 (32bit 或 64bit) 作为默认盘子的个数,并且每秒钟自动移动一次,两者不同之处在于后者假装使用 64 位时钟(因此有 64 个碟子)。
Emacs 中汉诺塔的实现可以追溯到 20 世纪 80 年代中期——确实是久得可怕。它有一些自定义选项 (`M-x customize-group RET hanoi RET`),如启用彩色光盘等。
当你离开汉诺塔缓冲区或输入一个字符,你会收到一个讽刺的告别信息(见上文)。
### 5x5
![5x5 game grid](https://www.masteringemacs.org/static/uploads/5x5.png)
5x5 的游戏是一个逻辑解密游戏:你有一个 5x5 的网格,中间的十字被填满;你的目标是通过按正确的顺序切换它们的空满状态来填充所有的单元格,从而获得胜利。这并不像听起来那么容易!
输入 `M-x 5x5` 就可以开始玩了,使用可选的数字参数可以改变网格的大小。
这款游戏的有趣之处在于它能向你建议下一步行动并尝试解决该游戏网格。它用到了了 Emacs 自己的一款非常酷的符号 RPN 计算器 `M-x calc` (在 [Fun with Emacs Calc][3] 这篇文章中,我使用它来解决了一个简单的问题。)
所以我喜欢这个游戏的原因是它提供了一个非常复杂的解决器——真的,你应该通过 `M-x find-library RET 5x5` 来阅读其源代码——和一个试图通过强力破解游戏的“破解器”。
创建一个更大的游戏网格,例如输入 `M-10 M-x 5x5`,然后运行下面某个 `crack` 命令。破坏者将尝试通过迭代获得最佳解决方案。它会实时运行该游戏,观看起来非常有趣:
- `M-x 5x5-crack-mutating-best`: 试图通过修改最佳解决方案来破解 5x5。
- `M-x 5x5-crack-mutating-current`: 试图通过修改当前解决方案来破解 5x5。
- `M-x 5x5-crack-random`: 尝试使用随机方案解破解 5x5。
- `M-x 5x5-crack-xor-mutate`: 尝试通过将当前方案和最佳方案进行异或运算来破解 5x5。
### 文本动画
您可以通过运行 `M-x animation-birthday-present` 并给出名字来显示一个奇特的生日礼物动画。它看起来很酷!
![xkcd](https://imgs.xkcd.com/comics/real_programmers.png)
`M-x butterfly` 命令中也使用了 `animate`butterfly 命令被添加到 Emacs 中,以向上面的 [XKCD][4] 漫画致敬。当然,漫画中的 Emacs 命令在技术上是无效的,但它的幽默足以弥补这一点。
### 黑箱
我将逐字引用这款游戏的目标:
> 游戏的目标是通过向黑盒子发射光线来找到四个隐藏的球。有四种可能:
> 1) 射线将通过盒子不受干扰,
> 2) 它将击中一个球并被吸收,
> 3) 它将偏转并退出盒子,或
> 4) 立即偏转,甚至不被允许进入盒子。
所以,这有点像我们小时候玩的 [Battleship][5],但是……是专为物理专业高学历的人准备的?
这是另一款添加于 20 世纪 80 年代的游戏。我建议你输入 `C-h f blackbox` 来阅读玩法说明(文档巨大)。
### 泡泡
![Bubbles game](https://www.masteringemacs.org/static/uploads/bubbles.png)
`M-x bubble` 游戏相当简单:你必须用尽可能少移动清除尽可能多的“泡泡”。当你移除气泡时,其他气泡会掉落并粘在一起。
这是一款有趣的游戏,此外如果你使用 Emacs 的图形用户界面,它还支持图像现实。而且它还支持鼠标。
您可以通过调用 `M-x bubbles-set-game-< 难度>` 来设置难度,其中嗯 `<难度>` 可以是其中之一:`easy``medium==difficult``hard`,或 `userdefined`
此外,您可以使用:`M-x custom-group bubbles` 来更改图形、网格大小和颜色。
由于它即简单又有趣,这是 Emacs 中我最喜欢的游戏之一。
### 幸运饼干
我喜欢 `fortune` 命令。每当我启动一个新 shell 时,就会有刻薄、无益、常常带有讽刺意味的“建议(以及文学摘要,谜语)”就会点亮我的一天。
令人困惑的是Emacs 中有两个包做了类似的事情:`fortune` 和 `cookie`。前者主要用于在电子邮件签名中添加幸运饼干消息,而后者只是一个简单的 fortune 格式阅读器。
不管怎样,使用 Emacs 的 `cookie` 包前,你首先需要通过 `customize-option RET cookie RET` 来自定义变量 `cookie-file` 告诉它从哪找到 fortune 文件。
如果你的操作系统是 Ubuntu那么你先安装 `fortune` 软件包,然后就能在 `/usr/share/games/fortune/` 目录中找到这些文件了。
之后你就可以调用 `M-x cookie` 随机显示 fortune 内容,或者,如果你想的话,也可以调用 `M-x cookie-apropos` 查找所有匹配的 cookie。
### Decipher
这个包完美地抓住了 Emacs 的实用本质:这个包为你破解简单的替换密码(如密码谜题)提供了一个很有用的界面。
你知道,二十多年前,某人确实迫切需要破解很多基础密码。正是像这个模块这样的小玩意让我非常高兴地用起 Emacs 来:这个模块只对少数人有用,但是,如果你突然需要它了,那么它就在那里等着你。
那么如何使用它呢?让我们假设使用 “rot13” 密码:在 26 个字符的字母表中,将字符旋转 13 个位置。
通过 `M-x ielm` (Emacs 用于 [运行 Elisp][6] 的 REPL 环境)可以很容易在 Emacs 中进行尝试:
```
*** Welcome to IELM *** Type (describe-mode) for help.
ELISP> (rot13 "Hello, World")
"Uryyb, Jbeyq"
ELISP> (rot13 "Uryyb, Jbeyq")
"Hello, World"
ELISP>
```
那么decipher 模块又是如何帮助我们的呢?让我们创建一个新的缓冲区 `test-cipher` 并输入您的密码文本(在我的例子中是 `UryybJbeyq`)
![cipher](https://www.masteringemacs.org/static/uploads/cipher.png)
您现在面对的是一个相当复杂的接口。现在把光标放在紫行秘文中的任意字符上猜猜这个字符可能是什么Emacs 将根据你的选择更新其他明文的猜测结果,并告诉你字母表中的字符是如何分配的。
您现在可以下面各种 helper 命令来帮助推断密码字符可能对应的明文字符:
- **`D`:** 显示数字符号(密码中两个字符组合)及其频率的列表
- **`F`:** 表示每个密文字母的频率
- **`N`:** 显示字符的邻接信息。我不确定这是干啥的。
- **`M``R`:** 保存和恢复一个检查点,允许你对工作进行分支以探索破解密码的不同方法。
总而言之,对于这样一个深奥的任务,这个包是相当令人印象深刻的!如果你经常破解密码,也许这个程序包能帮上忙?
### 医生
![doctor](https://www.masteringemacs.org/static/uploads/doctor.png)
Emacs 医生。其基于最初的 [ELIZA][7],“ 医生”试图对你说的话进行心理分析,并试图把问题复述给你。体验它的那几分钟相当有趣,它也是 Emacs 中最著名的古怪玩意之一。你可以使用 `M-x doctor` 来运行它。
### Dunnet
Emacs 自己特有的类 Zork 文本冒险游戏。输入 `M-x dunnet` 就能玩了。
这是一款相当不错的游戏,虽然时间不长,但非常著名,很少有人真正玩到最后。
如果你发现自己能在无聊的文档工作之间空出时间来,那么这是一个超级棒的游戏,内置“老板屏幕”,因为它是纯文本的。
哦,还有,不要吃掉那块 CPU 卡 :)
### 五子棋
![gomoku](https://www.masteringemacs.org/static/uploads/gomoku.png)
另一款写于 20 世纪 80 年代的游戏。你必须连接 5 个方块,井字游戏风格。你可以运行 `M-x gomoku` 来与 Emacs 对抗。游戏还支持鼠标,非常方便。您也可以自定义 `gomoku` 组来调整网格的大小。
### 生命游戏
[Conway 的生命游戏 ][8] 是细胞自动机的一个著名例子。Emacs 版本提供了一些启动模式,你可以(通过 elisp 编程)通过调整 `life-patterns` 变量来更改这些模式。
你可以用 `M-x life` 触发生命游戏。事实上,所有的东西,包括代码,注释和所有的东西,总共不到 300 行,这也让人印象深刻。
### 乒乓,贪吃蛇和俄罗斯方块
![tetris](https://www.masteringemacs.org/static/uploads/tetris.png)
这些经典游戏都是使用 Emacs 包 `gamegrid` 实现的,这是一个用于构建网格游戏(如俄罗斯方块和贪吃蛇)的通用框架。gamegrid 包的伟大之处在于它同时兼容图形化和终端 Emacs: 如果你在 GUI 中运行 Emacs你会得到精美的图形;如果你没有,你得到简单的 ASCII 艺术。
你可以通过输入 `M-x pong``M-x snake``M-x tetris` 来运行这些游戏。
特别是俄罗斯方块游戏实现的非常到位,会逐渐增加速度并且能够滑块。而且既然你已经有了源代码,你完全可以移除那个讨厌的 Z 形块,没人喜欢它!
### Solitaire
![solitaire image](https://www.masteringemacs.org/static/uploads/solitaire.png)
可惜,这不是纸牌游戏,而是一个基于 peg 的游戏,你可以选择一块石头 (`o`) 并“跳过”相邻的石头进入洞中(`。`),并在这个过程中去掉你跳过的那些石头,最终只能在棋盘上留下一块石头,
重复该过程直到板子被请空(只保留一个石头)。
如果你卡住了,有一个内置的解题器名为 `M-x solitire-solve`
### Zone
我的另一个最爱。这是一个屏幕保护程序——或者更确切地说,是一系列的屏幕保护程序。
输入 `M-x zone`,然后看看屏幕上发生了什么!
您可以通过运行 `M-x zone-when-idle` (或从 elisp 调用它)来配置屏幕保护程序的空闲时间,时间以秒为单位。
您也可以通过 `M-x zone-leave-me-alone` 来关闭它。
如果它在你的同事看着的时候被启动,你的同事肯定会抓狂的。
### 乘法解谜
![mpuz](https://www.masteringemacs.org/static/uploads/mpuz.png)
这是另一个脑筋急转弯的益智游戏。当您运行 `M-x mpuz` 时,将看到一个乘法解谜题,你必须将字母替换为对应的数字,并确保数字相加(相乘?)符合结果
如果遇到难题,可以运行 `M-x mpuz-show-solution` 来解决。
### 杂项
还有更多好玩的东西,但它们就不如刚才那些那么好玩好用了:
- 你可以通过 `M-x morse-region``M-x unmorse-region` 将一个区域翻译成莫尔斯电码。
- Dissociated Press 是一个非常简单的命令,它将类似随机游动 markov 链生成器应用到 buffer 中的文本中,并以此生成无意义的文本。试一下 `M-x dissociated-press`
- Gamegrid 包是构建网格游戏的通用框架。到目前为止,只有俄罗斯方块,乒乓和贪吃蛇使用了它。其名为 `gamegrid`
- `gametree` 软件包是一个通过电子邮件记录和跟踪国际象棋游戏的复杂方法。
- `M-x spook` 命令插入随机单词(通常是在电子邮件中),目的是混淆/超载 “NSA trukn trawler”—— 记住,这个模块可以追溯到 20 世纪 80 年代和 90 年代——那时应该有间谍们在监听各种单词。当然,即使是在十年前,这样做也会显得非常偏执和古怪,不过现在看来已经不那么奇怪了……
### 结论
我喜欢 Emacs 附带的游戏和玩具。它们大多来自于,嗯,我们姑且称之为一个不同的时代:一个允许或甚至鼓励奇思妙想的时代。
有些玩意非常经典(如俄罗斯方块和汉诺塔),有些对经典游戏进行了有趣的变种(如黑盒)——但我很高兴这么多年后他们依然在 Emacs 中。
我想知道时至今日,这些玩意是否还会纳入 Emacs 的代码库中;嗯,它们很可能不会——它们将被归入包管理仓库中,而在这个干净而贫瘠的世界中,它们无疑属于包管理仓库。
Emacs 要求将对 Emacs 体验不重要的内容转移到包管理仓库 ELPA 中。我的意思是,作为一个开发者,这是有道理的,但是……对于每一个被移出并流放到 ELPA 的包,我们都在蚕食 Emacs 的精髓。
--------------------------------------------------------------------------------
via: https://www.masteringemacs.org/article/fun-games-in-emacs
作者:[Mickey Petersen][a]
选题:[lujun9972][b]
译者:[lujun9972](https://github.com/lujun9972)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.masteringemacs.org/about
[b]:https://github.com/lujun9972
[1]:https://en.wikipedia.org/wiki/Office_Space
[2]:https://en.wikipedia.org/wiki/Tower_of_Hanoi
[3]:https://www.masteringemacs.org/article/fun-emacs-calc
[4]:http://www.xkcd.com
[5]:https://en.wikipedia.org/wiki/Battleship_(game)
[6]:https://www.masteringemacs.org/article/evaluating-elisp-emacs
[7]:https://en.wikipedia.org/wiki/ELIZA
[8]:https://en.wikipedia.org/wiki/Conway's_Game_of_Life