在 Linux 命令行中使用 nudoku 解决谜题
数独

> 
> 数独是简单的逻辑游戏，它可以在任何地方玩，包括在 Linux 终端中。
> 
> 
> 


![](/data/attachment/album/201901/08/183631eapvfqcd662vbpee.png)


欢迎回到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列，你甚至可能会问什么是命令行玩具。我们在考虑中，但一般来说，它可能是一个游戏，或任何简单的消遣，可以帮助你在终端玩得开心。


很可能你们中的一些人之前已经看过我们日历中的各种玩具，但我们希望每个人至少见到一件新事物。


每年圣诞节，我的岳母都会给我妻子一本数独日历。它接着会在我们的咖啡桌上呆上一年。每天都是一张单独的表格（星期六和星期日除外，它们合并在一页上），这样你每天都有一个新的谜题，同时还有一本能用的日历。


问题在于在实际中它是一本很好的谜题，但不是一本好的日历，因为事实证明有些日子的题目比其他日子更难，我们没有以每天一个的速度解决它们。然后，我们会在懒散的周日来解决这周堆积的谜题。


既然我在这个系列的一部分中介绍过[日历](https://opensource.com/article/18/12/linux-toy-cal)，那么在这里介绍数独也是公平的，除了我们的命令行版本是解耦的，因此将来很容易就能完成它。


我在 Fedora 的默认仓库中找到了 `nudoku`，因此安装它就像下面这样简单：



```
$ sudo dnf install nudoku
```

安装完后，只需输入 `nudoku` 即可启动它，之后的操作就很明了。如果你以前从未玩过数独，它它很容易：你只需要确保每行、每列、每个 3x3 构成的方块里都包含了 1-9 的所有数字。


你可在 [Github](https://github.com/jubalh/nudoku) 中找到 GPLv3 许可的 `nudoku` 源码


![](/data/attachment/album/201901/08/183633yzeinismsincfs7y.gif)


你有特别喜欢的命令行小玩具需要我介绍的吗？我们的日历基本上满了，但我们仍然希望在新的一年中展示一些很酷的命令行玩具。请在评论中留言，我会查看的。记得让我知道你对今天玩具的看法。


一定要看看昨天的玩具，[使用 Linux 终端庆祝丰年](https://opensource.com/article/18/12/linux-toy-figlet)，记得明天回来！




---


via: <https://opensource.com/article/18/12/linux-toy-nudoku>


作者：[Jason Baker](https://opensource.com/users/jason-baker) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Welcome back to another installment in our 24-day-long Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. We’re figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal.

Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone.

Every year for Christmas, my mother-in-law gives my wife a Sudoku calendar. It sits on our coffee table for the year to follow. Each day is a separate sheet (except for Saturday and Sunday, that are combined onto one page), with the idea being that you have a new puzzle every day while also having a functioning calendar.

The problem, in practice, is that it's a great pad of puzzles but not a great calendar because it turns out some days are harder than others and we just don't get through them at the necessary rate of one a day. Then, we may have a week's worth that gets batched on a lazy Sunday.

Since I've already given you a [calendar](https://opensource.com/article/18/12/linux-toy-cal) as a part of this series, I figure it's only fair to give you a Sudoku puzzle as well, except our command-line versions are decoupled so there's no pressure to complete exactly one a day.

I found **nudoku** in my default repositories on Fedora, so installing it was as simple as:

`$ sudo dnf install nudoku`


Once installed, just invoke **nudoku** by name to launch it, and it should be fairly self-explanatory from there. If you've never played Sudoku before, it's fairly simple: You need to make sure that each row, each column, and each of the nine 3x3 squares that make up the large square each have one of every digit, 1-9.

You can find **nudoku**'s c source code [on GitHub](https://github.com/jubalh/nudoku) under a GPLv3 license.

![Linux toy: Nudoku animated Linux toy: Nudoku animated](https://opensource.com/sites/default/files/uploads/linux-toy-nudoku-animated.gif)

Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement.

Be sure to check out yesterday's toy, [Use your Linux terminal to celebrate a banner ](https://opensource.com/article/18/12/linux-toy-figlet)[year](https://opensource.com/article/18/12/linux-toy-figlet), and come back tomorrow for another!

## Comments are closed.