工具与资源chiark.greenend.org.uk
Simon Tatham 的便携益智游戏合集
Simon Tatham's Portable Puzzle Collection
2017 — 2025,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这是 Simon Tatham 的便携益智游戏合集,汇集多款经典逻辑解谜小游戏,并提供 Windows、Android、Web 等多平台版本。项目开源,每个谜题由程序生成并保证唯一解,支持分享种子,还附带求解算法和详尽的开发者文档。代码以 C 编写,其架构设计常被当作学习范例。
为什么经久不衰:它把严谨的谜题生成与求解、自测试架构和高质量 C 代码结合在一起,既是耐玩的游戏合集,也是可反复研读的开源工程范例。
HN 评论精选
开发者文档与 C 代码质量极高,是学习范例。
开发者文档绝对是顶级的,而且我认为这份代码是如何写好 C 的典范。看看 Tents 谜题的源码,非常精彩。
cbsks查看英文原文
The developer documentation is absolutely top notch: https://www.chiark.greenend.org.uk/~sgtatham/puzzles/devel/ And I think the code is a masterclass of how to write C. Take a look at the source for the tents puzzle, it’s amazing. https://git.tartarus.org/?p=simon/puzzles.git;a=blob;f=tents.c;h=8b9365328029eb236e670e57a6972a2876427752;hb=HEAD
评论者用数学不变量分析单人跳棋,发现部分初始局面无解,说明这类谜题有数学深度。
前几天我回母亲家收拾童年物品,找到了旧的单人跳棋套装。接下来一周我完全迷上了它,一直在玩,还分享给朋友,最后发现了一些很妙的事实。我很快发现,就起始位置而言,只有特定选择第一个空孔才可能通关(即只剩一个棋子),其他选择总会至少剩两个棋子。我还发现最终相对构型很大程度上由初始构型决定。有了直觉后,我决定严谨一点,用数学方法研究,找到了一个不变量:从任何棋盘状态可算出 0 到 15 之间的数,任何合法移动后这个数不变。这意味着至少有 16 组棋盘状态彼此无法通过合法移动到达,其中只有 9 组与只剩一个棋子的状态同余。特别是,我小时候玩的八边形棋盘(显然叫法国变体),起始位置缺中心孔,是无解的。等我觉得自己研究完了,上网搜索,发现我的结果远非新颖,其实只是……
frodetb查看英文原文
The other day, while collecting my childhood belongings from my mother's house, I found my old peg-solitaire set. The following week I was totally obsessed with it, playing it all the time, sharing it with all my friends, and I ended up discovering some really nifty facts about it. I quickly found that as starting positions go, only certain specific choices for the first open hole would make the game winnable (in the sense that you remove all except one peg). For others there would always be at least two pegs left. I also found that the final relative configuration was to a large degree decided (modulo some relative shift) by your choice of initial configuration. After gaining intuition I decided to apply some rigor, so I went about things mathematically and found an invariant! That is, I found a way to compute, from any board state, a number between 0 and 15, which would be the same after any legal move. This meant that there were (at least) 16 groups of board states that were inaccessible from each other by legal moves. And of these 16 groups, only 9 were congruent with a board state containing just one peg. In particular, the octagon board (the one I had as a kid, apparently referred to as the French variant) with the center peg missing in the starting position is not solvable! Once I felt that I was done with investigating the puzzle for myself, I started searching around online and found that my results were (unsurprisingly) far from novel, and were in fact only scratching the surface of what brighter mathematicians had found over the years. But that only made me more happy with my findings, because it confirmed to me that I was right and also that other people were interested in this thing. I've thought about writing an interactive article presenting the findings I made and intuitions I used. Perhaps I'll post it on here once I'm done with it.
框架利用正常游玩路径自测试序列化接口,是值得借鉴的架构设计。
用这个框架写的谜题实现,据我所知都是自测试的。例如,文本形式的游戏和走子描述会在正常游玩过程中生成并解析;因此只要你能在游戏里走子,就基本可以确信序列化接口工作正常、能保存游戏。相反,如果只用单个 make_move() 同时做 interpret_move() 和 execute_move(),再另写编解码函数,那些函数平时不会被用到,可能彻底坏掉也不知道。这样做还让存档更小。这种故意调用平时不一定需要的函数、让 bug 尽早暴露的代码,有通用名称吗?我没听过叫“自测试”,但我也想不出名字。
seanwilson查看英文原文
> Puzzle implementations written in this framework are self-testing as far as I could make them > Textual game and move descriptions, for example, are generated and parsed as part of the normal process of play. Therefore, if you can make moves in the game at all you can be reasonably confident that the mid-end serialisation interface will function correctly and you will be able to save your game. (By contrast, if I'd stuck with a single make_move() function performing the jobs of both interpret_move() and execute_move(), and had separate functions to encode and decode a game state in string form, then those functions would not be used during normal play; so they could have been completely broken, and you'd never know it until you tried to save the game – which would have meant you'd have to test game saving extensively and make sure to test every possible type of game state. As an added bonus, doing it the way I did leads to smaller save files.) Is there a general name for code like this that deliberately makes use of functions it doesn't necessarily need to so that bugs are noticed early? I haven't heard it called self-testing but I don't have a name of it. I've done this before when features/functions are added that I know are rarely going to get called and I want an early warning if they break later by making sure they're called during regular usage.
合集在生成、唯一解、求解器、种子、跨平台和框架设计上都很出色。
这个合集真的很棒。每个游戏都有自己的生成算法,有时还带难度参数;每个游戏必须只有一个解,这意味着你永远不用猜,否则就是 bug,对 Mines(扫雷克隆)来说这是突出特性;几乎每个游戏的解法都实现了对应的求解算法,可以从源码学到很多;每个生成的游戏都有种子,可以分享或用于 bug 报告;项目开箱即可交叉编译到许多平台,包括 Android、Windows 和 Web,生成的 Windows 二进制很小,因为没用臃肿的 GUI 框架;还提供了考虑周全的框架,方便添加新游戏;游戏图标在构建过程中即时生成。
viddi查看英文原文
This collection is truly amazing. * There is an own creation algorithm for each game, sometimes including parameters like difficulty * For every game there must be only one possible solution. This means that you never have to guess. Otherwise, it's a bug. For Mines (Minesweeper clone), this is an outstanding feature. * The solution for almost every game is implemented with a respective solving algorithm. You can learn a lot from the source code. * Each generated game comes along with a seed which you can share with others, or for a bug report. * The project cross-compiles out of the box for many platforms, including Android, Windows and Web. And the resulting Windows binaries are tiny, because it does not use a bloated GUI framework. * It provides a well-thought framework in case you want to add another game. * Icons of the game are created on-the-fly during the building process
历次讨论
同类还值得读
直接在浏览器中启动 Linux 内核
Boot a linux kernel right inside your browser.
Fabrice Bellard 的 JSLinux 页面,用 JavaScript 在浏览器里启动一个 Linux 内核,并提供一个可交互的终端环境。
工具与资源上首页 5 次 · 2011–2025bellard.orgHacker News 未公开功能与行为清单(2018)
A List of Hacker News's Undocumented Features and Behaviors (2018)
数据科学家 Max Woolf 整理的 Hacker News 未公开功能与行为清单,涵盖投票机制、排名算法、账号惩罚等社区运作细节。
工具与资源上首页 5 次 · 2019–2025github.comMapSCII:在终端中用盲文和 ASCII 渲染地图
MapSCII – Braille and ASCII map renderer for the console
MapSCII 是一个在命令行终端里渲染地图的开源工具,用盲文字符和 ASCII 字符把地理数据画成可交互浏览的字符地图。
工具与资源上首页 5 次 · 2017–2025github.com顶尖大学的免费在线课程
Free Online Courses from Top Universities
Open Culture 整理的一份免费在线课程合集,汇集了全球顶尖大学(如 MIT、斯坦福、耶鲁等)向公众开放的网络课程资源,涵盖音频、视频等多种形式。
工具与资源上首页 5 次 · 2010–2022openculture.com淘气字符串:容易引发用户输入问题的字符串清单
Naughty Strings: A list of strings likely to cause issues as user-input data
一个 GitHub 仓库,收录了大量容易让程序出问题的用户输入字符串,如特殊字符、emoji、SQL 注入片段、系统命令等,供开发者用于测试输入处理逻辑。
工具与资源上首页 4 次 · 2015–2020github.com