diff options
| author | eltrac <hi@eltr.ac> | 2026-05-08 14:34:48 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-05-08 14:34:48 +0800 |
| commit | cff87c2700ec0b373f5393f596999c46d307514d (patch) | |
| tree | 72001b57ef71db37b58ec0f094bb97783bfe16f8 /content | |
| parent | 4c7ec1868ab4f523046f631c9be238a80dd22baa (diff) | |
[draft] update weekly draft
Diffstat (limited to 'content')
| -rw-r--r-- | content/weekly/80.md | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/content/weekly/80.md b/content/weekly/80.md index be41016a..e65e5667 100644 --- a/content/weekly/80.md +++ b/content/weekly/80.md @@ -128,6 +128,68 @@ Ghostty 也在[搬离 GitHub](https://mitchellh.com/writing/ghostty-leaving-gith ## 星群 +### ifgame + +用 Clojure 写的文字冒险游戏框架,或者说交互式小说(Interactive Fiction),基于 [Inform 6](https://www.inform-fiction.org/)。项目附带一个示例游戏,把仓库克隆下来之后用 [Leiningen](https://leiningen.org/) 运行(`lein run`)即可。 + +不过说实话游戏玩起来有点摸不着头脑,我要去读源代码才知道我能干什么。 + +```sh +Heidi +A Simple Example +by Rod Schmidt + +In front of a cottage +You stand outside a cottage. The forest stretches east. + +> go to forest +You can't go that way. + +> go to cottage +You can't go that way. + +> enter cottage +It's such a lovely day -- much too nice to go inside. + +> enter forest +You cannot do anything with the forest. + +> sit down +Sorry, I don't know what "sit" means. + +> explore forest +Sorry, I don't know what "explore" means. +``` + +后面才意识到只能输入两个词,`go` 后面甚至不该有 `to`。如果我不读源代码的话,我也不知道要用 `examine` 这个动词啊。我想这是所有纯文字冒险游戏的通病吧,也可能是乐趣所在。 + +```sh +> go east +Deep in the forest +Through the dense foliage, you glimpse a building to the west. A track heads to the northeast. +There is a baby bird here. + +> examine baby bird +Too young to fly, the nestling tweets helplessly. +``` + +不过这个框架用起来还是很有意思: + +```clojure +(object :nest + "bird's nest" + ["nest" "twigs" "moss"] + :adjectives ["bird"] + :props #{:container :open} + :handler (fn nest-handler [ast _game] + (if (action/is-action? (:action ast) :examine) + (do + (println "The nest is carefully woven of twigs and moss.") + true) + false))) +``` + +访问:[infiniteNIL/ifgame](https://github.com/infiniteNIL/ifgame) --- |
