本文致力于为《吃豆人》玩家提供这款游戏的最全面最详细的研究成果。本次研究的新发现与游戏中的“鬼”的行为和寻径逻辑有关。本文的第一章叙述了南宫梦和《吃豆人》的 设计师岩谷彻的背景故事以及这款经典街机游戏的开发和发布过程。第二章介绍了这款游戏的设计文件的技术部分。第三章和第四章主要解释了游戏的寻径逻辑和特殊的鬼的行为 。第五章介绍了“分屏”关卡。
1990年，佛罗里达州的Billy Mitchell成为世界上获得《吃豆人》完美得分（333360分）的第一人，他的吃豆人吃掉了每个关卡的所有圆点、能量、鬼和增益，在这个过程中没有 损失命数。但也许更令人吃惊的是，他玩游戏并不需要记忆路线——众所周知的“模式”。相反地，他依靠自己对各种鬼在迷宫中的行为的熟悉，使吃豆人总是比他的敌人先行一 步。
今天，大部分《吃豆人》在线攻略都非常类似于80年代出售的指导书的内容：先总结玩法和得分机制，然后罗列玩家需要记忆的模式，但几乎没有揭示游戏如何运作或鬼如何决策 。因此，本文的目的是，让玩家不是通过记忆模式，而是从玩法、迷宫逻辑、鬼的个性和神秘的“分屏”关卡，更加深刻地理解《吃豆人》。我不敢保证你看过本文后会玩得跟 Billy Mitchell一样好，但一旦你深刻地理解鬼是如何“思考”的，你绝对会更明白自己为什么会在关键模式中犯错误。
1977年，一个名叫岩谷彻的有为青年通过自学技术，到东京的一家娱乐设备制造公司南宫梦求职。这家公司当时的主要产品线是游戏机和光枪射击玩具。这位22岁的年轻人没有接 受任何正规的电脑、视觉艺术或图像设计的培训，但他在游戏设计方面的创新能力和天赋给面试他的执行官留下了深刻印象。他们决定雇用岩谷彻，保证会在公司给他找个位置。 他决定留下来。
最后，岩谷彻得到的工作是给南宫梦的新电子游戏部门设计游戏。他有限的电脑技术迫使他作为项目的游戏设计师，与编写代码的程序员保持密切合作。在1977年，游戏设计师对 于游戏行业还是一个新鲜的职业，当时在部分游戏是由编写代码的程序员设计的。除了程序员，岩谷彻的团队中还有负责开发各种设备和组件的硬件工程师、负责实现他的画面想 象的图形美工和为游戏制作音乐及声音特效的作曲人员。
岩谷彻最实打算制作弹球机，但南宫梦对这种生意没兴趣。也许作为让步，他的第一个游戏设计，《Gee Bee》是一款类似于Atari的《Breakout》的游戏，但玩法上显然受到弹球 机的启发。这款发行于1978年的游戏是南宫梦的第一款原创电子游戏——在此之前他们只是把Atari的游戏移植到日本市场。这款游戏在街机市场小有成绩。
但随着新类型的出现，这种游戏很快失去立足之地。游戏发行公司太东的《太空侵略者》于1978年发面，获得了前所未有的成功，使整个游戏行业以太空射击为开发主题。游戏制 作商为了复制太东的成功，也在努力开发自己的太空射击游戏。南宫梦也很快抓住这股潮流，马上组织了一支开发《太空侵略者》类型的团队。大约就在这个时候，岩谷彻开始考 虑设计一款不同的游戏。他认为射击类游戏的热潮必定会像之前的游戏类型的一样消退。与基制作另一款太空射击游戏，不如在游戏设计上开辟一个全新的方向。所以他的团队没 有把设计焦点放在暴力或战斗主题上，而是以既能吸引男性玩家又能唤起女性玩家兴趣为目标。
“好吧，半真半假。在日本汉字中，‘嘴’这个字是圆形的。没有批萨那么圆，但我决定把角色做得圆一些。我曾有冲动把吃豆人的形状做得再复杂一些。在我设计这款游戏时， 有人建议我加上眼睛。但我们最终没有采纳那个建议，因为一旦我们加上眼睛，我们就会想再加上眼镜、小胡子……这样就没完没了了。食物是这个基本概念的另一部分。在我的 初始设计中，我让屏幕充满食物，玩家就被食物包围着。随时思考深入，我意识到玩家会不知道到底要做什么：游戏目标太模糊了。所以我制作了一个迷宫，把食物放在迷宫里。 这样无论谁玩游戏，都会有一些在迷宫中移动的结构。日本有一个俚语——paku paku（这是日语发音），人们用它来形容人吃东西时嘴巴的运动。《吃豆人》（《Puck-Man》）这 个名称就是从这个词来的（游戏邦注：“Puck-Man”中的“puck”发音与Paku接近）。”——岩谷彻
出自这个童话故事的怪兽是四种鬼，它们会在迷宫中追击玩家，从面而增加游戏的紧张感。对玩家的进攻是分批的（类似于《太空侵略者》），而不是无限的袭击。每一个鬼都有 独特的个性。这个童话故事还有一个“精神”的概念或者叫作生命力（使吃豆人能够吃鬼的力量）。岩谷彻把这个概念变成游戏迷宫中的可吃的力量丸，玩家吃了这种力量丸就获 得了吃鬼的力量。
名称和基本概念到位后，岩谷彻正式启动项目。南宫梦分配给岩谷彻开发《吃豆人》的团队包含一名程序员、一名硬件工程师、一名美工和一名作曲师。项目于1979年初启动。在 这一年中，岩谷彻还设计了两款以弹珠机为主题的新游戏——《Bomb Bee》和《Cutie Q》，这两款游戏都是在《吃豆人》还在开发时发布的。这两款游戏与《Gee Bee》都类似， 但玩法上增加了，画面也改善了。
过去几个月一直在开发《太空侵略者》类游戏的团队已经给南宫梦带来了一次技术革命：他们开发了第一款使用真实、多色、RGB显示的而不是单色显示器的游戏，当时的彩色胶带 非常流行。多亏了其他团队的突破性成果，岩谷彻现在可能用色彩来强化他的设计了。考虑到希望游戏吸引女性，他立即决定在鬼的设计上使用彩色，即鬼的身体使用轻淡的颜色 ，眼睛为惹眼的蓝色。迷宫本身是深蓝色的，而吃豆人是亮丽的黄色。
《吃豆人》制作了一年零五个月。最终，这款当时开发耗时最长的游戏于1980年5月22日在日本发行。一开始，这款游戏的表现只是一般，并没有造成一夜轰动。事实上，南宫梦的 多色“太空侵略者”式游戏《Galaxian》更受广大玩家的欢迎——作为日本游戏市场的主体的男性玩家并不知道具有卡通角色、迷宫和轻柔色彩的《吃豆人》是什么样的游戏，而 以太空射击为主题的《Galaxian》显然让他们一眼就觉得亲切熟悉。
《吃豆人》被进行大刀阔斧的修改：机子的外观颜色从白色变成明黄色，使它在游戏机厅里更抢眼。精细多色的机身图案被更省成本的三色插画取代了（当时的插图是被加上眼睛 和脚的吃豆人和一个蓝鬼）。Midway还把鬼的名字（Blinky、Pinky、Inky和Clyde)和南宫梦翻译成英语。吃豆人最大的改变是它的名字。Midway害怕“Puck-Man”中的“P”会被 玩家改成“F”，导致角色被冠上不雅的绰号。为了避免自己的产品与“Fuck”扯上关系，Midway在1980年10月的发行以前把游戏名称从原来的《Puck-Man》改成《Pac-Man》。
但是，这两款游戏在美国的表现却与在日本颠倒了。《Galaxian》迷失在美国的射击街机游戏狂潮中，到1980年秋天，它又遭遇更强劲的对手如《Defender》。最后，《Galaxian 》在美国的表现只能算一般，而在日本，也没能复制原版《太空侵略者》那种程度的成功。《吃豆人》的命运却与之相反——没有什么游戏能与这款在类型上独树帜的游戏相抗衡 。明黄色的游戏机身、画面和声音都非常引人注意。没有人以前见过这样的游戏。迷人的玩法和难度渐增的关卡让硬核玩家大喜过望，而游戏的简单又非常吸引儿童。非战争、暴 力的主题正如岩谷彻所期望的那样，激发了相当一部分女性对电子游戏的兴趣。甚至担心游戏暴力的家长也很放心自己的孩子玩像《吃豆人》这样可爱纯真的游戏。
《吃豆人》捕获了全世界玩家的关注，造成了前所未有的轰动。它真正成为一种遍及全球的现象，发行的头一年便卖出超过10万台机子。容易上手但极难精通的玩法，使上至华尔 街的执行官下至还在念书的孩子，纷纷守在《吃豆人》的机子旁边等着玩游戏。到1982年，《吃豆人》的周边产品几乎随处可见：T恤衫、帽子、钥匙链、腕带、床单、空气清香剂 、挂钟、水杯、游戏卡、贴纸、收纳盒、漫画书——甚至周六早上的卡通片。一首叫作《Pac-Man Fever》的潮歌登上美国流行音乐排行榜第9名。许多书刊发表了由高手玩家写的 获得高分的技巧和建议——出现了史上第一本关于电子游戏的策略指南书。
30多年以后，《吃豆人》仍然是史上销量最好的投币游戏。吃豆人在美国仍然被认为是辨识度最高的游戏角色。它的外观已经被授权给250多个公司，出现在超过400种产品中。他 的名字被商业圈用于形容守势的公司反而吞并更大的公司，即“Pac-Man defense”。在华盛顿的Smithsonian 博物院甚至还有一台用于展示的《吃豆人》机子。
对这款原版投币游戏的热情从未完全消退。多亏了南宫梦再次把《吃豆人》和其他经典街机游戏放进现代家用游戏机中，新一代《吃豆人》玩家才有机会玩到这款年纪比他们本人 还大的游戏。因为家用电脑能够使用高级街机模拟器（如MAME）来复制街机ROM芯片，100%复原游戏，许多经典游戏才得以保持生命力。还有若干网站存有关于原版《吃豆人》街机 游戏的信息，如Wikipedia和Killer List Of Video Games。
《吃豆人》的前提非常简单：使用一个四通操纵杆，玩家引导吃豆人在充满豆子的迷宫中上，下，左，右移动，并吞食这些豆子。迷宫中有四个幽灵在追逐着吃豆 人，想要抓住 它并杀死它。玩家的目标是清除迷宫中的所有豆子并避免被幽灵逮住。每一回合，幽灵怪物都会不断从迷宫中间的“怪物栏”中涌出。如果吃豆人被幽 灵逮着了，它便会死掉，而 幽灵将回到怪物栏中，在游戏继续前，新的吃豆人将出现在起始点的位置。当迷宫的所有豆子被清除时，游戏面板便会进行重置，新的一 回合将开始。如果吃豆人被幽灵抓住并且 没有多余的生命了，那么游戏便会结束。
第一种方法便是创造逆转形式，将敌人变成自己的猎物。不管何时，当吃豆人吃掉迷宫角落中的一个能量补充剂，幽灵便会转变方向，并在恢复正常之前暂时变成深蓝色。除了变 成深蓝色，这时候的它们还很容易受到吃豆人的攻击，并且在有效时间内如果被吃豆人抓住了便能提供给对方额外的分数。当幽灵被吃掉时，它们的眼睛将会回到怪物栏里，并重 新回归到追逐吃豆人的行列中。当吃豆人吃掉能量补充剂并抓住第一个幽灵时，他将获得200个点数。玩家基于同一个能量补充剂每抓住一个幽灵所获得的分数都是之前的两倍，就 像400，800或1600。如果基于所有的4个能量补充剂而抓到4个幽灵，玩家便能在这些早前的关卡中获取12000个点数。这就说明在前面几轮，也就是幽灵保持蓝色状态几秒钟的情况 下获取成功并没有多困难。很快地，当幽灵的“蓝色时间”变成1或2秒时，玩家便很难在时间限制之内抓住所有的幽灵。到第19个关卡，幽灵将不再变成蓝色，并且玩家也不会因 为抓住它们而获得额外的分数。
在每一轮提高分数的另一种方法便是吃掉奖励标志（通常都是水果），在每一轮游戏中这些标志会出现在怪物栏下方两次。第一个奖励水果会在玩家清除了70个豆子时出现；第二 个则是在玩家清除了170个豆子时出现。每个水果的价值是在100至5000个点数不等，这取决于玩家现在所处的关卡。不管水果何时出现，它停留在屏幕上的时间总是在9至10秒间。 额外的持续时间是可变的，并且不是基于模式的使用便能够预测到的。换句话说，在同样的关卡中执行同样的模式两次并不能保证奖励水果每次待在屏幕上的时间。鉴于许多模式 的设计目的是在奖励水果出现时尽可能快速地吃掉它们，所以这一情况经常遭到忽视。在最后六轮完成后所使用的标志，加上现在的回合都被呈现在屏幕的最底部（游戏邦注：通 常被成为水果计数器或关卡计数器）。
追逐——幽灵在追逐模式中的目标是在迷宫中抓住吃豆人。在追逐吃豆人时，每个幽灵都会呈现出独特的行为，即表现出它们的不同个性：Blinky（红色）具有较强的侵略性，一 旦它出现在你后边就很难被动摇。Pinky（粉色）会出现在你前方并切断你的前进方向。Inky（浅蓝色）是最不可预测的。Clyde（橙色）似乎在做着自己的事，并且不会阻挡你的 道路。
在所有的三种行为模式中，幽灵都不允许逆转前进方向。如此，它们只能选择朝着当下的方向继续前进或在下一个交叉路口转向另一边。因此，当一个幽灵在迷宫的交叉路口选择 了一个前进方向，它便只能继续朝着那条道路前进，直到到达下一个交叉路口。当然了，如果你已经花了一些时间在玩《吃豆人》，你便已经清楚幽灵会在特定时间转变方向。但 如果是在它们被禁止转向的情况下它们又是怎么做到的？答案便是：当改变模式时，系统将重新加载幽灵的正常行为，并命令它们朝不同方向前进。不管何时当这种情况发生时，
基于特定的时间间隔，幽灵会在散播和追逐模式间转变着。当幽灵转向时，我们便能够很清楚地察觉到这些模式的转变。在幽灵无限期地保持追逐模式前，其在每个关卡中会出现4 次散播模式。优秀的玩家将利用幽灵不能追逐吃豆人的短暂时刻去清除迷宫中更危险领域的豆子。每当玩家死掉或完成关卡时，散播/追逐计时器将被重置。在关卡的开始或玩家死 掉后，从怪物栏中出现的幽灵便已经呈现出第一个散播模式了。
在前4个关卡中，前2个散播将各自持续7秒。而在第5个关卡后，其持续时间将变成5秒。第3个散播模式总是被设置为5秒。在第1个关卡中，第4次散播将持续5秒，但在之后的游戏 中将只是1/60秒。当这种情况出现时，幽灵将会转变方向。前两次追逐时间将各自持续20秒。在第1个关卡中，第3次追逐时间是20秒，但在地2个关卡到第4个关卡间将上升到1033 秒，而在之后的关卡中更是为1037秒——整整持续17多分钟！如果幽灵进入受惊模式，那么散播和追逐计时器便会暂停。当时间耗尽时，它们将回到之前的模式中，而散播/追逐计 时器将再次开启。以下表格便总结了这一信息：
在较早的关卡中，每当吃豆人吃掉角落中的一个能量补充剂时，幽灵便会转向，并暂时进入受惊模式。当幽灵受惊时，它们便会变成深蓝色，并更缓慢地移动着。它们将在迷宫中 漫无目的地行走，并在恢复到之前模式前短暂地闪烁白光。当受惊时，幽灵会在交叉路口使用伪随机数生成器选择一个方向。PRNG（PRNG）会生成一个伪随机内存地址去读取最后 的几个位数。这些位数会被翻译成受惊幽灵最先尝试的方向。如果选中的方向未被墙挡住，或者是幽灵现在前进方向的反方向，便是可被接受的。否则的话代码将以顺时针方向去 处理下一个可能的方向并再次尝试，重复这一测试直到找到一个可行的方向。在每个新关卡中，或者当吃豆人死掉时，PRNG将基于同样的最初种子值进行重置。这将导致受惊的幽 灵在执行模式时总是会选择同样的路径。随着关卡的发展，幽灵花费在受惊模式中的时间将不断缩短，直至最终不再变成深蓝色（然而它们仍会转向）。
吃豆人是基于最快速度的80%开始游戏。到第5个关卡时，吃豆人将开始全速前进，直到第21个关卡。那时候，它将放慢速度到90%，并在剩下的游戏中始终保持这一速度。每当吃豆 人吃掉一颗普通的豆子，它便会停止移动一帧，放慢10%的进程—-从而让接下来的幽灵能够赶超它。吃掉一个补充剂豆子将让吃豆人停止移动三帧，基于正常速度的幽灵比吃豆人 稍微慢一些，直到第21个关卡时它们的速度才开始超过吃豆人。如果幽灵进入一个侧走道，它的速度将被减半。在第1个关卡到第4个关卡间，当幽灵受惊时，其移动速度也会慢于 正常速度，而吃豆人仍会加速。下表是每个关卡吃豆人和幽灵的速度数据。
吃豆人能够比敌人更快速地导航到迷宫中的转弯。它不需要像幽灵那样等到到达转弯处的中点才开始改变方向（如下图）。相反地，它会在到达转弯处的中心处之前转变一些像素 ，并在通过时恢复这些像素。在到达中心前转弯处需要一个或多个像素，这是“前转”；在“后转”后也需要一个或多个像素。玩家学会朝着吃豆人的方向不断移动操纵杆，直到 它到达了转弯的中心位置，确保每个前转是从与中心间更多像素的位置上开始。这一技巧便是所谓的转弯技巧，也是《吃豆人》玩家最初应该掌握的技巧之一。基于非常成功的前 转手法，吃豆人将与紧跟其后的幽灵拉开更远的距离。也许一开始这样小的距离优势看起来没什么大不了，但是连续快速通过多个转弯将有效地摆脱追随者。这是在游戏中更高的 关卡中幸存下来的重要手段。
不管何时当吃豆人做出前转或后转，他的方向都发生了改变，他会开始朝着新方向移动一个像素，有效地加速就像他朝着45度角移动一样。当他到达了新方向路径的中心线时，他 会开始只朝着那一方向移动，并且速度也会恢复到之前的水平。尽早进行前转能够为吃豆人创造最大的距离优势。下图呈现的是一个回合可能碰到的4个可能方向中每个前转像素的 布局（绿色），中心点像素（黄色）以及后转像素（红色）。每个例子呈现了吃豆人从不同方向进入了同样的四通交叉路口。当从左边进入时，在到达转弯中心前有4个前转像素和 4个后转像素。相反地，从右边进入同一个交叉路口的话则是4个前转像素和3个后转像素。从上面和下面进入的话呈现出的是相同属性。对于许多在最早的前转后进行的转弯，吃豆 人将成为它在转弯“延迟的”每一像素中的一帧。从根本上来看，如果在到达转弯前能够练好操纵杆的使用技能，你将能够有效地提升自己的速度。
在最早的前转中转弯也要求你成功地执行任何模式。模式必须伴随着完美的转弯，因为它会删除人类的不确定元素，就像在吃豆人转弯时那样。如果没有转弯，我们便不可能复制 模式作者所创造的每次转弯的具体事件，因此幽灵行为不可预测性的提高是源于吃豆人未在同样的时间出现在同样的砖块上。最受欢迎的模式是那些在小小的输入计时缺陷出现时 “牢牢结合在一起”的内容（当从右边接近一个转弯处时将三个像素带离中心而不是四个就是一个计时缺陷）。其它模式（特别是那些在序列后面将吃豆人带向幽灵的模式）倾向 于“分解”，除非每个回合都有完美的转弯。在漫长的《吃豆人》回合中，甚至最优秀的玩家也会在快速的转弯系列中犯计时错误，并需要处理任何可能的结果。如此，我们应该 始终专注于实现完美的转弯，并警惕源自微妙的计时缺陷所带来的不可预见的幽灵行为。
通常被称为幽灵之家或怪物栏，这个迷宫中心被封锁的区域是4个幽灵的领域，而吃豆人不能进入其中。每当玩家完成关卡或吃豆人死掉时，幽灵便会回到这一起始点，也就是在幽 灵之家周边—-Blinky总是在上部或外部，而其它3只幽灵则在里面：Inky在左边，Pinky在中间，Clyde在右边。上面的粉色门是幽灵进出房子的通道。一旦幽灵离开了怪物栏，它 便不能再次进入，除非被吃豆人逮住了，这样它那空洞的眼睛便会回到屋子里等待重生。在玩家完成关卡或吃豆人死掉之后，Blinky已经在怪物栏外面了，而它唯一能够进入房子 中的机会便是被吃豆人逮住，而一旦复苏后它便会立刻调转方向离开。这是基于幽灵之家去了解Blinky的行为，但明确其它3只幽灵何时离开房子则是基于各种变量和条件。剩下的 内容将专门分析这一内容。因此下文中任何提到“幽灵”的内容都是关于Pinky，Inky和Clyde，而不包括Blinky。
用于评估幽灵何时离开房子的第一个控制是关于每个幽灵的计数器，即追踪吃豆人吃掉了多少颗豆子。每个幽灵的“豆子计数器”会在关卡开始时重置为0，并只有当幽灵在怪物栏 里才能被激活，而在任何特别时间里只有一只幽灵的计数器能够被激活，不管这时候房子里有多少只幽灵。选择激活哪只幽灵的计数器的数序是：Pinky，Inky，最后是Clyde。对 于吃豆人吃掉的每颗豆子，房子里优先被激活的幽灵的豆子计数器将加上1。在每个关卡中，每个幽灵的计数器都伴随着一个“豆子限制”。如果优先激活的幽灵到达或超过了豆子 限制数，它便会立刻走出房子，而它的豆子计数器也将失效（不会重置）。
Pinky的豆子限制总是被设为0，所以它能在每个关卡开始时立刻出去。在第1个关卡中，Inky的豆子限制为30，Clyde为60。这便导致游戏一开始Pinky便离开了怪物栏，随后激活 Inky的豆子计数器。只有在豆子到达30个时它才能离开房子。而当Inky离开时，Clyde的计数器也被激活，并开始计算豆子。当豆子数到达或超过60，他就能离开了。在第2个关卡 中，Inky的豆子限制从30变为0，而Clyde则从60变成50。Inky将在游戏开始时立刻走出怪物栏。在第3个关卡以及剩下的游戏中，所有的怪物的豆子限制都为0，都能在关卡一开始 便飘出房子。
不管何时丧命，系统都会让幽灵的个体豆子计算器失效，并使用全局豆子计算器去取代它。这一计算器能在其丧命后重置为0，并从那时候开始计算被吃掉的豆子数。房子里的3只 幽灵必须等待特殊的计数器告诉自己何时离开。当计数器的值等于7时Pinky便可以离开，而当该值等于17时Inky也能离开。唯一禁用该计数器的方法便是在计数器到达32时不让 Clyde离开；否则它将在房子里没有任何幽灵时继续计算豆子数。如果Clyde在适当的时间出现，全局计数器将被重置为0，并失效，而幽灵的个体豆子限制将重新激活并像之前那样 决定它们何时能够离开怪物栏。
如果豆子计数器是唯一的控制方法，那么吃豆人只需要早早第停止吃豆子便能让幽灵永远待在房子里不出来了。所以也存在一个单独的计时控制通过追踪从吃豆人开始吃豆子之后 过去的时间而处理这种情况。这一计时器始终都运行着，但会在每次豆子被吃掉时重置。每当吃豆人长时间不吃豆子时，计时器便会到达极限，而最先被激活的幽灵便能够立刻离 开房子，计时器也将被重置为0。上述所提到的同样的优先次序也是使用这一控制。游戏是从最初4秒的计时器限制开始，但在第5个关卡时这一限制降低到了3秒。
聪明的读者也许已经注意到这一系统中存在一个微妙的漏洞，即有可能导致在吃豆人逮住Pinky，Inky和Clyde时将它们长久地锁在怪物栏里。这其中所包含的的窍门是为了重置全 局豆子计数器必须牺牲一条生命，然后确保Clyde在计数器等于32之前离开房子。玩家可以通过避免吃豆子并等待计时器限制将Clyde带出房子而做到这点。当Clyde移向出口，玩家 可以再次开始吃豆子，直到至少清除了32颗豆子。现在朝能量补充剂前进并吞食一些幽灵。Blinky将像往常那样立刻离开房子，但是其它3只幽灵将“卡在”房子里，直到吃豆人继 续频繁地吃豆子而不再触发控制计时器。为什么会发生这种情况？这里的关键在于全局豆子计数器如何运行—-如果当计数器的值等于32时Clyede已经离开了房子，它便会失效。通 过在吃豆人吃掉32颗豆子前将Clyde带出房子，全局豆子计数器将继续计算豆子，直到数值到达32才会失效。现在，当幽灵被吃豆人吞食并回到房子里，它们仍将使用全局豆子计数
上图强调的是迷宫中4个特别的“区域”，在那里幽灵的行为受到了某些特定条件的限制，所以可以成为玩家的优势。两个红色区域代表幽灵禁止向上转弯的区域。当幽灵进入这两 个区域中的一个时，它便只能从右向左或从左向右移动，直到走出该区域。因此，只有吃豆人能够进入这4个开口朝上的通道。它也将提醒玩家记住幽灵也可以从另一端访问这些通 道！在散播和追逐模式时，红色区域的局限性便会呈现出来，而在受惊模式下，红色区域将暂时被忽视，从而让幽灵能够向上移动。粉色区域是在两部分相连接的通道间。就像之 前提到的，进入该通道的任何幽灵的速度将立刻变慢，直到离开这里。这种减慢速度的规则只适用于幽灵，吃豆人对此是有免疫力的。
我们得看看鬼如何在迷宫中移动和追击目标。本章节中描述的所有寻径逻辑都是四鬼共有的——在理解它们之间的区别以前，先研究它们的共性是非常重要的。我们先看看游戏如 何追踪吃豆人和这四只鬼的位置。我们把可见的游戏屏幕当成一个正方形网格，每个格子边长为8像素。屏幕的实际像素是224 x 288，所以按8像素划分，就得到了一个由28 x 36 个贴图组成的网格。
上图显示的是，透明的红色鬼在合法区域中从左到右沿着一行贴图移动。在第一帧中，它占用的贴图（显示为亮红色）更靠近图的左侧。鬼的有些图像没有在贴图上并不重要—— 重要的是，这只鬼的中心点在贴图上。在第二帧，它的中心点已经移动到下一张贴图的右边了，它占用的贴图也相应地更新了。这只鬼继续移动，直到第六帧，它的中心点现在已 经移到下一个贴图中了。
贴图的深层概念对于理解鬼的寻径逻辑是必须的，因为它只关心角色所占用的贴图——而不是它在这个贴图上的像素位置。对于这种逻辑性常规，这五个角色看起都非常相像，如 下图所示。每个角色都是由它当前占用的贴图和它的当前移动方向定义的。角色之间的距离也是按贴图计算的（游戏邦注：比如，粉色鬼在水平上与吃豆人相距5个贴图，在竖直上 相距1个贴图）。
《吃豆人》发布不久后，玩家当中开始传言，偶尔可以看到吃豆人直接穿过鬼而不受伤。这个传言是完全真实的，毕竟大部多资深《吃豆人》玩家都可以证实它。如果你玩这款游 戏玩得够久，你最终会看到吃豆人撞上鬼却毫发无伤地出现在另一边——这种现象并不经常发生，所以当发生时就好好享受一下吧！有些玩家甚至在自己的模式中考虑到了这种神 秘的“穿过”概率。
这种现象产生的根源在于，游戏检测吃豆人和四只鬼的碰撞的方法。任何时候吃豆人与鬼占用相同的一个贴图时，游戏总是判定是吃豆人撞上鬼，然后玩家损失一条命。是鬼移动 到吃豆人占用的贴图上还是吃豆人移动到鬼占用的贴图上，并不重要——反正这两种情况的结果是一样的。对于处理游戏99%的时间的碰撞，这种逻辑已经够用了，但它没有考虑到 一种非常特殊的情况：
上图显示的是产生这种特殊情况的必要条件。上排的五个相邻帧显示了Blinky鬼和吃豆人互相穿过。下排的帧用它们当前占用的贴图和它们的中心点的像素位置来表现相同的情景 。吃豆人和鬼正好处于一个导致它们供销社交换贴图的位置和速度。换句话说，吃豆人的中心点向上移动到鬼的贴图，而鬼的中心点向下移动到吃豆人的贴图，二者的速度是相同 的，导致它们穿过对方，游戏却没有检测到碰撞。注意，从上排帧看，吃豆人的原来位置是在第四帧的贴图的边缘；从下排帧看，这仍然被认为是在贴图的内部，但向上多移动1像 素就会使它占用下一个贴图的边缘。吃豆人和鬼在第五帧时互换贴图，吃豆人可以继续它的愉快旅程，因为它没有被“撞上”鬼（即与鬼共享贴图）！
在追击模式或分散模式中，鬼总是试图达到屏幕上或（屏幕外）的“目标贴图”。所谓的目标贴图是指鬼在任何时刻都企图占用的贴图。这个贴图可以是固定的，也可以经常变化 。例如，当鬼分散到屏幕到迷官的角落时，各个鬼都希望达到最接近它的“据点”角落的固定的目标贴图。在追击模式时，这个目标贴图通常（但不总是）与吃豆人当前占据的贴 图有关。尽管可能一开始不明显，但追击模式和分散模式之间的唯一区别就是它的目标贴图所在的地方不同。而两种模式使用的寻径逻辑是一样的。
当鬼看到下一个贴图时，它必须考虑这个贴图的可能出口，以决定往哪个方向走。在下图中，红鬼已经达到贴图A，正在由右向左移动。它立即向前看到贴图B（沿着前进方向的下 一个贴图）。每个贴图都有四个可能的出口：右、左、上和下。对于贴图B，上和下出品被墙阻挡了，所以不能作为潜在的出口来考虑。右出口也不用考虑，因为它只能把鬼再次带 回贴图A，而鬼是永远不会自动反向的。这样，贴图B的的四个可能出口中就只能选择左出口了。
在上图的左半图中，红鬼已经达到贴图A，正在寻找它的目标（表示为绿色贴图）。沿着当前方向，它立即看到下一个贴图。在这个例子中，那个贴图是一个十字路口。因为这个路 口贴图的四个出口都没有被墙挡住，所以除了反向出口（下）不能选，还有三个出口可以走。鬼把十字路口的三个方向的第一个贴图选为“测试贴图”（游戏邦注：在图中用虚线 框中的贴图）。在上图中间，鬼把这三线贴图和目标贴图之间作三角流量，找到距离目标最近的贴图，就是鬼的前进方向。在这个例子中，右边的测试贴图距离目标最近，所以鬼 相应地选择它作为前进方向。
有时候，鬼会遇到两个与目标距离相等的测试贴图。在下图所示的例子中，红鬼必须在向下或向左之间作选择。不幸的是，两个测试贴图与目标（左上角的贴图）距离相等。为了 解决这个问题，鬼会按上、左、下、右的顺序选择方向。上是最优先的方向，右是最末的方向。因此，图中的鬼会选择向左走，因为左的优先级比下高。尽管这对人来说，向下走 显然是更好的选择，但鬼没有人那么聪明。它们不可能向前看到那么多个贴图，所以，它们自然无法意识到这两个选择之间的差异。
在分散模式中，每只鬼都有一个固定的目标贴图。下图显示的是四只鬼在分散模式中的各自目标的物理位置（目标与鬼的颜色相对应）。注意，各个目标贴图都在死亡区域，所以 鬼是不可能到达的。这导致各只鬼朝着迷宫的角落前进，因为那是最接近各自目标的地方，然后在这个角落绕圈直到出现亲的的模式变化。这就是分散模式的真相。鬼在迷宫中有 一个“最爱的角落”的唯一原因就是，固定的目标贴图在它永远达不到的位置。
关卡开始时，所有鬼的移动速度都是一样的，但Blinky的速度会根据迷宫里剩下的圆点的数量，每一回合速度翻一倍。当红鬼处于这种加速的状态时，就会被玩家叫作“Cruise Elroy”，但似乎没有人知道这个叫法是怎么来的或者它是什么意思。比如在第一关，当迷宫中只剩下20个圆点时，Blinky就会变成Elroy，且移动速度会变得至少和吃豆人一样快 。更重要的是，它的分散模式行为在这时也会被修改，即把吃豆人的当前贴图当作自己的固定目标贴图，无论这个关卡中的剩余分散周期是多少（当进入/退出分散周期时，它仍然 反转方向）。这导致Elroy继续追击吃豆人，而其他三只鬼还是像平常一样朝自己的角落前进。其实那还不算最坏的情况，当只剩下10个圆点时，Elroy会再次提速，这样就比吃豆 人移动得还快了。随着关卡进展，即使当前剩下的圆点比前一关卡中的多，Blinky也会变成Elroy。下表显示了Elroy在每个关卡中变化的圆点计数和速度：
如果吃豆人被杀死，确定Blinky变成Elroy就更复杂了。当吃豆人死亡时，鬼和吃豆人就会被重置到起始位置；当继续玩时，Blinky的“Cruise Elroy”能力就被暂时闲置，直到橙 鬼（Clyde）不再鬼屋里上下跳，朝着门口移动。直到这时，Blinky的速度和分散行为会保持正常状态，不管迷宫里还剩下多少圆点。一旦这个临时限制结束，Blinky就会根据圆点 当前计数重新改变它的行为。
如果吃豆人向左移动，Pinky的目标贴图就是向左距离吃豆人当前贴图四个贴图的地方。如果吃豆人向右移动，Pinky的目标就是相应地改成右边。如果吃豆人向下移动，那么粉鬼 的目标誻 下向距离吃豆人四个贴图的地方。如果吃豆人向上移动，Pinky的目标就是向上和向左距离吃豆人四张贴图的地方。之所以产生这个有趣的结果是因为计算Pinky朝吃豆人 移动的逻辑代码有一个小错误。这部分代码对于其他三种情况来说是运行正常的，但当吃豆人向上移动时，就会触发一个误把向左移动计算在内的漏洞（Inky的逻辑也存在这个问 题）。Don Hodges的网站上有一篇好文章从代码的角度详尽地分析了这个漏洞，还提供了源代码和解决方案。
因为它的定位逻辑，Pinky成为最容易对付的鬼。通过改变方向，你就可以操纵它的下一步行动（如上图所示）。如果你面朝Pinky很近，它在撞上你之前就会转向。这是因为吃豆 人距离Pinky太近，而Pinky现在的目标贴图在它的后面。在上图中，Pinky选择向上移动，因为向左移动会使它离目标贴图更远。有一种叫作“假转向”的技术，即玩家抖动控制杆 导致吃豆人迅速改变方向，使鬼也随之改变方向。事实上，抖动是不必要的，当面临十字路口时，在Pinky决定走哪个方向以前快速反转方向就能把它甩掉了。
Inky：蓝鬼的个性被形容为“害羞的”。在日本语中，玩家用“kimagure”形容它，意思是“变幻无常的、情绪化的或脾气不稳定的”。Inky显然是四只鬼中最难预测的。有时候 ，它会像Blinky一样疯狂地追击吃豆人，有时候它会像Pinky一样跳到玩家前面，有时候它甚至会像Clyde一样漫步闲逛！事实上，Inky可能是所有鬼中最危险的一只，因为它的行 为太没有规律可循了。“害羞的”并没有翻译出“kimagure”的意思，反而误导玩家以为Inky见到吃豆人时会害羞地跑开，但这种情况并不总是发生。
在追击模式中，蓝鬼使用的定位方式是四只鬼中最复杂的。它需要吃豆人的当前贴图/方向和Blinky的当前贴图来计算它的最终目标。为了确定Inky的目标，我们必须首先找到在吃 豆人前进方向平移两个贴图（在上图中用绿色框出来的贴图）的贴图。现在想象一下，在红鬼的当前贴图的中心到平移贴图的中心之间画一个矢量，然后把这个矢量的长度翻一倍 ，使之超过位移贴图。新的、延展的矢量所指的贴图就是Inky的目标。
Clyde：橙鬼的个性是“迟钝的”。在日本语中，他的个性被形容为“otoboke”，意思是“假装无知”，它的昵称是“Guzuta”，意思是“掉队的人”。事实上，Clyde的移动速度 与Inky和Pinky是一样的，所以他的个性描述也有点儿误导玩家。它是最后一个出现的鬼，它与其他鬼的显著区别是，它对吃豆人表现得很害羞，当它没有在自己的角落里巡逻时， 它就自顾自地玩。尽管没有像其他三种鬼那么危险，但他的行为有时候似乎也很难预测，所以仍然应该觉得它是危险的。
在追击模式中，Clyde的定位逻辑是根据它与吃豆人的接近程度变化的（在上图表现为绿色贴图）。它首先计算它的贴图和吃豆人的贴图之间的几何距离。如果二者之间的距离是8 个或以上贴图，那么Clyde就与Blinky一样，把吃豆人所在的贴图当作目标。如果二者之间的距离少于8个贴图，那么Clyde就会像处于分散模式一样，朝着角落前进，直到它与吃豆 人的距离拉开到8个或以上贴图。在上图中，因为这种定位逻辑，Clyde困在一个无限循环中（只要吃豆人一直处于那个位置）。虽然占用虚线边界外的任意贴图，Clyde的目标是吃 豆人。在进入这个区域时，Clyde改变主意朝着他在分散模式下的目标前进。一旦它退出那个边界，他的目标就会再次变回吃豆人的当前贴图。结果是，Clyde会一直转圈，直到吃 豆人移动到其他地方或模式发生变化。一旦你理解它的定位方式，你很容易就能避开Clyde。只要记住：如果你挡住它回到角落的路或它到达十字路口为了避开你，你却挡住了它的 路，它就仍然是危险的。
《吃豆人》是一款没有结局的游戏。Namco的开发者错误地认为提高游戏难度就足以阻止任何人无限期地玩游戏。当然，在《吃豆人》发行后的几年里，玩家已经发现21关卡之后的 每一个关卡几乎都是相同的。对于那些通过了前面20个关卡的玩家来说，剩下的游戏将成为一种耐力测试，即检测你在失去关注力并犯错前能够赚的多少点数。甚至出现过上百万 的高分，而大多数玩家也认为游戏将永远持续下去。最终，少数高技能玩家能够完成255个连续的游戏关卡（花费好几个小时获得300多万个点数），并发现等待他们的还有第256个 关卡。这是没人知道的意外结果—-甚至连Namco的开发者也不清楚。
第256个关卡呈现出了迷宫的左半部分，而右半部分是由随机颜色的字母，数字和符号所组合而成。我们可以注意到屏幕右下方的奖励计数器也不能正常工作。迷宫左半部分正常运 行着，而右半部分却不是如此。尽管玩家和幽灵都能穿越屏幕的右半部分，但是最初的迷宫墙将不再可行。相反地，玩家必须在幽灵的追赶下将吃豆人引向一系列让人困惑的开放 领域，隧道，单行交叉路口，单面墙以及所有看不见的领域。
为什么会出现这一分裂的关卡？罪魁祸首是沿着屏幕下方绘制奖励符号的程序。情况是：当玩家到达第256个关卡时，内部关卡计时器将提升到255（关卡计数器一开始是0），这时 候绘制奖励符号的程序会被调用。程序加载现在的关卡计数器值（255）到CPU寄存器并在这一寄存器中增加1个数值。不幸的是，255是适应Z-80CPU寄存器单字节的最大数值，所以 当数值提升时，溢出的内容将被舍弃，并在寄存器中留下0而不是我们所期望的256。这个0数值将让程序误以为这是早前的关卡，因为它低于7。程序将把这一误解的寄存器当成一 个计数器去绘制奖励符号。在每次绘制循环最后，寄存器都会减少一个数值，然后检查是否等于0（游戏邦注：即表示程序停止绘制符号的标志）。因为寄存器已经拥有数值0，所 以第一次递减将把数值带回255。这将减少寄存器的数值并不断绘制符号，直至寄存器再次回到0，让循环能够运行256次。这便意味着随着图像储存器位置的增加，奖励符号表范围 外的内存位置将被分配到屏幕上。这种半分裂的关卡被玩家叫做“分区屏幕”；而开发者将其称为“乱码画面”。
在屏幕的左半部分有114颗豆子，右半部分有9颗豆子，一个奖励钥匙，总共有6310个分数点。当所有的豆子都被清除时，什么都不会发生。游戏并未考虑到当吃豆人吃掉244颗豆子 时一个关卡便算结束，所以除了让吃豆人挨饿便什么都不会发生。有趣的是，每当吃豆人丧失一个声明，屏幕右半部分的9颗豆子便会重置，并能再次被吃豆人吃进肚子，从而导致 每个额外的生命能够获得额外的90个点数。在最佳场景中（即获得5个额外的生命），玩家最多能够获得6760个点数，但却只能吃掉168颗豆子—-不足以改变关卡，所以我们便会卡 在这里。没有更多豆子能让玩家去吞食了。也没有最终的胜利等着吃豆人，只有半个充满幽灵的迷宫。在所有的这些内容之后游戏会有一个结局，但既不是愉快的结局也不是让人 兴奋的结局。
困住幽灵存在许多方法。最简单的方法便是困住右边的3只重要的幽灵。黄线呈现的是吃豆人从关卡一开始到靠近右下端之间的路线。确切的指令是：一开始向右行走，直到到达一 个蓝色大写之母“N”，然后向下行走，直到到达一个大写字母“F”，然后向右，直到到达一个黄色的“B”，然后再次向下。如果执行妥当，吃豆人将在最后一次转向时撞击到一 堵看不到的墙。现在让我们等等。红色幽灵将最先受困。在几秒后粉色紧随其后。蓝色幽灵将继续自由移动，直至下一个散播模式出现。这时候，它将尝试着到达屏幕右边边缘附 近的位置，与粉色幽灵和红色幽灵一起被困其中。现在，橙色幽灵是唯一能自由行走的（右下方）。Clyde并不是真正的威胁，然而，因为在吃豆人靠近时它会跑向角落，所以让吃 豆人能够更轻松地清除所有豆子。要小心迷宫左下方的角落—-橙色幽灵还没有离开，随时有可能对你发动攻击。
一些版本的《吃豆人》ROM带有一个“实验台”功能，即让橱柜的拥有者能够随时略过它而前往下一个关卡。到现在，唯一能够通过第256个关卡的已知方法是使用这些机器中的实 验台。结果便是游戏会循环回第一个面板，但伴随着完整的分数并且幽灵仍然能够发挥作用，尽管这是在第21个关卡或更高。许多《吃豆人》ROM能够伴随着MAME模拟器进行使用， 并且也带有这种实验台功能，让我们能够给更轻松地做到这些，而无需使用街机版本去创造这种分离屏幕。
几十年来，世界各地的《吃豆人》粉丝都听过有关一个能让玩家无需使用实验台便度过第256个关卡的“秘诀”。一些玩家夸口说自己已经掌握了这一秘诀，但却没人真正去证实它 。在街机游戏社区中，这便成了一个大热门话题，而不相信有人能够做到这点的Billy Mitchell甚至宣称会给通过第256个关卡的首位玩家10万美元的奖励。但现在还没有人能够拿 到这笔钱。
尽管有证据证明存在通过第256个关卡的方法，但在经典的游戏论坛上却仍存在各种谣言，也没人能够基于无可厚非的证据去支持自己的言论。我们很难想象为什么那些可以通过这 个关卡的人却并未获得Mitchell的奖金。也许这只是人的天性，即宁愿相信可能性的存在—-就像相信圣诞老人或复活节兔子的存在那样。也许也有一些中年《吃豆人》忠实粉丝为 了让自己好受点而抵制着一个30年的娱乐设备的秘密。这是一种很奇怪的现象。你必须学会进行判断。
The Pac-Man Dossier
by Jamey Pittman
Welcome to The Pac-Man Dossier! This web page is dedicated to providing Pac-Man players of all skill levels with the most complete and detailed study of the game possible. New discoveries found during the research for this page have allowed for the clearest view yet of the actual ghost behavior and pathfinding logic used by the game. Laid out in hyperlinked chapters and sections, the dossier is easy to navigate using the Table of Contents below, or you can read it
in linear fashion from top-to-bottom. Chapter 1 is purely the backstory of Namco and Pac-Man’s designer, Toru Iwatani, chronicling the development cycle and release of the arcade classic. If you want to get right to the technical portions of the document, however, feel free to skip ahead to Chapter 2 and start reading there. Chapter 3 and Chapter 4 are dedicated to explaining pathfinding logic and discussions of unique ghost behavior. Chapter 5 is dedicated to the
“split screen” level, and several Appendices follow, offering reference tables, an easter egg, vintage guides, a glossary, and more. Lastly, if you are unable to find what you’re looking for or something seems unclear in the text, please feel free to contact meand ask!
If you enjoy the information presented on this website, please consider contributing a small donation to support it and defray the time/maintenance costs associated with keeping it online and updated. Donations can be made safely and securely via PayPal by clicking the “Donate” button below. You can also make a small contribution (at no cost to you whatsoever) by simply clicking on one or more of the advertisement banners. Your support is greatly appreciated!
In 1999, Billy Mitchell of Hollywood, Florida became the first person to obtain a perfect score of 3,333,360 at Pac-Man, eating every possible dot, energizer, ghost, and bonus on every level without losing a single life in the process. But perhaps what is most amazing is the fact he can play without using any memorized routines widely known as “patterns”. Instead, he relies on his familiarity with how each ghost behaves as it moves through the maze, using that knowledge to keep Pac-Man one step ahead of his enemies at all times.
Unlike Mitchell, most players are only able to rack up high scores with the aid of multiple patterns that take advantage of the game’s deterministic nature. These patterns require perfect memorization and recall to be of any real use—a single hesitation or wrong turn during execution can make the remainder of a pattern useless. Not surprisingly, an over-reliance on these routines leaves many a player clueless as to how to effectively avoid the ghosts and finish off the remaining dots in the higher levels once a mistake occurs.
Most Pac-Man strategy guides available online today are very similar in content to the books that were sold back in the early 80s: a summary of gameplay and scoring is provided first, followed by a list of patterns to be memorized by the reader, but very little insight is offered on how the game works or how the ghosts make decisions. Therefore, the purpose of this guide is to give the player a better understanding of Pac-Man without the use of patterns by taking a closer look at gameplay, maze logic, ghost personalities, and the mysterious “split screen” level. I can’t promise that you’ll play as well as Billy Mitchell after reading this guide, but you will definitely feel much better about recovering from a mistake in your ninth key pattern once you have a good understanding of how the ghosts “think”.
All information provided has been extracted from or verified with disassembly output from the original Pac-Man code ROMs in conjunction with extensive testing and observations made during gameplay. As such, I am highly confident in the accuracy of this document. That being said, if you notice an error or omission, please contact me at firstname.lastname@example.org so it can be corrected as soon as possible. Hopefully you will find this material as interesting and useful as I did for gaining a better understanding of this classic arcade title.
Special thanks to Don Hodges (www.donhodges.com) whose invaluable contributions to this guide can be found in every chapter.
Welcome To The Machine
“I don’t have any particular interest in [computers]. I’m interested in creating images that communicate with people. A computer is not the only medium that uses images; I could use the movies or television or any other visual medium. It just so happens I use the computer.”—Toru IwataniIt was 1977 when a self-taught, capable young man named Toru Iwatani came to work for Namco Limited, a Tokyo-based amusement manufacturer whose main product lines at the time were projection-based amusement rides and light gun shooting galleries. He was just 22 years old with no formal training in computers, visual arts, or graphic design, but his creativity and aptitude for game design were obvious to the Namco executives that met with Iwatani. They offered to hire him—with assurances they would find a place for him in the company—and he accepted.
Iwatani eventually found his place designing titles for Namco’s new video games division. His limited computer skills necessitated his being paired with a programmer who would write the actual code while Iwatani took on the role of game designer for the project. This was a new job for the game industry in 1977 when most games were designed by the programmers who coded them. In addition to a programmer, Iwatani’s team would usually include a hardware engineer to develop the various devices and components, a graphic artist to realize his visual ideas, and a music composer for any music and sound effects needed in the game.
Iwatani had initially wanted to work on pinball machines, but Namco had no interest in the pinball business. Perhaps as a concession, his first game design, called Gee Bee, was a paddle game similar to Atari’s Breakout but with a decidedly pinball-inspired slant to the gameplay. Released in 1978, it was Namco’s first original video game—they had only ported existing Atari games to the Japanese market up to this point—and it enjoyed moderate success in the arcades.
But the paddle games were losing ground fast to a new genre. The unprecedented success of Taito’s Space Invaders in 1978 caused an industry-wide shift toward space-themed, shoot-’em-up games (as well as a national coin shortage in Japan). Game manufacturers scrambled to match Taito’s success with space shooters of their own. Namco was quick to follow suit, assigning a team to start work on a Space Invaders clone at once. It was around this time that Toru
Iwatani began thinking about designing a different kind of game. He felt the shoot-’em-up craze was destined to fade away like the paddle games before them. Rather than make another space shooter, Toru wanted to take his game design in a completely new direction that did not focus on violence or conflict, and would appeal to both male and female audiences.
He took inspiration from a children’s story about a creature that protected children from monsters by eating them. One of Iwatani’s design methods included taking key words associated with a story to aid in developing his ideas. The kanji word taberu (“to eat”), became the premise for the game. The word kuchi (“mouth”) has a square shape for its kanji symbol and provided the inspiration for the game’s main character—the better-known legend of Iwatani receiving
his inspiration from a pizza pie with a slice missing was, by his own admission, not entirely correct:
“Well, it’s half true. In Japanese the character for mouth (kuchi) is a square shape. It’s not circular like the pizza, but I decided to round it out. There was the temptation to make the Pac-Man shape less simple. While I was designing this game, someone suggested we add eyes. But we eventually discarded that idea because once we added eyes, we would want to add glasses and maybe a moustache. There would just be no end to it. Food is the other part of the basic concept. In my initial design, I had put the player in the midst of food all over the screen. As I thought about it, I realized the player wouldn’t know exactly what to do: the purpose of the game would be obscure. So I created a maze and put the food in it. Then whoever played the game would have some structure by moving through the maze. The Japanese have a slang word—paku paku—they use to describe the motion of the mouth opening and closing while one eats. The name Puck-Man came from that word.”
The monsters from the children’s story were included as four ghosts that chase the player through the maze, providing an element of tension. Attacks on the player were designed to come in waves (similar to Space Invaders) as opposed to an endless assault, and each ghost was given an unique personality and character. The children’s story also included the concept of kokoro (“spirit”) or a life force used by the creature that allowed him to eat the monsters. Toru incorporated this aspect of the story as four edible power pellets in the maze that turn the tables on the ghosts, making them vulnerable to being eaten by the player.
With a name and a basic design in place, Iwatani was ready to begin work. The team Namco assigned Iwatani to bring Puck-Man to life included a programmer (Shigeo Funaki), a hardware engineer, a cabinet designer, and a music composer (Toshio Kai). Development got underway in early 1979. In the course of that year, two new pinball-themed designs from Iwatani—Bomb Bee and Cutie Q—were both released during Puck-Man’s development cycle. Both games were similar to Gee Bee but with stronger gameplay and improved visuals.
The Namco team working on the Space Invaders clone for the past several months had just achieved a technological coup for Namco: the first game to use a true, multi-colored, RGB display instead of the monochrome monitors with colored cellophane tape so prevalent at the time. Thanks to the breakthrough of the other team, Iwatani now had the new promise of color to enhance his design. Mindful that he wanted the game to appeal to women, he immediately decided to use it on the ghosts, choosing pastel shades for the bodies and adding expressive, blue eyes. Dark blue was used for the maze itself, while Puck-Man was drenched in a brilliant yellow.
The look and feel of Puck-Man continued to evolve for over a year. A large amount of time and effort was put into developing the ghosts unique movement patterns through the maze and tweaking the game difficulty variables as boards were cleared. Bonus symbols (including the Galaxian flagship) were added into the mix at some point, and the ghosts were finally given names: Akabei, Pinky, Aosuke, and Guzuta. Sound effects and music were some of the final touches
added as development neared an end along with constant tweaking of the ghosts’ behavior.
Puck-Man’s creation was a year and five months in the making—the longest ever for a video game to that point. Finally, on May 22nd, 1980, it was released to arcades in Japan. Initially, the game did moderately well, but was no overnight sensation. In fact, Namco’s multi-colored Space Invaders clone, called Galaxian, was much more popular with the gaming public—the predominately male, game-playing audience in Japan was unsure what to make of Puck-Man with its
cartoon-like characters, maze, and pastel colors, whereas Galaxian was more immediately familiar to them with its shoot-’em-up space theme.
Midway was a distributor of coin-operated video games in the U.S. that was always looking for the next big hit from Japan to license and bring to America. They opted for both Puck-Man and Galaxian, modifying the cabinets and artwork to make them easier to manufacture as well as providing a more American look and feel.
Puck-Man went through the majority of the changes: the cabinet was modified slightly, changing the color from white to a bright yellow to make it stand out in the arcade. The detailed, multi-colored cabinet artwork was replaced with cheaper-to-produce, three-color artwork illustrating an iconic representation of Puck-Man (now drawn with eyes and feet) and one blue ghost. English names were given to the ghosts (Blinky, Pinky, Inky, and Clyde), and the Namco title was changed to Midway. The most significant change to Puck-Man was the name. Midway feared it would be too easy for nasty-minded vandals to change the P in Puck-Man to an F, creating an unsavory epithet. Not wanting their product associated with this word, Midway renamed the game Pac-Man before releasing it to American arcades in October 1980.
But the situation in America was reversed from Japan for these two titles. Galaxian got lost in the shuffle of the shoot-’em-up craze that blanketed America ’s arcades and, by the fall of 1980, it was already competing with more advanced video games like Defender. In the end, Galaxian enjoyed moderate success in America and in Japan, but was never the smash hit the original Space Invaders was. Pac-Man was another story. There were no games to compare it to—it was in a genre all by itself. The bright yellow cabinet, visuals, and sounds drew a great deal of attention. No one had seen a game quite like this before. The addictive gameplay and challenge of increasing levels of difficulty kept the die-hard gamers more than happy, while the simplicity of the game appealed to younger children. The lack of war-like motifs and violence did as Iwatani had hoped and attracted a sizable female audience—a first for a video game. Even
the parents wary of the violence-themed arcade games had no problem with their kids playing as cute and innocuous a game as Pac-Man.
Pac-Man went on to capture the world’s imagination like nothing before or since. It was a genuine phenomenon on a global scale, selling over 100,000 machines in its first year alone. Easy to learn but notoriously difficult to master, everyone from school children to Wall Street executives dropped quarter after quarter into an ever-increasing number of waiting Pac-Man machines. By 1982, Pac-Man merchandise was literally everywhere: t-shirts, hats, keychains,
wrist bands, bedsheets, air fresheners, wall clocks, drinking glasses, trading cards, stickers, cereal boxes, comic books—even a Saturday morning cartoon. A novelty song called “Pac-Man Fever” received significant radio play, reaching number nine on the U.S. Billboard charts. Many books were written offering tips and tricks used by the best players to achieve high scores—the first-ever strategy guides published for a video game.
More than thirty years later, Pac-Man remains the best-selling coin-operated video game in history. Still considered the most widely-recognized video game character in the U.S., his likeness has been licensed to over 250 companies for over 400 products. His namesake has been adopted by the business world to describe a way to defend against a hostile takeover (the defending company swallows up the larger company instead in a move known as the “Pac-Man
defense”). There is even an upright Pac-Man machine on display at the Smithsonian Institution in Washington, D.C.
Interest in the original coin-op title has never completely faded. Thanks to Namco’s re-release of Pac-Man and other arcade classics for modern home consoles, new generations of Pac-addicts have worn their hands out playing a game often older than themselves. Many classic titles are also kept alive thanks to the advent of high-quality arcade emulators available for the home computer (like MAME) that use a software copy of the arcade ROM chips to recreate the
game with 100% accuracy. Several web pages with information about the original Pac-Man arcade game can be found online including Wikipedia and the Killer List Of Video Games.
“As Pac-Man was originally conceived to appeal to women players, it is a very easy and approachable game. I believe that is an ingredient in the longevity of the game.”—Toru Iwatani, creator of Pac-Man
The premise of Pac-Man is delightfully simple: using a four-way joystick, the player guides Pac-Man—up, down, left, and right—through a maze filled with dots for him to gobble up. Four ghost monsters are also in the maze and chase after our hero, trying to capture and kill him. The goal is to clear the maze of dots while avoiding the deadly ghosts. Each round starts with the ghosts in the “monster pen” at the center of the maze, emerging from it to join in the chase. If Pac-Man is captured by a ghost, a life is lost, the ghosts are returned to their pen, and a new Pac-Man is placed at the starting position before play continues. When the maze is cleared of all dots, the board is reset, and a new round begins. If Pac-Man gets caught by a ghost when he has no extra lives, the game is over.
There are 244 dots in the maze, and Pac-Man must eat them all in order to proceed to the next round. The 240 small dots are worth ten points each, and the four large, flashing dots—best known as energizers—are worth 50 points each. This yields a total of 2,600 points for clearing the maze of dots each round. Players have two ways to increase their score beyond what is earned from eating dots:
The first way to increase your score each round is by turning the tables on your enemies by making them your prey. Whenever Pac-Man eats one of the four energizer dots located in the corners of the maze, the ghosts reverse their direction and, in early levels, turn the same shade of blue for a short period of time before returning to normal. While blue, they are vulnerable to Pac-Man and can be gobbled up for extra points providing they are caught before the time
expires. After being eaten, a ghost’s eyes will return to the monster pen where it is resurrected, exiting to chase Pac-Man once again. The first ghost captured after an energizer has been eaten is always worth 200 points. Each additional ghost captured from the same energizer will then be worth twice as many points as the one before it—400, 800, and 1,600 points, respectively. If all four ghosts are captured at all four energizers, an additional 12,000 points can be earned on these earlier levels. This should not prove too terribly difficult to achieve for the first few rounds as the ghosts initially remain blue for several seconds. Soon after, however, the ghosts’ “blue time” will get reduced to one or two seconds at the most, making it much more problematic to capture all four before time runs out on these boards. By level 19, the ghosts stop turning blue altogether and can no longer be eaten for additional points.
The second way to increase your score each round is by eating the bonus symbols (commonly known as fruit) that appear directly below the monster pen twice each round for additional points. The first bonus fruit appears after 70 dots have been cleared from the maze; the second one appears after 170 dots are cleared. Each fruit is worth anywhere from 100 to 5,000 points, depending on what level the player is currently on. Whenever a fruit appears, the amount of
time it stays on the screen before disappearing is always between nine and ten seconds. The exact duration (i.e., 9.3333 seconds, 10.0 seconds, 9.75 seconds, etc.) is variable and does not become predictable with the use of patterns. In other words, executing the same pattern on the same level twice is no guarantee for how long the bonus fruit will stay onscreen each time. This usually goes unnoticed given that the majority of patterns are designed to eat the bonus fruit as quickly as possible after it has been triggered to appear. The symbols used for the last six rounds completed, plus the current round are also shown along the bottom edge of the screen (often called the fruit counter or level counter). See Table A.1 in the appendices for all bonus fruit and scoring values, per level.
Ghosts have three mutually-exclusive modes of behavior they can be in during play: chase, scatter, and frightened. Each mode has a different objective/goal to be carried out:
CHASE—A ghost’s objective in chase mode is to find and capture Pac-Man by hunting him down through the maze. Each ghost exhibits unique behavior when chasing Pac-Man, giving them their different personalities: Blinky (red) is very aggressive and hard to shake once he gets behind you, Pinky (pink) tends to get in front of you and cut you off, Inky (light blue) is the least predictable of the bunch, and Clyde (orange) seems to do his own thing and stay out of the way.
SCATTER—In scatter mode, the ghosts give up the chase for a few seconds and head for their respective home corners. It is a welcome but brief rest—soon enough, they will revert to chase mode and be after Pac-Man again.
FRIGHTENED—Ghosts enter frightened mode whenever Pac-Man eats one of the four energizers located in the far corners of the maze. During the early levels, the ghosts will all turn dark blue (meaning they are vulnerable) and aimlessly wander the maze for a few seconds. They will flash moments before returning to their previous mode of behavior.
Reversal Of Fortune
In all three modes of behavior, the ghosts are prohibited from reversing their direction of travel. As such, they can only choose between continuing on their current course or turning off to one side or the other at the next intersection. Thus, once a ghost chooses which way to go at a maze intersection, it has no option but to continue forward on that path until the next intersection is reached. Of course, if you’ve spent any time playing Pac-Man, you already know the ghosts will reverse direction at certain times. But how can this be if they are expressly prohibited from doing so on their own? The answer is: when changing modes, the system can override the ghosts’ normal behavior, forcing them to go the opposite way. Whenever this happens, it is a visual indicator of their behavior changing from one mode to another. Ghosts are forced to reverse direction by the system anytime the mode changes from: chase-to-scatter, chase-to-frightened, scatter-to-chase, and scatter-to-frightened. Ghosts do not reverse direction when changing back from frightened to chase or scatter modes.
When the system forces the ghosts to reverse course, they do not necessarily change direction simultaneously; some ghosts may continue forward for a fraction of a second before turning around. The delay between when the system signals a reversal and when a ghost actually responds depends on how long it takes the ghost to enter the next game tile along its present course after the reversal signal is given (more on tiles in Chapter 3). Once the ghost enters a new tile,
it will obey the reversal signal and turn around.
Scatter, Chase, Repeat…
Ghosts alternate between scatter and chase modes during gameplay at predetermined intervals. These mode changes are easy to spot as the ghosts reverse direction when they occur. Scatter modes happen four times per level before the ghosts stay in chase mode indefinitely. Good players will take full advantage of the scatter periods by using the brief moment when the ghosts are not chasing Pac-Man to clear dots from the more dangerous areas of the maze. The
scatter/chase timer gets reset whenever a life is lost or a level is completed. At the start of a level or after losing a life, ghosts emerge from the ghost pen already in the first of the four scatter modes.
For the first four levels, the first two scatter periods last for seven seconds each. They change to five seconds each for level five and beyond. The third scatter mode is always set to five seconds. The fourth scatter period lasts for five seconds on level one, but then is only 1/60th of a second for the rest of play. When this occurs, it appears as a simple reversal of direction by the ghosts. The first and second chase periods last for 20 seconds each. The third chase period is 20 seconds on level one but then balloons to 1,033 seconds for levels two through four, and 1,037 seconds for all levels beyond—lasting over 17 minutes! If the ghosts enter frightened mode, the scatter/chase timer is paused. When time runs out, they return to the mode they were in before being frightened and the scatter/chase timer resumes. This information is summarized in the following table (all values are in seconds):
Whenever Pac-Man eats one of the four energizer dots located near the corners of the board, the ghosts reverse direction and, on earlier levels, go into frightened mode for a short period of time. When frightened, the ghosts all turn the same shade of dark blue and move more slowly than normal. They wander aimlessly through the maze and flash white briefly as a warning before returning to their previous mode of behavior. Ghosts use a pseudo-random number generator (PRNG) to pick a way to turn at each intersection when frightened. The PRNG generates an pseudo-random memory address to read the last few bits from. These bits are translated into the direction a frightened ghost must first try. If the selected direction is not blocked by a wall or opposite the ghost’s current direction of travel, it is accepted. Otherwise, the code proceeds in a clockwise fashion to the next possible direction and tries again, repeating this test until an acceptable direction is found. The PRNG gets reset with the same intial seed value at the start of each new level and whenever a life is lost. This results in frightened ghosts always choosing the same paths when executing patterns during play. As the levels progress, the time ghosts spend in frightened mode grows shorter until eventually they no longer turn blue at all (they still reverse direction, however). Refer to Table A.1 in the appendices for the frightened time in seconds and number of flashes, per level.
The game starts with Pac-Man at 80% of his maximum speed. By the fifth level, Pac-Man is moving at full speed and will continue to do so until the 21st level. At that point, he slows back down to 90% and holds this speed for the remainder of the game. Every time Pac-Man eats a regular dot, he stops moving for one frame (1/60th of a second), slowing his progress by roughly ten percent—just enough for a following ghost to overtake him. Eating an energizer dot causes Pac-Man to stop moving for three frames. The normal speed maintained by the ghosts is a little slower than Pac-Man’s until the 21st level when they start moving faster than he does. If a ghost enters a side tunnel, however, its speed is cut nearly in half. When frightened, ghosts move at a much slower rate of speed than normal and, for levels one through four, Pac-Man also speeds up. The table below summarizes the speed data for both Pac-Man and the ghosts, per level. This information is also contained in Table A.1 in the appendices.
Pac-Man is able to navigate the turns in the maze faster than his enemies. He does not have to wait until he reaches the middle of a turn to change direction as the ghosts do (see picture below). Instead, he may start turning several pixels before he reaches the center of a turn and for several pixels after passing it. Turns taken one or more pixels before reaching the center are “pre-turns”; turns taken one or more pixels after are “post-turns”. Players learn to consistently move the joystick in the direction Pac-Man should go well before arriving at the center of a turn, ensuring each pre-turn is started as many pixels away from center as possible. This technique is known as cornering and is one of the first skills a new Pac-Man player should master. For every successful pre-turn maneuver, Pac-Man puts a little more distance between himself and any ghosts following close behind. Such a small gain in distance may not seem terribly significant at first, but cornering through a quick series of turns will shake off even the most determined pursuer. It is a vital tool for
survival in the higher levels of the game.
Whenever Pac-Man makes a pre-turn or post-turn, his orientation changes, and he starts to move one pixel in his new direction for every pixel traveled in his old direction, effectively doubling his speed as he moves at a 45 degree angle. Once he reaches the centerline of the new direction’s path, he starts moving purely in that direction and his speed returns to normal. The greatest distance advantage is thereby gained by making the earliest pre-turn possible. The
illustration below shows the layout of pre-turn pixels (shown in green), center point pixels (shown in yellow), and post-turn pixels (shown in red) for each of the four possible directions a turn can be approached. Each example shows Pac-Man entering the same four-way intersection from a different direction. When entering from the left, there are three pre-turn pixels before the center of the turn, and four post-turn pixels. Conversely, entering the same intersection
from the right yields four pre-turn pixels and three post-turn ones. Entering from the top as opposed to the bottom exhibits the same property. For any turn that is made later than the earliest possible pre-turn, Pac-Man will be one frame behind where he would be for every pixel of “lateness” in the turn. Basically, it pays to move the joystick well before reaching a turn to maximize your speed.
Turning at the earliest pre-turns possible is also required to successfully execute most any pattern. Patterns are meant to be played with perfect cornering because it removes the human element of uncertainty as to when Pac-Man will turn. Without cornering, it would be nigh-impossible to reproduce the exact timing of every turn as made by the pattern’s author, thereby increasing the possibility of unpredictable ghost behavior due to Pac-Man not being in the exact same tile at the exact same time anymore. Typically, the most popular patterns have been those that tend to “hold together” well when small input timing flaws occur (turning three pixels away from center instead of four when approaching a turn from the right is a timing flaw, for example). Other patterns—especially those that bring Pac-Man very close to the ghosts late in the sequence—tend to “fall apart” unless every turn is perfectly cornered. During a long Pac-Man session, even the best players will make occasional timing mistakes during a fast series of turns and have to deal with the possible
consequences. As such, one should aim for perfect cornering at all times but remain alert for unexpected ghost behavior from subtle input timing flaws creeping into the pattern.
Home Sweet Home
Commonly referred to as the ghost house or monster pen, this cordoned-off area in the center of the maze is the domain of the four ghosts and off-limits to Pac-Man. Whenever a level is completed or a life is lost, the ghosts are returned to their starting positions in and around the ghost house before play continues—Blinky is always located just above and outside, while the other three are placed inside: Inky on the left, Pinky in the middle, and Clyde on the right. The pink door on top is used by the ghosts to enter or exit the house. Once a ghost leaves, however, it cannot reenter unless it is first captured by Pac-Man—then the disembodied eyes can return home to be revived. Since Blinky is already on the outside after a level is completed or a life is lost, the only time he can get inside the ghost house is after Pac-Man captures him, and he immediately turns around to leave once revived. That’s about all there is to know about Blinky’s behavior in terms of the ghost house, but determining when the other three ghosts leave home is an involved process based on several variables and conditions. The rest of this section will deal with them exclusively. Accordingly, any mention of “the ghosts” below refers to Pinky, Inky, and Clyde, but not Blinky.
The first control used to evaluate when the ghosts leave home is a personal counter each ghost retains for tracking the number of dots Pac-Man eats. Each ghost’s “dot counter” is reset to zero when a level begins and can only be active when inside the ghost house, but only one ghost’s counter can be active at any given time regardless of how many ghosts are inside. The order of preference for choosing which ghost’s counter to activate is: Pinky, then Inky, and then Clyde. For every dot Pac-Man eats, the preferred ghost in the house (if any) gets its dot counter increased by one. Each ghost also has a “dot limit” associated with his counter, per level. If the preferred ghost reaches or exceeds his dot limit, it immediately exits the house and its dot counter is deactivated (but not reset). The most-preferred ghost still waiting inside the house (if any) activates its timer at this point and begins counting dots.
Pinky’s dot limit is always set to zero, causing him to leave home immediately when every level begins. For the first level, Inky has a limit of 30 dots, and Clyde has a limit of 60. This results in Pinky exiting immediately which, in turn, activates Inky’s dot counter. His counter must then reach or exceed 30 dots before he can leave the house. Once Inky starts to leave, Clyde’s counter (which is still at zero) is activated and starts counting dots. When his counter reaches or exceeds 60, he may exit. On the second level, Inky’s dot limit is changed from 30 to zero, while Clyde’s is changed from 60 to 50. Inky will exit the house as soon as the level begins from now on. Starting at level three, all the ghosts have a dot limit of zero for the remainder of the game and will leave the ghost house immediately at the start of every level.
Whenever a life is lost, the system disables (but does not reset) the ghosts’ individual dot counters and uses a global dot counter instead. This counter is enabled and reset to zero after a life is lost, counting the number of dots eaten from that point forward. The three ghosts inside the house must wait for this special counter to tell them when to leave. Pinky is released when the counter value is equal to 7 and Inky is released when it equals 17. The only way to deactivate the counter is for Clyde to be inside the house when the counter equals 32; otherwise, it will keep counting dots even after the ghost house is empty. If Clyde is present at the appropriate time, the global counter is reset to zero and deactivated, and the ghosts’ personal dot limits are re-enabled and used as before for determining when to leave the house (including Clyde who is still in the house at this time).
If dot counters were the only control, Pac-Man could simply stop eating dots early on and keep the ghosts trapped inside the house forever. Consequently, a separate timer control was implemented to handle this case by tracking the amount of time elapsed since Pac-Man has last eaten a dot. This timer is always running but gets reset to zero each time a dot is eaten. Anytime Pac-Man avoids eating dots long enough for the timer to reach its limit, the most-preferred ghost waiting in the ghost house (if any) is forced to leave immediately, and the timer is reset to zero. The same order of preference described above is used by this control as well. The game begins with an initial timer limit of four seconds, but lowers to it to three seconds starting with level five.
The more astute reader may have already noticed there is subtle flaw in this system resulting in a way to keep Pinky, Inky, and Clyde inside the ghost house for a very long time after eating them. The trick involves having to sacrifice a life in order to reset and enable the global dot counter, and then making sure Clyde exits the house before that counter is equal to 32. This is accomplished by avoiding eating dots and waiting for the timer limit to force Clyde out. Once Clyde is moving for the exit, start eating dots again until at least 32 dots have been consumed since the life was lost. Now head for an energizer and gobble up some ghosts. Blinky will leave the house immediately as usual, but the other three ghosts will remain “stuck” inside as long as Pac-Man continues eating dots with sufficient frequency as not to trigger the control timer. Why does this happen? The key lies in how the global dot counter works— it cannot be deactivated if Clyde is outside the house when the counter has a value of 32. By letting the timer force Clyde out before 32 dots are eaten, the
global dot counter will keep counting dots instead of deactivating when it reaches 32. Now when the ghosts are eaten by Pac-Man and return home, they will still be using the global dot counter to determine when to leave. As previously described, however, this counter’s logic only checks for three values: 7, 17, and 32, and once those numbers are exceeded, the counter has no way to release the ghosts associated with them. The only control left to release the
ghosts is the timer which can be easily avoided by eating a dot every so often to reset it. Click on the YouTube video below to see a demonstration of this curious behavior:
The last thing to mention about the ghost house is how to determine whether a ghost will move right or left after exiting the home. Ghosts typically move to the left once they get outside, but if the system changes modes one or more times when a ghost is inside, that ghost will move to the right instead of the left upon leaving the house.
Areas To Exploit
The illustration above highlights four special “zones” in the maze where ghost behavior is limited by certain conditions which can be exploited to the player’s advantage. The two red zones represent the areas where ghosts are forbidden to make upward turns. Once a ghost enters either of these two zones, it may only travel from right-to-left or left-to-right until exiting the area. Thus, only Pac-Man has access to these four, upward-facing tunnel entrances. It will serve the player well to remember the ghosts can still access these tunnels from the other end! The red zone restrictions are enforced during both scatter and chase modes, but in frightened mode the red zones are ignored temporarily, allowing the ghosts to turn upwards if they so choose. The pink zones are in the two halves of the connecting side-tunnel. As mentioned previously, any ghost that enters the tunnel will suffer an immediate speed penalty until leaving the zone. This slow-down rule is always enforced and applies to ghosts only—Pac-Man is immune.
We need to take a look at how ghosts are able to move through the maze in pursuit of a goal. All pathfinding logic described in this chapter is shared by the four ghosts—it is important to understand what they have in common before we get into what makes them different. Before we proceed, let’s see how the game tracks the location of Pac-Man and the four ghosts (herein referred to as actors for brevity’s sake). The visible game screen should be thought of as a
regular grid of tiles, each eight pixels square. The actual pixel dimensions of the screen are 224 x 288, so dividing each value by eight yields a grid that is 28 x 36 tiles in size:
Each tile is either in legal space or dead space. In the picture above, legal space is shown as the gray-colored tiles; all other tiles are considered dead space. Actors only travel between the tiles in legal space. Each dot sits in the center of a tile, meaning they are exactly eight pixels (one tile) apart— this is useful for estimating distances during gameplay.
What Tile Am I In?
As the actors move through the maze, the game keeps track of the tile each one occupies. An actor is only associated with a single tile at a time, although its graphic will overlap into the surrounding tiles. The location of the actor’s center point is what determines the tile it occupies at any given time. As the actors can move at pixel-level precision, they are often not centered directly on top of the tile they are in. Consider the following example:
The transparent red ghost is moving left-to-right across a row of tiles in legal space. In frame one, its occupied tile (shown in bright red) is near the left side of the picture. It does not matter that some of the ghost’s graphic is not in the tile—what matters is that the ghost’s center point is in the tile. By frame two, it has moved far enough for its center point to be in the adjacent tile to the right and its occupied tile is updated accordingly. The ghost continues to be associated with the same tile until frame six where its center point has now crossed over into the next one.
The underlying concept of tiles is essential for understanding the ghosts’ pathfinding logic as it only cares about the tile an actor occupies—not its per-pixel location within that tile. To the logic routines, the five actors look very much like the picture below. Each actor is defined by the tile it presently occupies along with its current direction of travel. Distances between actors are also measured in tiles (the pink ghost is five tiles away from Pac-Man horizontally and one tile away vertically, for example).
Just Passing Through
It wasn’t too long after the release of Pac-Man when word began to spread of players occasionally passing straight through a ghost unharmed, seemingly at random. This rumor turned out to be completely true as most die-hard Pac-Man players can attest. If you play the game long enough, you will eventually see Pac-Man run into one of the ghosts and come out unscathed on the other side—it doesn’t happen very often so enjoy it when it does! Some players have even
gone so far as to incorporate this mysterious pass-through oddity into their patterns.
The root cause of this elusive peculiarity lies in the way the game detects collisions between Pac-Man and the four ghosts. Any time Pac-Man occupies the same tile as a ghost, he is considered to have collided with that ghost and a life is lost. It is irrelevant whether the ghost moved into Pac-Man’s tile or Pac-Man into the ghost’s—the result is the same either way. This logic proves sufficient for handling collisions more than 99% of the time during gameplay, but does not account for one very special case:
The above picture illustrates the conditions necessary to produce this curious behavior. There are five consecutive frames showing Blinky and Pac-Man passing through each other. Below each frame is the same scene represented by the tiles they currently occupy and the per-pixel location of their center points. Pac-Man and Blinky are at just the right position and speed relative to one another to cause them to swap tiles with each other simultaneously. In other
words, Pac-Man’s center point moves upwards into Blinky’s tile in the same 1/60th of a second that Blinky’s center point moves downwards into Pac-Man’s tile, resulting in them moving past each other without colliding. Note that Pac-Man’s origin point is centered on the top edge of his tile in frame four; this is still considered to be inside the bottom tile, but moving up one more pixel will push him over the edge into the next one. Pac-Man and Blinky have now swapped tiles with each other in frame five, and Pac-Man can go on his merry way because he never “collided” (i.e., shared the same tile) with Blinky at all! Click on the YouTube video below to see an example of the pass-through bug (it happens 40 seconds after playback begins):
Whenever a ghost is in chase or scatter mode, it is trying to reach a target tile somewhere on (or off) the screen. A target tile is merely a way to describe the tile a ghost would like to occupy at any given moment. This tile can be fixed in place or change location frequently. Whenever the ghosts scatter to the corners of the maze, for example, each ghost is striving to reach a fixed target tile located somewhere near its home corner. In chase mode, the target tile is usually (but not always) related to Pac-Man’s current tile which changes often. Although it may not be obvious at first, the only difference between chase and scatter mode to a ghost is where its target tile s located. The same pathfinding logic applies in either case.
Ghosts are always thinking one step into the future as they move through the maze. Whenever a ghost enters a new tile, it looks ahead to the next tile along its current direction of travel and decides which way it will go when it gets there. When it eventually reaches that tile, it will change its direction of travel to whatever it had decided on a tile beforehand. The process is then repeated, looking ahead into the next tile along its new direction of travel and making its next decision on which way to go.
When a ghost looks ahead into the upcoming tile, it must examine the possible exits from that tile to determine a way to proceed. In the picture below, the red ghost has just arrived at tile A and is moving right-to-left. It immediately looks ahead to tile B (the next tile along its direction of travel). Each tile has four potential exits to be considered: right, left, up, and down. In the case of tile B, the up and down exits are blocked by walls and must be discarded as potential candidates. The right exit is also discounted because it would only take the ghost back to tile A again, and ghosts never voluntarily reverse direction. With three of the four possible exits eliminated from tile B, moving left is the only remaining choice.
This example is the most simple to explain as the ghost has but one way it can legally move. As such, we did not have to worry about where its target tile was located. The majority of game tiles in legal space are similar to this one, but things get more interesting when a ghost approaches a tile with more potential exits to choose from.
When a ghost arrives one tile away from an upcoming intersection, it must choose between several possible directions in which to proceed. Consider the following example:
In the first picture, the red ghost has just reached tile A and is seeking its target (shown as the green tile). It immediately looks ahead to the subsequent tile along its present direction of travel (up). In this case, that tile is a four-way ntersection. As this intersection tile has no walls blocking off any of the exits, the ghost can only discard his reverse direction (down), leaving three exits open for travel. It looks one tile beyond the intersection in each of the three remaining directions, collecting “test tiles” (shown as the tiles with dashed, white lines). In the middle picture, the ghost triangulates the distance from each of these test tiles to its target tile. Whichever direction’s test tile has the shortest distance to the target becomes the direction the ghost will take upon reaching the intersection tile. In this case, the right test tile has the shortest distance to the target, and the ghost updates its chosen direction for the intersection tile accordingly.
Sometimes a ghost is presented with two or more test tiles that have the same distance to the target tile. In the example below, the red ghost must choose between moving down or left at the upcoming intersection tile. Unfortunately, both test tiles have the same distance to the target (bottom left). To break the tie, the ghost prefers directions in this order: up, left, down, right. Up is the most preferred direction; right is the least. Therefore, the ghost chooses to go left at the intersection because left precedes down in the preference list. Although it may seem obvious to a person that going down was the better choice to reach the target, ghosts are not that smart. They cannot see more than a few tiles ahead and, as a consequence, cannot recognize the disparity between these two options.
Fixed Target Tiles
Each ghost has a fixed target tile it tries to reach while in scatter mode. The picture below shows the physical location of the scatter mode targets used by each ghost (matched to each ghost’s color scheme). Notice each target tile is in dead space above or below the actual maze making them impossible for the ghosts to reach. This results in each ghost heading toward the corner of the maze nearest its respective scatter target and then making circles around this area until another mode change occurs. That’s all scatter mode really is. The only reason a ghost has a “favorite corner” of the maze at all is due to the location of a fixed target tile it will never reach.
An additional fixed target tile is employed whenever a ghost is eaten by Pac-Man and its disembodied eyes need to return to the ghost house in the center of the maze. This target is located directly above the left side of the “door” to the ghost house and is shown in the picture below as the green tile.
“First, you’ve got to learn how to control the monsters. See how the red, pink and blue are grouped together? It’s easier to control two monsters than four monsters.”—Chris Ayra, champion Pac-Man player
In the last chapter, we learned how a ghost follows a target tile through the maze. Now we will take a closer look at Blinky, Pinky, Inky, and Clyde to better understand why they behave so differently when in chase mode. They all share the same pathfinding logic for chasing a target tile, so how is it each one behaves differently when following Pac-Man? The answer is delightfully simple: Pac-Man’s tile is not always the target. Every ghost has a distinct method for calculating its target tile in chase mode, resulting in their unique personalities. Some of the ghosts use Pac-Man’s actual tile as the target; others only use it as an intermediate step to find another tile. Sometimes a ghost is targeting a tile that has absolutely nothing to do with Pac-Man at all! Regardless of where a ghost’s target tile is at the time, Pac-Man will still be killed if he gets in that ghost’s way.
Rumor has it Toru Iwatani and his team spent months doing nothing but tweaking and refining the ghost A.I. routines before releasing Pac-Man to the world. Their efforts show in the final product: Itawani’s team created the illusion of complex pathfinding by using very simple logic and very little code.
Blinky: The red ghost’s character is aptly described as that of a shadow and is best-known as “Blinky”. In Japan, his character is represented by the word oikake, which means “to run down or pursue”. Blinky seems to always be the first of the ghosts to track Pac-Man down in the maze. He is by far the most aggressive of the four and will doggedly pursue Pac-Man once behind him.
Of all the ghosts’ targeting schemes for chase mode, Blinky’s is the most simple and direct, using Pac-Man’s current tile as his target. In the pictures above, we can see Blinky’s target tile is the same as Pac-Man’s currently occupied tile. Targeting Pac-Man directly in this way results in a very determined and tenacious ghost who is tough to shake when he’s right behind you.
All ghosts move at the same rate of speed when a level begins, but Blinky will increase his rate of speed twice each round based on the number of dots remaining in the maze (if Pac-Man dies this is not necessarily true – more on this in a moment). While in this accelerated state, Blinky is commonly called “Cruise Elroy”, yet no one seems to know where this custom was originated or what it means. On the first level, for example, Blinky becomes Elroy when there are 20 dots remaining in the maze, accelerating to be at least as fast as Pac-Man. More importantly, his scatter mode behavior is also modified at this time to keep targeting Pac-Man’s current tile in lieu of his typical fixed target tile for any remaining scatter periods in the level (he will still reverse direction when entering/exiting a scatter period). This results in Elroy continuing to chase Pac-Man while the other three ghosts head for their corners as normal. As if that weren’t bad enough, when only 10 dots remain, Elroy speeds up again to the point where he is now moving faster than Pac-Man. As the levels progress, Blinky will turn into Elroy with more dots remaining in the maze than in previous rounds. Refer to Table A.1 in the appendices for dot counts and speeds for both Elroy changes, per level.
Determining when Blinky turns into Elroy can become more complicated if Pac-Man is killed. The ghosts and Pac-Man are reset to their starting positions whenever a life is lost and, when play continues, Blinky’s “Cruise Elroy” abilities are temporarily suspended until the orange ghost (Clyde) stops bouncing up and down inside the ghost house and moves toward the door to exit. Until this happens, Blinky’s speed and scatter behavior will remain normal regardless of the number of dots remaining in the maze. Once this temporary restriction is lifted, however, Blinky will resume changing his behavior based on the dot count.
Pinky: Nicknamed “Pinky”, the pink ghost’s character is described as one who is speedy. In Japan, he is characterized as machibuse, meaning “to perform an ambush”, perhaps because Pinky always seems to be able to get ahead of you and cut you off when you least expect it. He always moves at the same speed as Inky and Clyde, however, which suggests speedy is a poor translation of the more appropriate machibuse. Pinky and Blinky often seem to be working in concert
to box Pac-Man in, leaving him with nowhere to run.
In chase mode, Pinky behaves as he does because he does not target Pac-Man’s tile directly. Instead, he selects an offset four tiles away from Pac-Man in the direction Pac-Man is currently moving (with one exception). The pictures below illustrate the four possible offsets Pinky will use to determine his target tile based on Pac-Man’s orientation:
If Pac-Man is moving left, Pinky’s target tile will be four game tiles to the left of Pac-Man’s current tile. If Pac-Man is moving right, Pinky’s tile will be four tiles to the right. If Pac-Man is moving down, Pinky’s target is four tiles below. Finally, if Pac-Man is moving up, Pinky’s target tile will be four tiles up and four tiles to the left. This interesting outcome is due to subtle error in the logic code that calculates Pinky’s offset from Pac- Man. This piece of code works properly for the other three cases but, when Pac-Man is moving upwards, triggers an overflow bug that mistakenly includes a
left offset equal in distance to the expected up offset (we will see this same issue in Inky’s logic later). Don Hodges’ website has an excellent article giving a thorough, code-level analysis of this bug, including the source code and a proposed fix—click here to go there now.
Pinky is the easiest ghost to exert control over thanks to his targeting scheme. By changing direction, you can dictate where Pinky will turn next when he is nearby (see above picture). If you are facing off closely with Pinky, he will turn before he reaches you if he can. This happens due to the fact Pac-Man has come close enough to Pinky for Pinky’s target tile to now be behind him. In the picture above, Pinky chooses to turn up at the intersection because moving left would have taken him further away from his target tile. The longest-lived example of this is the technique known as “head faking”. This is where the player shakes the joystick to cause Pac-Man to rapidly change direction back and forth, hopefully causing a ghost to change course in the process. As it turns out, the shaking is not necessary—one well-timed, quick reversal of direction towards Pinky just before he decides what to do at an upcoming intersection is all that is needed to get him off your tail.
Inky: The light-blue ghost is nicknamed “Inky” and his character is described as one who is bashful. In Japan, he is portrayed as kimagure, meaning “a fickle, moody, or uneven temper”. Perhaps not surprisingly, Inky is the least predictable of the ghosts. Sometimes he chases Pac-Man aggressively like Blinky; other times he jumps ahead of Pac-Man as Pinky would. He might even wander off like Clyde on occasion! In fact, Inky may be the most dangerous ghost of all due to his erratic behavior. Bashful is not a very good translation of kimagure, and misleads the player to assume Inky will shy away from Pac-Man when he gets close which is not always the case.
Inky uses the most complex targeting scheme of the four ghosts in chase mode. He needs Pac-Man’s current tile/orientation and Blinky’s current tile to calculate his final target. To determine Inky’s target, we must first establish an intermediate offset two tiles in front of Pac-Man in the direction he is moving (represented by the tile bracketed in green above). Now imagine drawing a vector from the center of the red ghost’s current tile to the center of the
offset tile, then double the vector length by extending it out just as far again beyond the offset tile. The tile this new, extendend vector points to is Inky’s actual target as shown above.
For the same reasons already discussed in Pinky’s case, an overflow error occurs with the intermediate offset tile generated for Inky’s calculation when Pac-Man is moving up resulting in an offset tile that is two tiles above and two tiles to the left (see above picture). The other three orientations (left, right, down) produce the expected result of an offset two tiles in front of Pac-Man in the direction he is moving.
Inky’s targeting logic will keep him away from Pac-Man when Blinky is far away from Pac-Man, but as Blinky draws closer, so will Inky’s target tile. This explains why Inky’s behavior seems more variable as Pac-Man moves away from Blinky. Like Pinky, Inky’s course can often be altered by Pac-Man changing direction or “head-faking”. How much or how little effect this will have on Inky’s decisions is directly related to where Blinky is at the time.
Clyde: The orange ghost is nicknamed “Clyde” and is characterized as one who is pokey. In Japan, his character is described as otoboke, meaning “pretending ignorance”, and his nickname is “Guzuta”, meaning “one who lags behind”. In reality, Clyde moves at the same speed as Inky and Pinky so his character description is a bit misleading. Clyde is the last ghost to leave the pen and tends to separate himself from the other ghosts by shying away from Pac-Man and doing his own thing when he isn’t patrolling his corner of the maze. Although not nearly as dangerous as the other three ghosts, his behavior can seem unpredictable at times and should still be considered a threat.
During chase mode, Clyde’s targeting logic changes based on his proximity to Pac-Man (represented by the green target tile above). He first calculates the Euclidean distance between his tile and Pac-Man’s tile. If the distance between them is eight tiles or more, Clyde targets Pac-Man directly just as Blinky does. If the distance between them is less than eight tiles, however, Clyde switches his target to the tile he normally uses during scatter mode and heads for his corner until he gets far enough away to start targeting Pac-Man again. In the picture above, Clyde is stuck in an endless loop (as long as Pac-Man stays where he is) thanks to this scheme. While occupying any tile completely outside the dashed perimeter, Clyde’s target is Pac-Man. Upon entering the area, Clyde changes his mind and heads for his scatter target instead. Once he exits the perimeter, his target will change back to Pac-Man’s current tile again. The end result is Clyde circling around and around until Pac-Man moves elsewhere or a mode change occurs. Clyde is fairly easy to avoid once you understand his targeting scheme. Just remember: he is still dangerous if you manage to get in his way as he runs back to his corner or before he can reach an intersection to turn away from you.
Pac-Man was always meant to be a game with no ending. The developers at Namco mistakenly assumed the game’s increasing difficulty was sufficient to prevent anyone from playing indefinitely. Of course, within a few years of Pac-Man’s release, players had discovered that every level beyond the 21st was identical. Patterns were quickly created to exploit this fact and, for any player able to get past the first 20 levels, the game now became a test of endurance to see
how many points you could rack up before losing focus and making a mistake. High scores soared into the millions and most players agreed the game simply went on forever. Eventually, a few highly-skilled players were able to complete 255 consecutive levels of play (scoring over three million points and taking several hours to accomplish) and found a surprise waiting for them on level 256. It was a surprise no one knew about—not even the developers at Namco.
The 256th level displays the left half of the maze correctly, but the right half is a jumbled mess of randomly colored letters, numbers, and symbols. Notice the bonus counter in the lower-right of the screen is also malfunctioning. The left side of the maze plays normally, but the right side is a different story. Although both the player and the ghosts can navigate through the right half of the screen, the original maze walls no longer apply. Instead, Pac-Man must be
guided through a confusing series of open areas, tunnels, one-way intersections, lone walls, and pass-throughs—all invisible to the player—while four ghosts are in hot pursuit.
Why does this broken level happen in the first place? The culprit is the routine responsible for drawing the bonus symbols along the bottom edge of the screen. Here’s what happens: when level 256 is reached, the internal level counter is incremented to 255 (the level counter starts at zero – not one) and the routine for drawing the bonus symbols is called. The routine loads the current level counter value (255) into a CPU register and increments that register by one. Unfortunately, 255 is the largest number that can fit in a single byte which is the size of the Z-80 CPU registers, so when the value is incremented the overflow is discarded leaving a zero in the register instead of the expected value of 256. This zero value leads the routine to believe this is an early level since its value is less than seven. The routine starts drawing onus symbols using the confused register as a counter. At the end of every drawing loop, the register is decreased by one and then checked to see if it is zero (the signal for the routine to stop drawing symbols). Since the register already has a zero in it to start, the first decrement will roll the value back to 255. It will keep decrementing the register and drawing symbols until the register is reduced to zero again, causing the loop to run a total of 256 times. This means that memory locations outside the bounds of the bonus symbol table are drawn to the screen at increasing locations in video memory. This half-broken level was named the “split screen” by players; developers refer to it as a “
kill screen”. Don Hodges’ website has an in-depth article analyzing this bug that includes source code and a proposed fix—click here to go there now.Playing The Level
There are 114 dots on the left half of the screen, nine dots on the right, and one bonus key, totaling 6,310 points. When all of the dots have been cleared, nothing happens. The game does not consider a level to be completed until 244 dots have been eaten, so there is nothing left to do but sacrifice Pac-Man to a hungry ghost. Interestingly, every time a life is lost, the nine dots on the right half of the screen get reset and can be eaten again, resulting in an additional 90 points per extra man. In the best-case scenario (five extra men), 6,760 points is the maximum score possible, but only 168 dots can be
harvested—not enough to change levels—so we are stuck. There are no more dots to gobble or energizers to eat. There is no final victory waiting for Pac- Man, only an empty half-maze full of ghosts. The game has an ending after all—just not a very happy or exciting one.
Four of the nine dots on the right half of the screen are invisible, but can be heard when eaten. The picture on the left shows all nine dot locations. Dots 1, 5, 6, and 9 are invisible; the rest can be seen but some are a different color than normal.
Anyone reaching this level quickly realized: to safely map out the right side of the screen something had to be done about the ghosts. After much tinkering, it was discovered that a ghost would get “trapped” on the right edge of the screen if he got too close to it. Once trapped, a ghost can only move up or down but never right or left again. By leading ghosts near the edge of the screen, a skilled player could eventually get the ghosts out of the way and concentrate on exploring the right half of the maze and collecting the dots.
There are many methods for trapping the ghosts. One of the easiest ways to trap the three important ghosts is shown in the picture to the right. The yellow line shows Pac-Man’s path from the start of the level to a spot near the bottom-right. The exact instructions are as follows: begin by going right until you reach a blue letter ‘N’, then go down. Keep going down until you reach a blue letter ‘F’, then go right. Keep going right until you reach a yellow ‘B’, then go down again. When executed properly, Pac-Man will hit an invisible wall almost immediately after the last turn is made. Now we wait. The red ghost will get stuck first. The pink ghost follows a few seconds later. The blue ghost will continue to move freely for several moments until the next scatter mode occurs. At that point, it will try to reach some location near the right edge of the screen and get stuck with the pink and red ghost instead. Now the orange ghost is the only one still on the loose (bottom-right). Clyde is no real threat, however, since he runs to his corner whenever Pac-Man gets close (see
Chapter 4), making it relatively easy to clean up all the dots. Be sure to take care around the lower-left corner of the maze—the orange ghost will have nowhere left to run to and will be much more aggressive.
Click on the YouTube video below to watch this ghost-trapping method in action:
Believe It Or Not
Some versions of the Pac-Man ROMs have a “rack test” feature, allowing the cabinet owner to skip ahead to the next level of play whenever they want. To date, the only known way to legitimately get past level 256 is by using the rack test switch inside these machines. The result is that the game loops back around to the first board, but with the score intact and the ghosts still behaving as though it were level 21 or above. Many of the Pac-Man ROMs available for use with the MAME emulator also have this rack test feature, making it relatively easy for those without an arcade version handy to quickly get to the split-screen and beyond.
For decades, Pac-Man enthusiasts worldwide have heard the whispers about a “secret trick” allowing a player to get past level 256 and continue playing without using the aforementioned rack test. Several players have boasted having acquired this holy grail of Pac-Man knowledge over the years, but no one has been able to make good on their claims by actually proving it. This topic became so hotly debated in the upper echelons of the arcade gaming community that
Billy Mitchell—who was convinced it was impossible—offered a $100,000 cash prize to the first player to prove they could legitimately get past level 256, leaving the challenge open for a full year. The prize money went unclaimed.
In spite of the evidence against there being a way to get past level 256, rumors still persist and can occasionally be found in classic gaming forums online, yet no one has been able to back up their words with indisputable proof. It’s hard to imagine why anyone who could legitimately get past the level did not collect Mr. Mitchell’s prize money to be sure. Still the occasional whispers can be heard. Perhaps it is simply natural for people to want to believe in the possibility as opposed to not—like Santa Claus or the Easter Bunny. Then again, maybe there is some middle-aged Pac-Man junkie out there who is withholding secrets to a 30 year-old amusement device for his or her own unfathomable reasons. Stranger things have happened. You be the judge.