分享
 
 
 

我的第一本磁芯大战书(My First Corewar Book) 第一章

王朝other·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

主题: MY FIRST COREWAR BOOK 第一章

译者: Michael Zeng [michaelz2000@21cn.com]

日期: 02-5-10 12:53

*转载请勿删改,谢谢*

MY FIRST COREWAR BOOK

-------

前言

-------

本书搜集了一些COREWAR战士及其注释. 我假设大家都懂得ICWS '88 redcode语言

(详见 M.Durham的指南.1 和 指南.2 (译者:我也译了)). 除非特别指出,所有

redcode都遵循ICWS '88,且按磁芯大小为8000,进程限制8000设计. 所有本文提到

的文章都可以在匿名FTP - ftp.csua.berkeley.edu 的子目录 pub/corewar/中找到.

在简短的介绍之后,每一章都以战士的名称为标题. 我将对它们逐一评价,并给出一些提示.

对其他值得进一步研究的战士我也将提及到. 除非特别指出,这些战士都可以在

redcode/目录里的warrior10.tar找到.

-------

PREFACE

-------

This book is an introductory collection of corewar warriors with

commentary. It assumes an acquaintance with the ICWS '88 redcode language

(See M.Durham's tutorial.1 and tutorial.2 for details). Unless otherwise

noted, all redcode is written in ICWS '88 and is designed for a coresize of

8000, process limit 8000. All documents referred to in this text are

available by anonymous FTP at ftp.csua.berkeley.edu in one of the

subdirectories of pub/corewar/.

After a brief introduction, each chapter presents warriors by subject. I

then pontificate on the merits of these various warriors and give some

hints for successful implementation. I mention credits and give references

to other warriors worth further investigation. Unless otherwise indicated,

these warriors are archived in warrior10.tar in the redcode/ directory.

每个战士的描述大概都是相似的形式. 首先,给出战士的参数. 包括名字,作者,

攻击速度, 有效长度, 耐久力, 和威力, 以及对Pizza Hill的得分. 有效长度是

指攻击阶段执行代码的长度,包括再生的代码. 然后,给出自身包含的源代码和简单

描述. 最后, 在技术上详细分析战士的运行.

我希望这有点帮助. 如果你有问题或建议, 请寄到morrell@math.utah.edu,

有效期至1994六月

史提芬 莫尔 Steven Morrell

The presentation of each warrior follows roughly the same format. First,

the parameters of the warrior are given. These include the name, author,

attack speed, effective size, durability, and effectiveness, and score

against the Pizza Hill. The effective size is the size of the executing

code during the attack phase, taking into account regenerative code. Next,

self-contained source code is given, followed by a brief description of the

warrior. Finally, a detailed technical description of how the warrior runs

is given.

I hope that this helps. If you have questions or comments, send them to

morrell@math.utah.edu, where you can reach me until June,1994

Steven Morrell

---------------------

第1章: Imp-Rings

---------------------

1992年10月14日,A.Ivner 发布了一个大大改革磁芯大战的战士. "The IMPire strikes back"

在Intel hill取得大约170分,负率只有10%,这令它牢牢地站在了第一位.

A.Ivner 发明了一种通过imp来杀死对手的方法 -- 世界第一个imp环(imp-ring).

D.Nabutovsky 在他的"Impressive"里改进了imp环的启动代码来通过制造imp螺旋(imp-spiral)

并加入了石头(stone), 使它在hill里的负率仅为2%,得分是195 (关于石头(stones),请看第2章).

从此,hill里大部分战士都带有imp或反imp的程序.

这章从 A.K.Dewdney 在《科学的美国》的原创文章中提议的imp,到现代我们视为许多成功战士的

组件imp螺旋(imp-spiral)来讲述imp.

---------------------

Chapter 1: Imp-Rings

---------------------

On October 14, 1992, A.Ivner posted a warrior that revolutionized the

game of corewar. "The IMPire strikes back" scored about 170 on the Intel

hill and only suffered 10% losses, putting it firmly in first place.

A.Ivner had invented a way to kill other programs with imps -- the world's

first imp-ring. D.Nabutovsky improved the launch code a bit by making an

imp-spiral and adding a stone in his "Impressive", which lost only 2% and

scored 195 when it started on the hill (for more information on stones, see

chapter 2). Since that time, most warriors on the hill have either been

imps or something hostile to imps.

This chapter deals with imps, from the basic imp proposed by A.K.Dewdney in

the original Scientific American articles to the modern-day imp-spiral we

see as a component of many successful warriors.

--1--

名称: Wait 等待

速度: 没有

长度: 1

耐久力: 强大

威力: 没有

得分:

wait JMP wait

end wait

Wait是最简单的战士.它很小所以很难被找到.

然而,它不会攻击, 所以只有当对手自毁时它才能胜利.

我们把它当作素材.

--1--

Name: Wait

Speed: None

Size: 1

Durability: Strong

Effectiveness: None

Score:

wait JMP wait

end wait

Wait is the simplest warrior. Its small size makes it difficult to locate.

However, it has no attack, so it only wins if the enemy program

self-destructs. We shall be using this program for fodder.

--2--

名称: Imp 顽童

作者: A.K.Dewdney

速度: c的100% (连续)

长度: 1

耐久力: 强大

威力: 弱

得分:

imp MOV imp, imp+1

end imp

Imp 给对手一个很小的移动目标,除非被直接命中,否则不会死亡.

它常常打平, 且容易受imp门(imp-gate)的攻击.

(见程序3)

--2--

Name: Imp

Author: A.K.Dewdney

Speed: 100% of c (sequential)

Size: 1

Durability: Strong

Effectiveness: Poor

Score:

imp MOV imp, imp+1

end imp

Imp presents the enemy with a small, moving target that will not die

without a direct hit. It ties a lot, and is vulnerable to the imp-gate.

(See program 3)

工作原理: 在Imp载入且在执行之前, 它是这样的:

MOV 0,1 (1)

((1)表示将在第一次循环执行的指令.) 当(1)执行, 它把自己复制到下一个地址,然后

移动到下一条指令:

MOV 0,1 ;原始指令

MOV 0,1 (2) ;复制品

现在执行(2). 因为所以的寻址都是相对的, 复制品又把自己负责打下一地址,继续前进.

MOV 0,1

MOV 0,1

MOV 0,1 (3) ;第二个复制品

它一直前进,把遇到的所有东西用 MOV 0,1 指令覆盖.

所以当它遇到敌对代码时, 它也把敌对代码用 MOV 0,1指令覆盖了, 令敌人进程变成imp.

注意,虽然敌对代码没有了, 但敌对进程还在, 所以除非敌人自毁,否则imp赢不了.

HOW IT WORKS: When Imp is loaded and before it executes, it looks like

this:

MOV 0,1 (1)

(The (1) shows which instruction will execute on the first cycle.) When

process (1) executes, it first copies its instruction to the next address

and then moves to the next instruction:

MOV 0,1 ;This is the original.

MOV 0,1 (2) ;This is the copy.

Process (2) now executes. Since all addressing is relative, the process

copies its instruction to the next address and advances.

MOV 0,1

MOV 0,1

MOV 0,1 (3) ;This is the second copy.

And so it goes, overwriting anything in its path with MOV 0,1 instructions.

So when it encounters enemy code, it replaces the enemy code with MOV 0,1

instructions, turning the enemy processes into imps. Note that although

the enemy code is gone, the enemy processes live on, so imps do not win

unless the enemy code self-destructs.

--3--

名称: Imp Gate 顽童门

速度: None

长度: 1

耐久力: 强大

威力: 对imp非常优秀,对其他非常弱

得分:

gate equ wait-10

wait JMP wait,<gate

end wait

Imp门(Imp Gate)等待imp通过它前面10条指令并摧毁imp. 它很少被imp干掉,且很小不容易

定位. Imp门天生就是自卫用的,无法击败固定的敌人,除非敌人自毁.

--3--

Name: Imp Gate

Speed: None

Size: 1

Durability: Strong

Effectiveness: Excellent against imps, Extremely Poor against others

Score:

gate equ wait-10

wait JMP wait,<gate

end wait

Imp Gate waits and destroys imps that happen to pass 10 instructions before

it. It is seldom overrun by imps and its small size makes it difficult to

locate. The imp gate is defensive by nature, and will not win against a

stationary enemy unless this enemy self-destructs.

工作原理: 在_wait_处进程跳转到这个命令的A-值, 也就是回到_wait_处.

可是, 它也在消耗(减一操作)_gate_的B-字段. 这样,_gate_的B-字段每个回合都被消耗(减1).

当敌对的imp来到的时候就会这样:

MOV 0,1 (x) ;imp来啦

DAT 0,-5 ;这是门

imp复制自己并且前进:

MOV 0,1

MOV 0,1 (x+1) ;这是门

门消耗(减一):

(译者:decrement译成什么好呢?)

MOV 0,1

MOV 0,0 (x+1) ;这是门

imp复制指令到自己 (就是没有效果) 并前进, 掉入了尽头(译者:摔死了~):

MOV 0,1

MOV 0,0 ;这是门

(x+2)

门再次消耗(但已经造成了伤害.)

MOV 0,1

MOV 0,-1 ;这是门

(x+2)

敌人进程执行了一条非法指令死掉了.

HOW IT WORKS: The process running at _wait_ jumps to the A-value of this

command, i.e. back to _wait_. However, it also decrements the B-field of

_gate_. Thus, the B-field of _gate_ is decremented every turn. When an

enemy imp comes by this is what happens:

MOV 0,1 (x) ;here comes the imp

DAT 0,-5 ;here is the gate

The imp copies itself and advances onto the gate:

MOV 0,1

MOV 0,1 (x+1) ;here is the gate

The gate decrements:

MOV 0,1

MOV 0,0 (x+1) ;here is the gate

The imp copies this instruction to itself (effectively doing nothing) and

advances, falling off the end:

MOV 0,1

MOV 0,0 ;here is the gate

(x+2)

The gate decrements again (but the damage has already been done.)

MOV 0,1

MOV 0,-1 ;here is the gate

(x+2)

The enemy process executes an illegal instruction and dies.

--4--

名称: Worm 蠕虫

速度: c的25% (线性)

长度: 1.75

耐久力: 非常强壮

威力: 弱

得分:

launch SPL b

SPL ab

aa JMP imp

ab JMP imp+1

b SPL bb

ba JMP imp+2

bb JMP imp+3

imp MOV imp,imp+1

end launch

Worm是几个imp的共生体. worm易受攻击的部分只有尾部指令和即将执行的指令,因此有效长度是

1.75 (有25%的时间, 尾部指令就是即将执行的指令.) 它很难被杀死, 因为每个imp必须单独处理.

但是, 它仍然易受imp门(imp gates)的攻击. 和Imp一样, Worm覆盖敌代码但保留敌进程.

--4--

Name: Worm

Speed: 25% of c (linear)

Size: 1.75

Durability: Very Strong

Effectiveness: Poor

Score:

launch SPL b

SPL ab

aa JMP imp

ab JMP imp+1

b SPL bb

ba JMP imp+2

bb JMP imp+3

imp MOV imp,imp+1

end launch

Worm is a symbiotic collection of imps. The only vulnerable parts of the

worm is the tail instruction and the instruction about to execute, hence the

effective size of 1.75 (25% of the time, the tail instruction is the

instruction about to execute.) It is very difficult to kill, because each

imp must be disposed of individually. However, it is still vulnerable to

imp gates. As with Imp, Worm overwrites enemy code but preserves enemy

processes.

工作原理:

首先, 我们运行worm:

SPL 4,0 (1)

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1

第1个进程分裂为进程 (2) 和 (3):

SPL 4,0

SPL 2,0 (2)

JMP 5,0

JMP 5,0

SPL 2,0 (3)

JMP 4,0

JMP 4,0

MOV 0,1

进程(2)分裂为进程 (4) 和 (5):

SPL 4,0

SPL 2,0

JMP 5,0 (4)

JMP 5,0 (5)

SPL 2,0 (3)

JMP 4,0

JMP 4,0

MOV 0,1

进程(3)分裂:

SPL 4,0

SPL 2,0

JMP 5,0 (4)

JMP 5,0 (5)

SPL 2,0

JMP 4,0 (6)

JMP 4,0 (7)

MOV 0,1

进程(4) 跳转:

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0 (5)

SPL 2,0

JMP 4,0 (6)

JMP 4,0 (7)

MOV 0,1 (8)

进程 (5), (6) 和 (7) 跳转:

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1 (8)

(9)

(10)

(11)

worm现在开始在内存中蠕动前进. 注意,如果进程(9), (10) 或 (11) 现在执行, 将会执行到

非法指令死掉. 但执行了进程 (8) , 复制MOV指令到进程(9)将要执行到的地方:

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1

MOV 0,1 (9) (12)

(10)

(11)

现在执行进程 (9) , 复制MOV指令到进程(10).

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1

MOV 0,1 (12)

MOV 0,1 (10) (13)

(11)

(10) 和 (11) 执行后, worm 蠕动前进了一条指令, 在后面留下粘糊糊的MOV 0,1痕迹.

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1

MOV 0,1 (12)

MOV 0,1 (13)

MOV 0,1 (14)

MOV 0,1 (15)

HOW IT WORKS:

First, we launch the worm using a binary launch:

SPL 4,0 (1)

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1

The first process splits into processes (2) and (3):

SPL 4,0

SPL 2,0 (2)

JMP 5,0

JMP 5,0

SPL 2,0 (3)

JMP 4,0

JMP 4,0

MOV 0,1

Process (2) splits into processes (4) and (5):

SPL 4,0

SPL 2,0

JMP 5,0 (4)

JMP 5,0 (5)

SPL 2,0 (3)

JMP 4,0

JMP 4,0

MOV 0,1

Process (3) splits:

SPL 4,0

SPL 2,0

JMP 5,0 (4)

JMP 5,0 (5)

SPL 2,0

JMP 4,0 (6)

JMP 4,0 (7)

MOV 0,1

Process (4) jumps:

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0 (5)

SPL 2,0

JMP 4,0 (6)

JMP 4,0 (7)

MOV 0,1 (8)

Processes (5), (6) and (7) jump:

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1 (8)

(9)

(10)

(11)

The worm will now start crawling though memory. Note that if processes

(9), (10) or (11) executed right now, they would execute an illegal

instruction and die. But process (8) executes, copying the MOV instruction

to where process (9) is going to execute:

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1

MOV 0,1 (9) (12)

(10)

(11)

Now process (9) executes, copying the MOV instruction to process (10).

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1

MOV 0,1 (12)

MOV 0,1 (10) (13)

(11)

And after (10) and (11) have executed, the worm has crawled forward an

instruction, leaving a slimy MOV 0,1 trail behind.

SPL 4,0

SPL 2,0

JMP 5,0

JMP 5,0

SPL 2,0

JMP 4,0

JMP 4,0

MOV 0,1

MOV 0,1 (12)

MOV 0,1 (13)

MOV 0,1 (14)

MOV 0,1 (15)

--5--

名称: Ring 环

速度: c的100% (接近线性)

长度: 1

耐久力: 一般

威力: 好

得分:

c JMP imp-2666

launch SPL c

SPL imp+2667

imp MOV 0,2667

end launch

Ring 是3个imp分布在磁芯的共生体. 它能摧毁它越过的敌进程,如果敌人只有1个或2个进程.

这个代码只能在磁芯大小为8000的情况下正确运行, 尽管可以改变常数来在任意不能被3整除

的磁芯大小下运行. Ring 是一个3点imp的例子.

--5--

Name: Ring

Speed: 100% of c (mostly linear)

Size: 1

Durability: Average

Effectiveness: Fair

Score:

c JMP imp-2666

launch SPL c

SPL imp+2667

imp MOV 0,2667

end launch

Ring is a symbiotic collection of three imps distributed through core. It

has the capability to destroy enemy processes it overruns, if the enemy is

running only one or two processes. This code will run correctly only in a

coresize of 8000, although the constants may be tweaked to run in any

coresize not divisible by 3. Ring is an example of a 3-pt imp.

工作原理: 启动代码很小:

JMP -2663, 0

SPL 0, 0 (1)

SPL 2668, 0

MOV 0,2667

(1)分裂:

JMP -2663, 0 (3)

SPL 0, 0

SPL 2668, 0 (2)

MOV 0,2667

(2)分裂:

JMP -2663, 0 (3)

SPL 0, 0

SPL 2668, 0

MOV 0,2667 (4)

...

(5) ;这里是imp后面2667条指令

(3)跳转:

MOV 0,2667 (4)

...

(5) ;这里是imp后面2667条指令

...

(6) ;这里是进程(2)后面2667条指令

现在有点乐趣了. (4)执行, 复制imp指令到(5) 并开始(7):

MOV 0,2667

(7)

...

MOV 0,2667 (5)

...

(6)

(5) 执行, 复制imp指令到(6):

MOV 0,2667

(7)

...

MOV 0,2667

(8)

...

MOV 0,2667 (6)

(6) 执行, 复制imp指令回(7):

MOV 0,2667

MOV 0,2667 (7)

...

MOV 0,2667

(8)

...

MOV 0,2667

(9)

循环再次开始, ring也向前蔓延.

让我们来看看Ring对Wait(程序1)的战斗. Wait执行 JMP 0,0 直到最终被Ring用

MOV 0,2667覆盖这条指令.

MOV 0,2667 (1)

Wait执行这条指令并且前进:

MOV 0,2667

(2)

因为Ring要用3个周期来写下一条命令, Wait的进程现在执行了非法指令死掉.

所以Ring慢慢地在磁芯里前进, 所以如果敌人只有一个进程, 就会掉进imp环的尽头.

HOW IT WORKS: The launching code is a very small binary startup:

JMP -2663, 0

SPL 0, 0 (1)

SPL 2668, 0

MOV 0,2667

The first process splits:

JMP -2663, 0 (3)

SPL 0, 0

SPL 2668, 0 (2)

MOV 0,2667

The second process splits:

JMP -2663, 0 (3)

SPL 0, 0

SPL 2668, 0

MOV 0,2667 (4)

...

(5) ;this location is 2667 instructions after the imp

The third process jumps:

MOV 0,2667 (4)

...

(5) ;this location is 2667 instructions after the imp

...

(6) ;this location is 2667 instructions after process (2)

Now the fun begins. Process (4) executes, copying the imp instruction to

process (5) and becoming process (7):

MOV 0,2667

(7)

...

MOV 0,2667 (5)

...

(6)

(5) executes, copying the imp instruction to process (6):

MOV 0,2667

(7)

...

MOV 0,2667

(8)

...

MOV 0,2667 (6)

And now (6) executes, copying the imp instruction back to process (7):

MOV 0,2667

MOV 0,2667 (7)

...

MOV 0,2667

(8)

...

MOV 0,2667

(9)

The cycle starts all over again, and the ring creeps forward.

Let's see what happens when Ring fights Wait (Program 1). Wait executes

JMP 0,0 until eventually Ring overwrites this instruction with MOV 0,2667.

MOV 0,2667 (1)

Wait executes this instruction and advances:

MOV 0,2667

(2)

Since Ring takes 3 cycles to move the next command into place, Wait's

process now executes an illegal instruction and dies.

So Ring slowly advances through core, and if the enemy is running a single

process, it falls off the end of the imp ring.

--6--

名称: Spiral 螺旋

速度: c的37.5%(大致线性)

长度: 1.875

耐久力: 很强

威力: 好

得分:

step equ 2667

launch SPL 8

SPL 4

SPL 2

JMP imp

JMP imp+step

SPL 2

JMP imp+(step*2)

JMP imp+(step*3)

SPL 4

SPL 2

JMP imp+(step*4)

JMP imp+(step*5)

SPL 2

JMP imp+(step*6)

JMP imp+(step*7)

imp MOV 0,step

end launch

Spiral同时具有worm的耐久力和ring的威力.

Spiral能抵抗大部分常规攻击, 且因为它是8进程的imp环(imp-ring), 它能杀死任何被它覆盖的

少于8进程的敌人. 仅有的易受攻击点是spiral的尾部和当前运行的进程. 尽管如此Spiral还是被

imp门(imp gates)克制.

--6--

Name: Spiral

Speed: 37.5% of c (mostly linear)

Size: 1.875

Durability: Very Strong

Effectiveness: Fair

Score:

step equ 2667

launch SPL 8

SPL 4

SPL 2

JMP imp

JMP imp+step

SPL 2

JMP imp+(step*2)

JMP imp+(step*3)

SPL 4

SPL 2

JMP imp+(step*4)

JMP imp+(step*5)

SPL 2

JMP imp+(step*6)

JMP imp+(step*7)

imp MOV 0,step

end launch

Spiral crosses the durability of a worm with the effectiveness of a ring.

Spiral is resistant to most conventional attacks, and since it is an

8-process imp-ring, it kills any enemy it overwrites if the enemy has less

than 8 processes running. The only vulnerable parts of the spiral are the

tail and the process that is currently running. Spiral is vulnerable to

imp gates, however.

工作原理: 启动后,进程分配如下:

MOV 0,2667 (16)

(19) ;这里是(18)后的2667条指令

(22)

...

(17) ;这里是(16)后的2667条指令

(20)

(23)

...

(18) ;这里是(17)后的2667条指令

(21)

现在spiral向前蠕动: (16) 复制imp到(17), (17)复制到(18),如此类推.

这时所有进程前进1条指令,然后imp传递指令再次开始.

一步一步地分析imp门(imp gates)怎样摧毁spirals是冗长和无必要的. 关键是:

imp门(imp gate) 是不停被改变的. 当imp通过imp门,imp指令无法完整复制到下

一进程的位置.下一进程将执行到非法指令死掉. 这重复发生直到整个spiral通过

imp门并被分解.

HOW IT WORKS: After a binary launch, the processes are arranged as

follows:

MOV 0,2667 (16)

(19) ;this process is 2667 instructions after process (18)

(22)

...

(17) ;this process is 2667 instructions after process (16)

(20)

(23)

...

(18) ;this process is 2667 instructions after process (17)

(21)

Now the spiral worms along: (16) copies the imp to (17), which copies it to

(18), and so on. All the processes advance 1 instruction as this happens,

and then the imp-passing instructions begin again.

A step-by step analysis of how imp gates destroy spirals would be lengthy

and unnecessarily complicated. The key idea is this: The imp gate is

constantly being modified. As the imp overruns the imp gate, no imp

instructions are left intact to copy to the next processes' location.

This next process executes an illegal instruction and dies. This scenario

repeats until the entire spiral moves through the imp gate and

disintegrates.

--7--

名称: Gate Crashing Spiral 破门螺旋

速度: c的12.5%(通常是线性的)

长度: 5.875

耐久力: 非常强

威力: 强

得分:

step1 equ 2667

step2 equ 2668

start SPL lnch1

SPL lnch3

lnch2 SPL 8

SPL 4

SPL 2

JMP imp2+(step2*0)

JMP imp2+(step2*1)

SPL 2

JMP imp2+(step2*2)

JMP imp2+(step2*3)

SPL 4

SPL 2

JMP imp2+(step2*4)

JMP imp2+(step2*5)

SPL 2

JMP imp2+(step2*6)

JMP imp2+(step2*7)

lnch3 SPL 8

SPL 4

SPL 2

JMP imp3+(step2*0)

JMP imp3+(step2*1)

SPL 2

JMP imp3+(step2*2)

JMP imp3+(step2*3)

SPL 4

SPL 2

JMP imp3+(step2*4)

JMP imp3+(step2*5)

SPL 2

JMP imp3+(step2*6)

JMP imp3+(step2*7)

lnch1 SPL 8

SPL 4

SPL 2

JMP imp1+(step2*0)

JMP imp1+(step2*1)

SPL 2

JMP imp1+(step2*2)

JMP imp1+(step2*3)

SPL 4

SPL 2

JMP imp1+(step2*4)

JMP imp1+(step2*5)

SPL 2

JMP imp1+(step2*6)

JMP imp1+(step2*7)

imp1 MOV 0,step1

DAT #0

DAT #0

DAT #0

imp2 MOV 0,step2

MOV 0,step2

imp3 MOV 0,step2

MOV 0,step2

end start

Gate Crashing Spiral由3个螺旋结合起来杀死imp门(imp gates).

第一个是标准的imp螺旋,其余两个稍微改动过,通过交叉储存来提供更强的保护

以对抗分裂炸弹(split bombs).

由于启动代码很大,它很容易被对手的快攻克制.

--7--

Name: Gate Crashing Spiral

Speed: 12.5% of c (mostly linear)

Size: 5.875

Durability: Very Strong

Effectiveness: Good

Score:

step1 equ 2667

step2 equ 2668

start SPL lnch1

SPL lnch3

lnch2 SPL 8

SPL 4

SPL 2

JMP imp2+(step2*0)

JMP imp2+(step2*1)

SPL 2

JMP imp2+(step2*2)

JMP imp2+(step2*3)

SPL 4

SPL 2

JMP imp2+(step2*4)

JMP imp2+(step2*5)

SPL 2

JMP imp2+(step2*6)

JMP imp2+(step2*7)

lnch3 SPL 8

SPL 4

SPL 2

JMP imp3+(step2*0)

JMP imp3+(step2*1)

SPL 2

JMP imp3+(step2*2)

JMP imp3+(step2*3)

SPL 4

SPL 2

JMP imp3+(step2*4)

JMP imp3+(step2*5)

SPL 2

JMP imp3+(step2*6)

JMP imp3+(step2*7)

lnch1 SPL 8

SPL 4

SPL 2

JMP imp1+(step2*0)

JMP imp1+(step2*1)

SPL 2

JMP imp1+(step2*2)

JMP imp1+(step2*3)

SPL 4

SPL 2

JMP imp1+(step2*4)

JMP imp1+(step2*5)

SPL 2

JMP imp1+(step2*6)

JMP imp1+(step2*7)

imp1 MOV 0,step1

DAT #0

DAT #0

DAT #0

imp2 MOV 0,step2

MOV 0,step2

imp3 MOV 0,step2

MOV 0,step2

end start

Gate Crashing Spiral is a collection of three spirals that work together to

kill imp gates. The first is a standard imp spiral and the other two are

slightly modified, interleaved for greater protection against split bombs.

The large size of its launch code makes it vulnerable to fast attacks.

工作原理: 每个螺旋都有自身的启动代码. 第一个螺旋首先启动并爬行一条指令,此时

其余两个螺旋也启动了. 磁芯看起来象这样 (为了方便起见,重新设置了计数器):

MOV 0,2667 ;这里是标签imp1 | MOV 0,2667 | MOV 0,2667

MOV 0,2667 (17) | MOV 0,2667 (18) | MOV 0,2667 (19)

MOV 0,2667 (20) | MOV 0,2667 (21) | MOV 0,2667 (22)

DAT #0,#0 (23) | (24) |

MOV 0,2668 (1) ;这里是标签imp2 | |

MOV 0,2668 | (2) |

MOV 0,2668 (9) ;这里是标签imp3 | | (3)

MOV 0,2668 | (10) |

(4) | | (11)

| (5) |

(12) | | (6)

| (13) |

(7) | | (14)

| (8) |

(15) | |

| (16) |

这些imp象往常一样向前移动.

当gate crashing spiral通过门(gate), 第二或第三个螺旋首先碰撞:

MOV 0,2668 (x) ;这是imp门

门消耗(减一操作)了:

MOV 0,2667 (x)

受伤的螺旋复制自己到前面2667条指令处:

MOV 0,2667

(x+24)

...

MOV 0,2667

现在这个螺旋就掉进尽头死掉了, 然后第一个螺旋来到门处:

MOV 0,2667 (y) ;这是imp门

...

MOV 0,2667 (y+1)

门消耗(减一操作)了:

MOV 0,2666 (y)

...

MOV 0,2667 (y+1)

执行到(y)进程, 它无法复制imp到进程(y+1),但没关系, 因为进程 (y+1) 执行前两

个螺旋留下的imp指令. 这样,螺旋就通过了门,继续前进并杀死敌进程.

HOW IT WORKS: Each spiral has its own binary launch. The first spiral

launches first and crawls forward an instruction by the time the other two

spirals have launched. Core then looks like this (after resetting the

counter for clearer exposition):

MOV 0,2667 ;This is label imp1 | MOV 0,2667 | MOV 0,2667

MOV 0,2667 (17) | MOV 0,2667 (18) | MOV 0,2667 (19)

MOV 0,2667 (20) | MOV 0,2667 (21) | MOV 0,2667 (22)

DAT #0,#0 (23) | (24) |

MOV 0,2668 (1) ;This is label imp2 | |

MOV 0,2668 | (2) |

MOV 0,2668 (9) ;This is label imp3 | | (3)

MOV 0,2668 | (10) |

(4) | | (11)

| (5) |

(12) | | (6)

| (13) |

(7) | | (14)

| (8) |

(15) | |

| (16) |

The imps then move forward via the usual instruction juggling.

When a gate crashing spiral overruns a gate, the second or third spirals

hit first:

MOV 0,2668 (x) ;imp gate here

The gate decrements:

MOV 0,2667 (x)

The wounded spiral copies this instruction 2667 ahead:

MOV 0,2667

(x+24)

...

MOV 0,2667

The second and third spirals now fall off the end and die, and then the

first spiral hits the gate:

MOV 0,2667 (y) ;imp gate here

...

MOV 0,2667 (y+1)

The gate decrements:

MOV 0,2666 (y)

...

MOV 0,2667 (y+1)

Process (y) executes, and can't copy the imp to process (y+1), but this is

okay, because process (y+1) executes the imp instruction from the two

spirals gone before. The spiral crawls through the gate and goes on to

kill the enemy processes.

--8--

名称: Nimbus Spiral光环螺旋

速度: c的50%(粗略线性)

长度: 1.992

耐久力: 非常强

威力: 好

得分:

step equ 127

imp MOV 0,step

launch SPL 1 ;1 process

SPL 1 ;2 processes

SPL 1 ;4 processes

SPL 1 ;8 processes

SPL 1 ;16 processes

MOV -1,0 ;32 processes

SPL 1 ;63 processes

SPL 2 ;126 processes

spread JMP @spread,imp

ADD #step,spread

end launch

Nimbus Spiral启动一个63点螺旋,每个点有两个进程.

因为二进制启动超过100条指令的限制, 所以Nimbus Spiral使用了称为光环类型

(Nimbus-type)的启动方式. 这种类型的启动代码明显小了, 但启动时间就大概是

两倍.

--8--

Name: Nimbus Spiral

Speed: 50% of c (somewhat linear)

Size: 1.992

Durability: Very Strong

Effectiveness: Fair

Score:

step equ 127

imp MOV 0,step

launch SPL 1 ;1 process

SPL 1 ;2 processes

SPL 1 ;4 processes

SPL 1 ;8 processes

SPL 1 ;16 processes

MOV -1,0 ;32 processes

SPL 1 ;63 processes

SPL 2 ;126 processes

spread JMP @spread,imp

ADD #step,spread

end launch

Nimbus Spiral launches a 63-point spiral with two processes per point.

Because a binary launch would exceed the 100-instruction limit, Nimbus

Spiral uses what is called a Nimbus-type launch. The code for this type

of launch is obviously smaller, but the time it takes to launch spirals is

roughly doubled.

工作原理: 每条SPL 1 命令使下一指令前后的进程数加倍. 执行MOV -1,0第一个进程

不分裂, 但所以后来的进程都执行一条SPL 1 命令. 因此,在SPL 2命令执行前, 磁芯

是这样的 (重置了计数器):

MOV 0,127

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0 (1)-(126)

JMP @0,-9

ADD #127,-1

执行SPL 2命令后:

MOV 0,127

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0

JMP @0,-9 奇数进程

ADD #127,-1 偶数进程

我们再次重置进程. 现在执行 (1) , 跳转到JMP指令的B-操作数指定的

位置:

MOV 0,127 (253) ;这来自 (1)

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0

JMP @0,-9 大于1的奇数进程

ADD #127,-1 偶数进程

现在执行 (2) , 加127到JMP指令的B-操作数:

MOV 0,127 (253)

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0

JMP @0,118 大于1的奇数进程

ADD #127,-1 大于2的偶数进程

(254) ;这来自 (2)

现在继续. (3)跳转到新位置. 奇数进程修改跳转向量, 偶数进程跳转.

当(127)执行完了, 整个情况如下:

MOV 0,127 (253)

SPL 1,0 (379)

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0

JMP @0,-134

ADD #127,-1

偶数进程

...

奇数进程散布于整个磁芯

奇数进程构成了imp螺旋,偶数进程则执行非法指令死掉, 只剩下螺旋在内存中蠕动.

HOW IT WORKS: Each SPL 1 command doubles the number of processes acting in

tandem at the next instruction. The first process that executes the

MOV -1,0 command does not split, but all subsequent processes execute a

SPL 1 command. Hence, before execution of the SPL 2 command, core looks

like this (with counter reset):

MOV 0,127

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0 (1)-(126)

JMP @0,-9

ADD #127,-1

After execution of the SPL 2 command:

MOV 0,127

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0

JMP @0,-9 Odd processes

ADD #127,-1 Even processes

We reset the processes again. Process (1) now executes, jumping to the

location of the B-operand of the JMP instruction:

MOV 0,127 (253) ;this came from process (1)

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0

JMP @0,-9 Odd processes greater than 1

ADD #127,-1 Even processes

Process (2) now executes, adding 127 to the B-operand of the JMP

instruction:

MOV 0,127 (253)

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0

JMP @0,118 Odd processes greater than 1

ADD #127,-1 Even processes greater than 2

(254) ;this came from process (2)

And it continues. Process (3) jumps to a new location. The even processes

modify the jump vector, and the odd processes do all of the jumping. By

the time process (127) is ready to execute, we have the following

situation:

MOV 0,127 (253)

SPL 1,0 (379)

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 1,0

SPL 2,0

JMP @0,-134

ADD #127,-1

Even processes

...

Odd processes broadcast throughout core

The odd processes form an imp spiral and the even processes execute illegal

instructions and die, leaving just the spiral to crawl through memory.

--结论--

有两个问题要回答: 什么时候在你喜欢的战士里添加一个imp?和如何杀死imp?

现在大部分战士都对imp有一定的抵抗力, 因此纯imp程序很少是成功的. 但是很容易

在多进程的代码里加入imp,就像现在的石头(stones), 吸血鬼(vampires),或纸(paper).

多数成功的imp战士用它们大部分的进程时间来进行常规攻击, 并依赖imp环作为后援.加入imp

好不好,取决于你的程序; 你可能输得较少,但也可能赢得更少. 唯一可以确定的是你肯定会常

常打成平手. 这可以通过测试你的战士来改善.

--Conclusion--

Two questions beg to be answered: When should you add an imp to your

favorite warrior, and how do you kill imps?

Most of today's fighters have some resistance to imps, so pure imp programs

seldom are successful. But imps are easy to add to code that has multiple

processes running, like today's stones, vampires, or paper. The most

successful imp warriors use most of their process time in a more

conventional attack, and rely on the imp-ring as a backup. Whether an imp

is a good idea in your program depends on the program; you may lose less,

but you may win less. About the only thing you can be sure of is tying

more. But testing your warrior always helps.

杀死imp是困难的,但不是没有可能. Imp门对多数imp都有效, 但是应该在你的程序完成

自身构造后执行. 这样的Imp门

SPL 0,<gate

DAT <gate,<gate

有时甚至能杀死gate-crashing imps. 快速轰炸程序偶然能在启动程序完成前把它找到,

特别是fancier imps. 恰当的大面积轰炸程序(如 Charon v8.1) 可以击中并摧毁所有

的imp指令. 放置单个MOV 0,<1 炸弹到imp环的尾部(或尾部后不远的易受攻击指令) 可以

杀死整个环. 放置MOV <2667,<5334 指令到3点imp环可以杀死9条imp指令, 在stream(即

连续轰炸内存)中具有巨大威力. 有些程序为imp环专门制造了一个imp陷阱(imp trap),

它在以2667为步长的imp环中放置 SPL 0 炸弹,这样环就受到从尾部向前的攻击.

Killing imps is difficult, but not impossible. Imp gates work well against

most imps, but should only be executed after the rest of your code has done

its stuff. Imp gates of the form

SPL 0,<gate

DAT <gate,<gate

can sometimes kill even gate-crashing imps. Fast bombing programs can

occasionally catch the launching code before it has completed, especially

with fancier imps. Code with a long enough bombing run (e.g. Charon v8.1)

can hit and destroy all the imp instructions if it is done right. Dropping

a single MOV 0,<1 bomb on the tail (or vulnerable instruction soon after

the tail) of an imp-ring will kill the entire ring off. Dropping a

MOV <2667,<5334 instruction on a 3-point imp ring can kill as many as 9 imp

instructions, and is extremely effective in a stream (which is sequential

bombing of memory). Some programs use an imp trap tailor-made for stunning

imp-rings by dropping SPL 0 bombs on the imp-ring using a step size of

2667, so that the ring is attacked from the tail forward.

一种对imp启动程序的改进是添加消耗模式到所以SPL和JMP命令的B-字段. 例如你要启动

很大的二进制代码, 你可以自由的消耗63条指令来遍布磁芯. 这章参考的大部分原始代码

都是这种做法.

下面列出一些值得研究的imp风格程序. 除非特别指出, 都可以在88目录的warrior10.tar

找到. Imp和stone的结合程序会在第2章后面列出.

"The IMPire strikes back" 作者是 Anders Ivner (impire)

"Trident" 作者是 Anders Ivner (trident)

"Nimbus 1.2" 作者是 Alex MacAulay (nimbus12)

"Imps! Imps! Imps!" 作者是 Steven Morrell (contact morrell@math.utah.edu)

--

程序 2, Imp, A.K. Dewdney在Scientific American的文章中提出.

程序 3, Imp Gate,B.Thomsen提出它的通用形式,在文献中常被称为懦夫(wimp).

程序 5, Ring, 从_Push Off_中 P.Kline的一篇文章中偷来并修改而成,

看起来象是 A.Ivner的三角形"Trident."

程序 7, Gate Crashing Spiral, 从 P.Kilne的炮击"Cannonade"中偷来并修改而成

程序 8, Nimbus Spiral, 从 A.MacAulay的光环"Nimbus 1.2"中偷来并修改而成

【本章完】

An enhancement to the imp-launching routines is to add decrement statements

to all the b-fields of the SPL and JMP commands. If you have a large

binary launch, for example, you could decrement 63 instructions throughout

core for free. Most of the original code I have based this chapter on has

such b-fields.

Here is a list of imp-style programs worth investigating. Unless otherwise

noted, they can be found in warrior10.tar in the 88 directory. Imp-stone

combos will be listed in the back of chapter 2.

"The IMPire strikes back" by Anders Ivner (impire)

"Trident" by Anders Ivner (trident)

"Nimbus 1.2" by Alex MacAulay (nimbus12)

"Imps! Imps! Imps!" by Steven Morrell (contact morrell@math.utah.edu)

--

Program 2, Imp, was written by A.K. Dewdney for his Scientific American

articles.

Program 3, Imp Gate, was suggested in its current form by B.Thomsen, and

is often called a wimp in the literature.

Program 5, Ring, was stolen and modified from a _Push Off_ article from

P.Kline, but it looks suspiciously like A.Ivner's "Trident."

Program 7, Gate Crashing Spiral, was stolen and modified from P.Kilne's

"Cannonade."

Program 8, Nimbus Spiral, was stolen and modified from A.MacAulay's

"Nimbus 1.2."

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有