⬤ Villager Connect Four
那位大师级图书管理员的讨价还价可是不留情面的。他们不仅精通四子棋,而且执先手。
打开任意村民的交易界面并点击 Connect Four。一个完整的棋盘会直接展开——无需物品、无需指令、无需设置。
村民执先手,而这正是关键所在
四子棋是一个已解游戏。在标准的 7×6 棋盘上,先落子的玩家能够强制获胜——这已通过穷举计算得到证明,而不仅仅是经验观察。先手方玩的是必胜局。
因此,村民获得了这一优势。这意味着大师级村民并非“非常强”:它是不可战胜的,任何技巧都无法改变这一事实。如果你更想拥有必胜的一方,只需一行配置即可实现——见下文。你的颜色跟随回合顺序,因此先落子者执黄棋。
他们的实力如何?
村民的交易等级决定了其实力——每个等级的思考方式都截然不同,而非仅仅是更深层次的搜索:
| 村民等级 |
四子棋实力 |
| 新手 |
几乎随机落子——不会追求胜利,也不会阻挡你 |
| 学徒 |
会抓住眼前的胜利机会,阻挡你的威胁,但看不到更远 |
| 专家 |
从不走入必败之地;能制造和识别双重威胁 |
| 专家 (Expert) |
理解奇偶威胁parity(奇偶性) |
| 大师 |
已解该游戏 |
从普通专家到高级专家的跳跃是有趣的。每列包含偶数个格子,因此在纯填充竞赛中,先手方占据第 1、3、5 格,后手方占据第 2、4、6 格。因此,只有当威胁行最终落入其所有者手中时才有价值——同一行高一点点的三连珠可能毫无价值。普通专家计算威胁数量。高级专家计算那些真正会被触发的威胁。
玩法说明
- 点击一列——或点击该列上方的任意位置。幽灵棋子会悬挂在你所指的那一列上方。
- 已满的列会以红色闪烁并伴随沉闷音效,而不是默默地忽略你。
- 获胜的四子会被框出,棋盘其余部分变暗,使胜利一目了然而非需要推断。
- 使用按钮认输,或直接关闭棋盘。离开超过 16 格、村民死亡或断开连接都会导致放弃游戏。
- 无赌注、无奖励——仅供娱乐(以及炫耀资本)。
配置
config/villagerconnectfour.properties,首次运行时生成,内联文档如下:
first-player=player - 你执先手,并获得理论上必胜的一方。这是对抗不可战胜的大师的标准方法。
board-size=7x6 - 支持从 4x4 到 8x7 的任何尺寸。这会改变游戏的价值,而不仅仅是规模:几个较小的棋盘在完美对弈下是和局,因此可以在这些棋盘上限制大师的表现。
技术细节
- 从头编写的纯 Java 引擎。棋盘由两个位板打包进单个 64 位字中,每列占用七位——每列多出的那位是哨兵位,始终为空,正是它允许通过将棋盘与自身移位副本进行按位与操作来找到四连珠,且完全无需边缘检查。
- 分数以棋盘上的棋子数而非搜索根节点的层数来计数,这使得它们成为关于局势的绝对事实。所有服务器上的游戏共享一个转置表,因此大师的知识会在整局游戏中累积,而不是每步都从零开始。
- 完全服务器权威——服务器拥有游戏控制权;客户端仅发送列号,别无其他。
- 引擎在后台线程运行,因此服务器永远不会卡顿。
- 零美术资源:棋盘、棋子、孔洞和高亮均通过程序化绘制,并在任何尺寸下保持清晰。
兼容性
与其他 Villager Games 模组配合良好——交易界面的按钮会堆叠显示而非重叠。
需要 Fabric API。客户端和服务器均需安装此模组。
⬤ Villager Connect Four
That Master-level librarian drives a hard bargain. They have also solved Connect Four, and they are going first.
Open any villager's trade screen and hit Connect Four. A full board opens right there - no items, no commands, no setup.
The villager goes first, and that is the point
Connect Four is a solved game. On the standard 7×6 board, the player who drops first can force a win - proved by exhaustive computation, not just observed. Whoever moves first is playing a won game.
So the villager gets it. That means a Master villager isn't "very strong": it is unbeatable, and no amount of skill changes that. If you'd rather have the winning side, one line of config hands it to you - see below. Your colour follows the turn order, so whoever drops first plays yellow.
How strong are they?
A villager's trading level sets its strength - and each level thinks in a genuinely different way, not just deeper:
| Villager level |
Connect Four strength |
| Novice |
Drops almost at random - won't take a win, won't block yours |
| Apprentice |
Takes the win in front of it, blocks yours, sees nothing further |
| Journeyman |
Never plays into a loss; makes and spots double threats |
| Expert |
Understands odd/even threat parity |
| Master |
Has solved the game |
The jump from Journeyman to Expert is the interesting one. Every column holds an even number of cells, so in a pure filling race the first player takes the 1st, 3rd and 5th cell of a column and the second player takes the 2nd, 4th and 6th. A threat is therefore only worth something if its row falls to its owner - the same three-in-a-row one row higher can be worthless. A Journeyman counts threats. An Expert counts the ones that will actually be reached.
How to play
- Click a column - or anywhere above it. A ghost disc hangs over the column you're pointing at.
- A full column flashes red with a dull note rather than quietly ignoring you.
- The winning four are outlined and the rest of the board dims, so a win is visible rather than inferred.
- Resign with the button, or just close the board. Walking more than 16 blocks away, the villager dying, or disconnecting abandons the game.
- No stakes, no rewards - just for fun (and bragging rights).
Configuration
config/villagerconnectfour.properties, written on first run and documented inline:
first-player=player - you drop first, and get the theoretically winning side. The sanctioned way past an unbeatable Master.
board-size=7x6 - anything from 4x4 to 8x7. This changes the value of the game, not just its scale: several smaller boards are draws with perfect play, so a Master can be held on those.
Under the hood
- A from-scratch pure-Java engine. The board is two bitboards packed into a single 64-bit word, one column per seven bits - the spare bit per column is a sentinel that is always empty, and it's what lets four-in-a-row be found by and-ing the board with shifted copies of itself with no edge checks at all.
- Scores are counted in discs on the board rather than plies from the search root, which makes them absolute facts about a position. One transposition table is shared by every game on the server, so a Master's knowledge compounds through a game instead of starting cold on every move.
- Fully server-authoritative - the server owns the game; the client sends a column and nothing else.
- The engine thinks on a background thread, so the server never stalls.
- Zero art: board, discs, holes and highlights are all drawn procedurally and stay crisp at any size.
Compatibility
Plays nicely with the other Villager Games mods - the trade-screen buttons stack instead of overlapping.
Requires Fabric API. Client and server both need the mod.
评论 0
登录后参与评分
还没有评论,来抢沙发吧