星际迷航1971文字游戏(译文)
By robot-v1.0
本文链接 https://www.kyfws.com/games/star-trek-1971-text-game-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 22 分钟阅读 - 10930 个词 阅读量 0星际迷航1971文字游戏(译文)
原文地址:https://www.codeproject.com/Articles/28228/Star-Trek-1971-Text-Game
原文作者:Michael Birken
译文由本站 robot-v1.0 翻译
前言
A reworking of the 1971 Star Trek text game using C#
使用C#对1971年<星际迷航>文字游戏的改造
一点历史(A Bit of History)
在1969年取消原始系列后的两年,高中生迈克梅菲尔德(Mike Mayfield)忙于通过将打孔的纸带装入Sigma 7来保持<星际迷航>的生命,以使企业和克林贡帝国的工作人员重获新生一个每秒10个字符的电传终端. Mike将游戏移植到HP BASIC之后不久,它进入了公共领域.从那里开始,早期的计算机发烧友为微型和微型计算机BASIC所能想象到的每一种风味都增强和重写了游戏.(*Two years after the original series was canceled in 1969, high school senior Mike Mayfield was busy keeping the Star Trek universe alive by feeding punched paper tape into a Sigma 7 in an effort to bring the crew of the Enterprise and the Klingon Empire to life on a 10 character-per-second teletype terminal. Soon after Mike ported his game to HP BASIC, it entered the public domain. From there, early computer enthusiasts enhanced and rewrote the game for every flavor of mini and microcomputer BASIC imaginable and beyond.*) 我记得80年代初,当我还是一个小孩试图在我的IBM PCjr上学习BASIC时遇到过游戏的版本.那时,计算机书籍和杂志以印刷形式分发程序.意思是,您必须输入它们才能玩游戏.这是一个痛苦的屁股,但是这个过程鼓励你去修补.它激励您学习编码,并调整甚至改进正在输入的程序.(*I remember encountering versions of the game back in the early 80s when I was a little kid trying to learn BASIC on my IBM PCjr. Back then, computer books and magazines distributed programs in printed form. Meaning, you had to type them in to play the games. It was a pain in the ass, but the process encouraged you to tinker. It motivated you to learn to code and to tweak or even improve the programs you were entering in.*) 我拿起的每本BASIC游戏书籍都包含<星际迷航>游戏的某些版本.我记得加载了几次,但是每次我最终都完全困惑地盯着屏幕. "这星际迷航到底有多厉害?"我记得在想.我不知道怎么玩.(*Every BASIC game book that I picked up contained some version of the Star Trek game. I recall loading it up a few times, but each time I ended up staring at the screen in utter confusion. "How the heck is this Star Trek?" I remember thinking. I couldn’t figure out how to play it.*) 当我进入高中时,我已经从BASIC毕业,然后转向C和C ++等更大更好的产品.但是,有时候,我经常想知道<星际迷航>文字游戏.是什么让它如此受欢迎?在了解了我上面提到的历史之后,我决定对其进行挖掘并重新考虑一下.(*By the time I entered high school, I had graduated from BASIC and moved on to bigger and better things like C and C++. But, on occasion, I often wondered about the Star Trek text game. What made it so popular? After learning about the history that I touched upon above, I decided to dig it up and take a second look.*) 经过一番网上冲浪之后,我遇到了迈克
梅菲尔德(Mike Mayfield)最初使用的HP BASIC端口.这是一段代码:(After a bit of web surfing, I came across Mike Mayfield’s original port to HP BASIC. Here’s a snippet of the code:)
100 REM *****************************************************************
110 REM *** ***
120 REM *** STAR TREK: BY MIKE MAYFIELD, CENTERLINE ENGINEERING ***
130 REM *** ***
140 REM *** TOTAL INTERACTION GAME - ORIG. 20 OCT 1972
150 REM *** ***
160 REM *****************************************************************
170 GOSUB 5460
180 PRINT " STAR TREK "
190 PRINT "DO YOU WANT INSTRUCTIONS (THEY'RE LONG!)";
200 INPUT A$
210 IF A$ <> "YES" THEN 230
220 GOSUB 5820
230 REM ***** PROGRAM STARTS HERE *****
啊,好的旧行号BASIC.现在都回到我身边了.这些行号在那里提供了GOTO和GOSUB语句的目标.但是,行号使编辑有点困难.按照惯例,输入的行号是10的倍数.这样,在开发程序时,您可以返回并在现有的行之间插入多达9条其他语句,而无需重新编写所有的GOTO/GOSUB引用.如果您需要插入9行以上,我记得PCjr上BASIC编辑器中的一项特殊功能.它将在整个程序的所有行号和所有行号引用后附加零.意思是,您现在最多可以插入99行.他们难道不能以10的倍数重新编号程序吗?没事PCjr不够强大.(Ah, good old line-numbered BASIC. It’s all coming back to me now. Those line numbers were there to provide targets for GOTO and GOSUB statements. But, line numbers made editing a tad difficult. It was convention to enter in line numbers that were multiples of 10. That way, as you developed the program, you could go back and insert up to 9 additional statements in between existing lines without reworking all the GOTO/GOSUB references. If you needed to insert more than 9 lines, I remember a special feature in the BASIC editor on my PCjr. It would append a zero to all line numbers and all line number references throughout the program. Meaning, you could now insert up to 99 lines. Couldn’t they just renumber the program in multiples of 10? Nah. The PCjr wasn’t powerful enough for that.) 如果您想了解"中心线工程",这是一家虚构的公司,迈克`梅菲尔德(Mike Mayfield)创造了这个公司,以使他的BASIC项目在阅读备注部分的读者中享有很高的知名度.(If you’re wondering about “Centerline Engineering,” it was an imaginary company that Mike Mayfield coined to give his BASIC projects a level of prominence to those reading the remarks section.) 有了代码,我真的很想玩游戏.我敢肯定,有用于现代机器的HP BASIC解释器,但这会带来什么乐趣.在播放之前,我想做自己的游戏.该游戏诞生于爱好者时代.它在交易时被重新解释和增强.我想带回那些早已迷失的键入程序神奇年代.(With code in hand, I really wanted to play the game. I’m sure that there are HP BASIC interpreters out there for modern machines, but what fun would that be. Before I played it, I wanted do my own port. This game was born in the hobbyist era. It was made to be reinterpreted and enhanced as it traded handed. I wanted to bring back part of those long-lost magical days of type-in programs.) 我对代码的第一印象是"所有单字母变量名称是什么?“首先,我认为这是HP BASIC的局限性,但是后来我注意到偶然出现的2个字母的名称.我猜2比1要好.看一下这一行:(My first impression of the code was “what’s with all the single letter variable names?” First, I thought it was a limitation of HP BASIC, but then I noticed the occasional 2-letter names. I guess 2 is better than 1. Everything is also in caps. Take a look at this line:)
2140 T=T+1
那条线增加了T.但是,由于上限,我觉得代码在向我尖叫.将T和1的总和分配回T DAMN!而且,我很习惯写(That line increments T. But, due to the caps, I feel like the code is screaming at me. ASIGN THE SUM OF T AND 1 BACK TO T DAMN IT! Also, I’m so used to writing) t++
要么(or) t += x
我忘记了扩展符号.实际上,输入7(that I forgot about the expanded notation. In fact, entering 7)日(th)我已经掌握了BASIC的这一年级,当我的数学老师向我们介绍如何求解联立方程式时,我感到非常困惑.例如,在以下等式中找到X的值:(grade having mastered BASIC, I found myself really confused when my math teacher introduced us to solving simultaneous equations. For instance, find the value of X in this equation:)
X = 2X - 6
那是我第一次被介绍运算符重载的概念.取决于上下文,等号可以表示变量分配或数值等价.(That was the first time I was introduced to the concept of operator overloading. The equals-sign can mean variable assignment or numerical equivalence depending on the context.) 这是我注意到的很酷的代码块:(Here’s a cool block of code that I noticed:)
4550 IMAGE 8(X,3A)
4560 IMAGE 8(X,3A),8X,"STARDATE",8X,5D
4570 IMAGE 8(X,3A),8X,"CONDITION",8X,6A
4580 IMAGE 8(X,3A),8X,"QUADRANT",9X,D,",",D
4590 IMAGE 8(X,3A),8X,"SECTOR",11X,D,",",D
4600 IMAGE 8(X,3A),8X,"ENERGY",9X,6D
4610 IMAGE 8(X,3A),8X,"PHOTON TORPEDOES",3D
4620 IMAGE 8(X,3A),8X,"SHIELDS",8X,6D
这些不是可执行语句.他们是(These are not executable statements. They’re) string
可以在中引用的(s that can be referenced in) PRINT
命令.未加引号的符号将替换为变量的值.在概念上类似于C风格(commands. The unquoted symbols get substituted with values of variables. It’s conceptually similar to C-style) printf()
格式占位符.我没有意识到BASIC提供了如此丰富的数字格式表示法.(format placeholders. I didn’t realize that BASIC offered such a rich numerical formatting notation.)
在继续检查源代码时,我发现了一些没有意义的陈述.例如,即使您不必在使用变量之前就声明变量,您仍然需要指定数组的维数.我遇到了一些从未分配过的数组.最终,我决定为我的港口寻找更好的基础.(As I continued to examine the source, I found some statements that didn’t make sense. For instance, even though you don’t have to declare variables before you use them, you still need to specify the dimensions of arrays. I came across some arrays that were never allocated as such. Ultimately, I decided to seek out a better basis for my port.)
经过一段时间的谷歌搜索,我发现了一个清理版本,保留了迈克`梅菲尔德的大部分代码.它的某些部分经过了重新设计,可能使其能够在现代版本的BASIC上运行.例如,那些很酷的IMAGE语句被删除,并替换为更简单的PRINT命令集.变量名称实际上看起来是相同的,但至少在此版本中它们都已考虑在内.(After a bit of Googling, I found a cleaned up version that maintained the majority of Mike Mayfield’s code. Some of it was reworked, probably to enable it to run on modern versions of BASIC. For instance, those cool IMAGE statements were dropped and replaced with sets of simpler PRINT commands. The variable names appear virtually identical, but at least they are all accounted for in this version.)
移植游戏(Porting the Game)
接下来,我必须决定将其移植到哪种语言.盯着那个BASIC代码让我想起了C#(Next, I had to decide what language to port it to. Staring at that BASIC code reminded me that C# brought) goto
回到主流.是否可以从BASIC到C#进行精确的逐行连接?显然是这样,结果是我曾经输入计算机的一些最恶心的代码.想要比较吗?这是一段BASIC代码:(back into the mainstream. Would it be possible to do an exact line-by-line port from BASIC to C#? Apparently so… and the result is some of the sickest code I’ve ever keyed into a computer. Want a comparison? Here’s a segment of BASIC code:)
2950 PRINT "TORPEDO TRACK:"
2960 LET X=X+X[1]
2970 LET Y=Y+X[2]
2980 IF X<.5 OR X >= 8.5 OR Y<.5 OR Y >= 8.5 THEN 3420
2990 LET V[4]=X
2991 LET V[5]=Y
2992 GOSUB 9000
2993 PRINT
3020 IF A[INT(X+.5),INT(Y+.5)]#0 THEN 3080
3060 GOTO 2960
3080 IF A[INT(X+.5),INT(Y+.5)]#2 THEN 3230
3120 PRINT "*** KLINGON DESTROYED ***"
3130 LET P[1]=P[1]-1
3140 LET P[3]=P[3]-1
3150 IF P[3] <= 0 THEN 4040
3160 FOR I=1 TO 3
3170 IF INT(X+.5)#K[I,1] THEN 3190
3180 IF INT(Y+.5)=K[I,2] THEN 3200
3190 NEXT I
3200 LET K[I,3]=0
3210 GOTO 3370
3230 IF A[INT(X+.5),INT(Y+.5)]#4 THEN 3290
3270 PRINT "YOU CAN'T DESTROY STARS SILLY"
3280 GOTO 3420
和C#版本:(And the C# version:)
_2950: Console.WriteLine("TORPEDO TRACK:");
_2960: X = X + _X[1];
_2970: Y = Y + _X[2];
_2980: if (X < .5 || X >= 8.5 || Y < .5 || Y >= 8.5) goto _3420;
_2990: _V[4] = X;
_2991: _V[5] = Y;
_2992: _9000();
_2993: Console.WriteLine();
_3020: if (_A[(int)(X + .5), (int)(Y + .5)] != 0) goto _3080;
_3060: goto _2960;
_3080: if (_A[(int)(X + .5), (int)(Y + .5)] != 2) goto _3230;
_3120: Console.WriteLine("*** KLINGON DESTROYED ***");
_3130: _P[1] = _P[1] - 1;
_3140: _P[3] = _P[3] - 1;
_3150: if (_P[3] <= 0) goto _4040;
_3160: for(I = 1; I <= 3; I += 1) {
_3170: if ((int)(X + .5) != _K[(int)I, 1]) goto _3190;
_3180: if ((int)(Y + .5) == _K[(int)I, 2]) goto _3200;
_3190: ;} I = 3;
_3200: _K[(int)I, 3] = 0;
_3210: goto _3370;
_3230: if (_A[(int)(X + .5), (int)(Y + .5)] != 4) goto _3290;
_3270: Console.WriteLine("YOU CAN'T DESTROY STARS SILLY");
_3280: goto _3420;
为了模拟行号,每行以一个标签开头,该标签由一个下划线和一个数字组成.很好用(To simulate line numbers, each line starts with a label consisting of an underscore followed by a number. That works fine for) GOTO
, 但是关于(, but what about) GOSUB
?检查第2992行.用方法替换了子例程.那几乎行得通.在BASIC中,您不必强迫(? Examine line 2992. Subroutines were replaced with methods. That almost worked. In BASIC, you’re not forced to) RETURN
从子程序.您可以通过以下方式离开他们(from subroutines. You can leave them via) GOTO
.仅在销毁播放器以将其发送回程序的开头以重新开始的情况下使用该命令.我取代了(. That was used only in the case that the player is destroyed to send them back to the beginning of the program to start over. I replaced that) GOTO
带有一个将标志传递回调用方的return语句.调用者检查该标志,并在需要时跳回到程序开始.我还发现有一点(with a return statement that passes a flag back to the caller. The caller inspects the flag and jumps back to the program start if need be. I also discovered that at one point, there is a) GOTO
跳进一个(that jumps into a) FOR
循环. C#不允许您跳转到代码子块中的标签.我改变了(loop. C# won’t let you jump to a label in a sub-block of code. I transformed the) FOR
循环成一个(loop into a) GOTO
循环使C#开心.(loop to make C# happy.)
BASIC程序中的所有变量(包括数组)都是实数类型.但是,在BASIC中,数组和标量可以共享相同的名称.口译员能够将其全部整理出来.但是,C#不太友好.为了解决该问题,我在数组名称前添加了下划线.另外,BASIC中的数组从(All the variables in the BASIC program, including the arrays, are real number type. However, in BASIC, an array and a scalar can share the same name; the interpreter is able to sort it all out. But, C# is less kind. To solve the problem, I prefixed array names with underscores. Also, arrays in BASIC are indexed from) 1
代替(instead of) 0
.为了补偿,我将所有数组的长度增加了(. To compensate, I increased the length of all arrays by) 1
.指数(. Index) 0
从未使用过.(is never used.)
当我开始测试端口时,我注意到了一些(When I started testing my port, I noticed some) string
格式化问题.检查以下BASIC行:(formatting problems. Examine the following BASIC line:)
2726 PRINT TAB(41);"(";
这意味着:打印41个空格,后跟左括号.这很容易翻译,但是其目的是通过将左括号环绕在控制台上来将其插入下一行.我清理了一些东西.游戏中还印有一些表格.我对它们进行了重新格式化,以使其更易于阅读.(That means: Print 41 spaces followed by left-parenthesis. That was easy to translate, but the intension was to push the left-parenthesis onto the next line by letting it wrap around the console. I cleaned some of this stuff up. There are also some tables that get printed in the game. I reformatted them a bit to make them easier to read.)
另一件事:请注意,在这种类型的BASIC中,(One other thing: notice that in this type of BASIC,) #
表示不等于.我花了一段时间才意识到他们为什么选择该符号.(indicates not-equal-to. It took me a while to realize why they chose that symbol.) #
像(resembles) ≠
.(.)
进入星际迷航宇宙(Entering the Star Trek Universe)
现在,我已经准备好玩游戏了.如上所述,我以前从不了解规则.幸运的是,当您运行该程序时,它为您提供了查看说明的选项.我仔细研究了它们.但是,真正了解该怎么做的唯一方法是玩游戏.这是一个演练:(Now, I was ready to play the game. As I mentioned above, I never understood the rules before. Luckily, when you run the program, it gives you the option of viewing instructions. I studied them carefully. But, the only way to really understand what to do is to play the game. Here’s a walkthrough:)
STAR TREK
ENTER 1 OR 2 FOR INSTRUCTIONS (ENTER 2 TO PAGE)
ENTER SEED NUMBER
INITIALIZING...
YOU MUST DESTROY 17 KINGONS IN 30 STARDATES WITH 3 STARBASES
-=--=--=--=--=--=--=--=-
*
STARDATE 2100
* * CONDITION GREEN
<*> QUADRANT 5,2
* SECTOR 5,4
ENERGY 3000
SHIELDS 0
* PHOTON TORPEDOES 10
-=--=--=--=--=--=--=--=-
COMMAND
该游戏通过打印其标题而广为人知.然后,它询问您是否要查看说明.游戏中的每个提示都需要一个数字.如果您按Enter键,则假定为零.在这种情况下,我按Enter键可以跳过说明.接下来,它要求一个种子号来初始化随机化器.这是BASIC的工件.它实际上在C#中没有作用.在BASIC中,就像在C#中一样,可以根据系统时间对随机化器进行初始化.如果这不是一个选择,则他们应该利用说明提示.当指令提示出现时,它可能已经进入一个循环,该循环定时了用户输入值所花费的时间.该持续时间本可以用于初始化随机器.再一次,我只是按Enter来跳过它.(The game makes itself known by printing out its title. Then, it asks you if you want to view instructions. Every prompt in the game demands a number. If you hit Enter, zero is assumed. In this case, I hit Enter to skip the instructions. Next, it asks for a seed number to initialize the randomizer. This is an artifact of BASIC. It doesn’t really have an effect in C#. In BASIC, just as in C#, the randomizer could have been initialized based off the system time. If that was not an option, they should have taken advantage of the instructions prompt. When the instructions prompt appears, it could have entered a loop that timed how long it took the user to enter a value. That duration could have been used to initialize the randomizer. Again, I simply pressed Enter to skip it.)
接下来,它打印出我的任务.我必须在30个单位时间内消灭3颗星基,以消灭17艘Klingon(注意这里的游戏拼写错误).然后,它运行短距离扫描仪.短距离扫描仪显示当前象限.游戏在8×8象限网格中进行.每行和每列的编号为1到8.右侧的文本表示我处于象限(5,2).每个象限被划分为一个8×8的扇形网格.企业位于扇区(5,4).在象限显示中,(Next, it prints out my mission. I have to destroy 17 Klingon (note the game misspells it here) ships in 30 units of time with 3 starbases. Then it runs the short range scanner. The short range scanner displays the current quadrant. The game takes place in an 8×8 quadrant grid. Each row and column is numbered 1 to 8. The text on the right indicates that I am in quadrant (5,2). Each quadrant is partitioned into an 8×8 sector grid. The Enterprise is located at sector (5,4). On the quadrant display,) <*>
是企业.剩余的(is the Enterprise. The remaining) *
是星星.顶部和底部水平线分隔线上的每个=标记表示一列.如果进行计数,则会发现企业位于第5列.如果对行进行计数,则会发现其位于第4行.因此,在此象限内,企业位于指定的扇区(5,4)中.(’s are stars. Each = mark on the top and bottom horizontal-line dividers indicates a column. If you count, you’ll find that the Enterprise is in column 5. If you count the rows, you’ll find it’s in row 4. Hence, within this quadrant, the Enterprise is in sector (5,4) as specified.)
目的是找出包含克林贡舰的象限并摧毁它们.首先,进行远距离传感器扫描(选项2):(The goal is seek out quadrants containing Klingon ships and destroy them. Let’s begin by doing a long range sensor scan (option 2):)
COMMAND 2
LONG RANGE SENSOR SCAN FOR QUADRANT 5,2
-------------------
| 008 | 008 | 004 |
-------------------
| 006 | 005 | 007 |
-------------------
| 001 | 104 | 113 |
-------------------
该表总结了9个象限.中心象限是您当前的象限.数字表示克林贡舰的数量,星基的数量和星的数量.在我们的象限中,没有克林贡船,也没有星基,但是有5星.稍后,我将演示星星是令人讨厌的障碍.在我们南部,有一个象限,其中有1艘克林贡舰.让我们去那里.但是,首先,我们需要提高防护等级(选项5):(This table summarizes 9 quadrants. The center quadrant is your current quadrant. The digits indicate the number of Klingon ships, the number of starbases and the number of stars. In our quadrant, there are no Klingon ships and no starbases, but there are 5 stars. Stars act as annoying obstacles as I’ll demonstrate later on. South of us, there is a quadrant containing 1 Klingon ship. Let’s head there. But, first we need to raise shields (option 5):)
COMMAND 5
ENERGY AVAILABLE = 3000
NUMBER OF UNITS TO SHIELDS 500
它问我要为盾牌投入多少精力.我输入了500.如果我精力不足,就会输掉比赛.星空基地可以补充能量.他们还补充了光子鱼雷并修复了损坏.要查看我还有多少能量,我将再次运行短距离扫描(选项1):(It asks me how much energy I want to devote to the shields. I entered 500. If I run out of energy, I lose the game. Starbases replenish energy. They also restock photon torpedoes and repair damage. To see how much energy I have left, I’ll run a short range scan again (option 1):)
COMMAND 1
-=--=--=--=--=--=--=--=-
*
STARDATE 2100
* * CONDITION GREEN
<*> QUADRANT 5,2
* SECTOR 5,4
ENERGY 2500
SHIELDS 500
* PHOTON TORPEDOES 10
-=--=--=--=--=--=--=--=-
现在,让我们往南走.导航需要2个参数:方向和距离.这是极坐标系,但非常规的.使用此指定方向:(Now, let’s head south. Navigation requires 2 parameters: direction and distance. It’s a polar coordinate system, but an unconventional one. Direction is specified using this:)
4 3 2
`. : .'
`.:.'
5---<*>---1
.':`.
.' : `.
6 7 8
角度从1.0(含)到9.0(不含).请注意,y轴指向下方.因此,尽管它似乎是逆时针角度系统,但实际上是顺时针方向.您还需要考虑纵横比.每列的宽度为3个字符,但每行的高度仅为1个字符.这意味着它不是圆形坐标系.而是椭圆形.(Angle goes from 1.0 (inclusive) to 9.0 (exclusive). Note that the y-axis points downwards. So, although it appears to be a counterclockwise angle system, it’s actually clockwise. You also need to consider the aspect ratio. Each column is 3 characters wide, but each row is only 1 character high. This means that it’s not a circular coordinate system. Rather, it’s a swashed oval.) 距离以翘曲系数单位测量.这样的单位等于象限的长度/高度.要移动到相邻扇区,您需要移动1/8 =0.125的距离.我要向南移动(角度7.0)1个翘曲系数.导航是选项0:(Distance is measured in warp factor units. Such a unit is equal to the length/height of a quadrant. To move to an adjacent sector, you need to move a distance of 1/8 = 0.125. I’m going to move south (angle 7.0) a distance of 1 warp factor. Navigation is option 0:)
COURSE (1-9) 7
WARP FACTOR (0-8) 1
DAMAGE CONTROL REPORT: WARP ENGINES DAMAGED
-=--=--=--=--=--=--=--=-
*
STARDATE 2101
* CONDITION RED
<*> QUADRANT 5,3
SECTOR 5,4
* ENERGY 2497
* SHIELDS 500
+++ PHOTON TORPEDOES 10
-=--=--=--=--=--=--=--=-
导航会自动运行短距离扫描.请注意,我从象限(5,2)移至象限(5,3).另外,请注意,这就是说我的经线引擎已损坏.企业的某些部分自发地失败.当您四处浏览时,它们会慢慢得到修复.让我们获取损坏报告(选项6):(Navigation automatically runs a short range scan. Note that I moved from quadrant (5,2) to quadrant (5,3). Also, notice that is says that my warp engines are damaged. Parts of the Enterprise fail spontaneously. As you navigate around, they slowly get repaired. Let’s get a damage report (option 6):)
COMMAND 6
DEVICE STATE OF REPAIR
WARP ENGINES -3
S.R. SENSORS 0
L.R. SENSORS 0
PHASER CNTRL 0
PHOTON TUBES 0
DAMAGE CNTRL 0
SHIELD CNTRL 0
COMPUTER 0
值0表示正常运行.小于0是伤害.大于0表示组件工作正常.(A value of 0 indicates normal operation. Less-than 0 is damage. Greater-than 0 indicates that the component is working above normal.) 上面的短程扫描显示了克林贡舰(三重).我将使用计算机帮助我瞄准飞船(选项7,然后是选项2):(The short range scan above shows a Klingon ship (the triple-plus). I’m going to use the computer to help me target the ship (option 7 followed by option 2):)
COMMAND 7
COMPUTER ACTIVE AND AWAITING COMMAND 2
DIRECTION = 7
DISTANCE = 4
ENTER 1 TO USE THE CALCULATOR
使用与导航相同的方向和距离坐标系发射光子鱼雷.电脑给了我座标.然后它询问我是否要使用导航计算器.导航计算器要求您输入2个象限的坐标,然后将输出它们之间的方向和距离.我将按Enter表示我对此不感兴趣.现在,让我们发射鱼雷(选项4):(Photon torpedoes are fired using the same direction and distance coordinate system as is used for navigation. The computer gave me the coordinates. Then it asks if I want to use the navigation calculator. The navigation calculator asks you to enter the coordinates of 2 quadrants and it will output direction and distance between them. I’ll press Enter to indicate I am not interested in doing this. Now, let’s fire the torpedo (option 4):)
COMMAND 4
TORPEDO COURSE (1-9) 7
TORPEDO TRACK:
5,5
5,6
5,7
5,8
*** KLINGON DESTROYED ***
COMMAND 1
-=--=--=--=--=--=--=--=-
*
STARDATE 2101
* CONDITION GREEN
<*> QUADRANT 5,3
SECTOR 5,4
* ENERGY 2497
* SHIELDS 500
PHOTON TORPEDOES 9
-=--=--=--=--=--=--=--=-
游戏输出鱼雷的轨迹.在这种情况下,它击中了目标.如果计算机损坏,则必须自己估算Klingon船的方向.可能需要尝试一些.鱼雷轨迹将帮助您优化方向.同样,有时鱼雷会随机地从指定方向转移一点.(The game outputs the track of the torpedo. In this case, it hit the target. If the computer gets damaged, you have to estimate the direction of the Klingon ship yourself. It may take a few tries. The torpedo track will help you refine the direction. Also, sometimes a torpedo randomly diverts a bit from the specified direction.) 让我们使用计算机获取状态报告(选项7,选项1):(Let’s get a status report using the computer (option 7, option 1):)
COMMAND 7
COMPUTER ACTIVE AND AWAITING COMMAND 1
STATUS REPORT
NUMBER OF KLINGONS LEFT = 16
NUMBER OF STARDATES LEFT = 29
NUMBER OF STARBASES LEFT = 3
DEVICE STATE OF REPAIR
WARP ENGINES -3
S.R. SENSORS 0
L.R. SENSORS 0
PHASER CNTRL 0
PHOTON TUBES 0
DAMAGE CNTRL 0
SHIELD CNTRL 0
COMPUTER 0
一架克林贡船降下来,但我的翘曲引擎仍然损坏.让我们进行一次远程扫描:(One Klingon ship down, but my warp engine is still damaged. Let’s do a long range scan:)
COMMAND 2
LONG RANGE SENSOR SCAN FOR QUADRANT 5,3
-------------------
| 006 | 005 | 007 |
-------------------
| 001 | 004 | 113 |
-------------------
| 002 | 005 | 002 |
-------------------
我想向东走.中心1指示的那里的星基可以修复我的翘曲驱动器.我将尝试导航到那里:(I want to go east. The starbase there, indicated by the center 1, can repair my warp drive. I’ll try to navigate there:)
COMMAND 0
COURSE (1-9) 1
WARP FACTOR (0-8) 1
WARP ENGINES ARE DAMAGED, MAXIMUM SPEED = WARP .2
COURSE (1-9) 1
WARP FACTOR (0-8) .2
-=--=--=--=--=--=--=--=-
*
STARDATE 2101
* CONDITION GREEN
<*> QUADRANT 5,3
SECTOR 6,4
* ENERGY 2501
* SHIELDS 500
PHOTON TORPEDOES 9
-=--=--=--=--=--=--=--=-
如您所见,当翘曲驱动器损坏时,我一次只能移动1个扇区.(As you can see, when the warp drive is damaged, I can only move 1 sector at a time.)
DAMAGE CONTROL REPORT: L.R. SENSORS DAMAGED
-=--=--=--=--=--=--=--=-
*
STARDATE 2101
* CONDITION GREEN
<*> QUADRANT 5,3
SECTOR 7,4
* ENERGY 2505
* SHIELDS 500
PHOTON TORPEDOES 9
-=--=--=--=--=--=--=--=-
COMMAND 0
COURSE (1-9) 1
WARP FACTOR (0-8) .2
-=--=--=--=--=--=--=--=-
*
STARDATE 2101
* CONDITION GREEN
<*> QUADRANT 5,3
SECTOR 8,4
* ENERGY 2509
* SHIELDS 500
PHOTON TORPEDOES 9
-=--=--=--=--=--=--=--=-
COMMAND 0
COURSE (1-9) 1
WARP FACTOR (0-8) .2
-=--=--=--=--=--=--=--=-
+++ STARDATE 2102
* * CONDITION RED
<*> QUADRANT 6,3
SECTOR 1,4
>!< ENERGY 2513
SHIELDS 500
* PHOTON TORPEDOES 9
-=--=--=--=--=--=--=--=-
我设法到达那里,但是现在我的远程扫描仪已损坏.请注意,每次您跨过一个象限边界时,星标就会前进.我必须在任务期限内消灭所有克林贡族人.(I managed to get over there, but now my long range scanner is damaged. Note that each time you cross a quadrant boundary, the stardate advances. I have to destroy all the Klingons in the time restriction of my mission.)
的(The) >!<
符号表示星基.如果我在其旁边导航,则Enterprise会自动停靠,此时我将修复所有设备.但是,如果我尝试在那航行,那艘克林贡舰将向我开火.因为星星,我无法发出光子鱼雷.星星将阻塞轨道.让我检查一下这些维修:(symbol indicates a starbase. If I navigate next to it, the Enterprise will automatically dock at which time I’ll get everything repaired. But, if I try to navigate there, the Klingon ship will fire at me. I can’t send out a photon torpedo because of the stars. The stars will obstruct the track. Let me check on those repairs:)
COMMAND 7
COMPUTER ACTIVE AND AWAITING COMMAND 1
STATUS REPORT
NUMBER OF KLINGONS LEFT = 16
NUMBER OF STARDATES LEFT = 28
NUMBER OF STARBASES LEFT = 3
DEVICE STATE OF REPAIR
WARP ENGINES 0
S.R. SENSORS 0
L.R. SENSORS 0
PHASER CNTRL 0
PHOTON TUBES 0
DAMAGE CNTRL 0
SHIELD CNTRL 0
COMPUTER 0
真好企业已恢复正常.我将尝试使用移相器来打Klingons(选项3):(Nice. The Enterprise is back to normal. I’ll try using my phasers to hit the Klingons (option 3):)
COMMAND 3
PHASERS LOCKED ON TARGET. ENERGY AVAILABLE = 2513
NUMBER OF UNITS TO FIRE 500
19 UNIT HIT ON ENTERPRISE FROM SECTOR 7,2
(480 LEFT)
67 UNIT HIT ON KLINGON AT SECTOR 7,2
(132 LEFT)
企业受到打击.我的盾牌掉了少量.克林贡舰也被损坏.我会再次开火:(The Enterprise was hit. My shields dropped a small amount. The Klingon ship was damaged as well. I’ll fire again:)
COMMAND 3
PHASERS LOCKED ON TARGET. ENERGY AVAILABLE = 2013
NUMBER OF UNITS TO FIRE 1000
16 UNIT HIT ON ENTERPRISE FROM SECTOR 7,2
(464 LEFT)
100 UNIT HIT ON KLINGON AT SECTOR 7,2
(31 LEFT)
COMMAND 3
PHASERS LOCKED ON TARGET. ENERGY AVAILABLE = 1013
NUMBER OF UNITS TO FIRE 300
5 UNIT HIT ON ENTERPRISE FROM SECTOR 7,2
(458 LEFT)
62 UNIT HIT ON KLINGON AT SECTOR 7,2
(0 LEFT)
*** KLINGON AT SECTOR 7,2 DESTROYED ***
COMMAND 1
-=--=--=--=--=--=--=--=-
STARDATE 2102
* * CONDITION GREEN
<*> QUADRANT 6,3
SECTOR 1,4
>!< ENERGY 713
SHIELDS 458
* PHOTON TORPEDOES 9
-=--=--=--=--=--=--=--=-
我开了两次,严重降低了我的精力水平.移相器强度是企业与目标之间距离的度量.向北导航以找到一条光子鱼雷的清晰路径可能会更好.幸运的是,我可以与星空对接以补充能量:(I fired twice, which severely lowered my energy level. Phaser strength is a measure of the distance between the Enterprise the target. It probably would have been better to navigate north for a clear path for a photon torpedo. Luckily, I can dock with the starbase to replenish my energy:)
COMMAND 0
COURSE (1-9) 7
WARP FACTOR (0-8) .25
-=--=--=--=--=--=--=--=-
STARDATE 2102
* * CONDITION GREEN
QUADRANT 6,3
SECTOR 1,6
<*> >!< ENERGY 716
SHIELDS 458
* PHOTON TORPEDOES 9
-=--=--=--=--=--=--=--=-
COMMAND 0
COURSE (1-9) 1
WARP FACTOR (0-8) 1
WARP ENGINES SHUTDOWN AT SECTOR 6,6 DUE TO BAD NAVIGATION
SHIELDS DROPPED FOR DOCKING PURPOSES
-=--=--=--=--=--=--=--=-
STARDATE 2103
* * CONDITION DOCKED
QUADRANT 6,3
SECTOR 5,6
<*>>!< ENERGY 3000
SHIELDS 0
* PHOTON TORPEDOES 10
-=--=--=--=--=--=--=--=-
星空基地在夺回我3000之前先夺走了我所有的盾牌能量.如果游戏不这样做,玩家可以通过反复对接并将能量转移到盾牌上来获得无限的盾牌强度.(The starbase takes away all my shield energy before giving me back 3000. If the game didn’t do this, the player could get infinite shield strength by repeatedly docking and transferring energy to the shields.) 另请注意,我是通过崩溃进入星际基地而停靠的.当您处于一个象限内时,您将无法穿过恒星,飞船和星基.但是,离开当前象限后,这些不再是障碍.实际上,象限内的星,星基和克林贡舰的位置在游戏开始时并未确定.相反,这些位置是在您进入象限时发明的.它产生了一种幻想,即恒星,星基和克林贡舰可以在一个象限内移动.请注意,它们永远不能移出象限.(Also note that I docked by crashing into the starbase. While you are within a quadrant, you can’t pass through stars, ships and starbases. However, after leaving the current quadrant, those are no longer obstacles. In fact, the positions of stars, starbases and Klingon ships within a quadrant is not determined at the start of the game. Rather, the positions are invented at the time you enter a quadrant. It creates the illusion that stars, starbases and Klingon ships can move around within a quadrant. Note that they can never move out of a quadrant.)
COMMAND 2
LONG RANGE SENSOR SCAN FOR QUADRANT 6,3
-------------------
| 005 | 007 | 007 |
-------------------
| 004 | 013 | 001 |
-------------------
| 005 | 002 | 016 |
-------------------
您在远程扫描中看到的值是游戏跟踪的唯一值.在输入象限之前,它不会存储每个实体的确切扇区.与此相关的是,计算机可以向您显示所有扫描象限的表格(选项7,选项0):(The values you see in a long range scan are the only values tracked by the game. It doesn’t store the exact sectors of each entity within a quadrant until you enter it. On a related note, the computer can show you a table of all scanned quadrants (option 7, option 0):)
COMMAND 7
COMPUTER ACTIVE AND AWAITING COMMAND 0
COMPUTER RECORD OF GALAXY FOR QUADRANT 6,3
-------------------------------------------------
| 000 | 000 | 000 | 008 | 008 | 004 | 000 | 000 |
-------------------------------------------------
| 000 | 000 | 000 | 006 | 005 | 007 | 007 | 000 |
-------------------------------------------------
| 000 | 000 | 000 | 001 | 004 | 013 | 001 | 000 |
-------------------------------------------------
| 000 | 000 | 000 | 002 | 005 | 002 | 016 | 000 |
-------------------------------------------------
| 000 | 000 | 000 | 000 | 000 | 000 | 000 | 000 |
-------------------------------------------------
| 000 | 000 | 000 | 000 | 000 | 000 | 000 | 000 |
-------------------------------------------------
| 000 | 000 | 000 | 000 | 000 | 000 | 000 | 000 |
-------------------------------------------------
| 000 | 000 | 000 | 000 | 000 | 000 | 000 | 000 |
-------------------------------------------------
无论如何,这就是游戏的要旨.(Anyway, that’s the gist of the game.) 那么,当您获胜时会发生什么?(So, what happens when you win?)
THE LAST KLIGON BATTLE CRUISER IN THE GALAXY HAS BEEN DESTROYED
THE FEDERATION HAS BEEN SAVED !!!
YOUR EFFICIENCY RATING = ...
然后它又开始了新的任务.效率等级是剩余时间的函数.在Mike Mayfield的原始版本中,剩余时间实际上是几分钟.如前所述,在此版本中,依次出现.(And then it just starts over again with a new mission. The efficiency rating is a function of the time remaining. In Mike Mayfield’s original version, the time remaining was actually in minutes. As mentioned, in this version, it’s in turns.)
超级星际迷航(Super Star Trek)
1976年,Creative Computing发布了Mike Mayfield名为"超级星际迷航"的程序的修改版.它实际上与原始游戏相同.但是,菜单接受3个字母助记符而不是数字.电脑提供了更多选择.而且,只是为了娱乐,每个象限都有一个名称.考虑到这些想法,我决定编写自己的游戏版本.我从挖掘一些古老的ASCII艺术开始…(In 1976, Creative Computing published a modified version of Mike Mayfield’s program titled Super Star Trek. It’s virtually identical to the original game. However, the menus accept 3 letter mnemonics instead of numbers. The computer offers a few more options. And, just for fun, each quadrant has a name. With those ideas in mind, I decided to code my own version of the game. I began by digging up some ancient ASCII art…)
______ _______ ______ ______ _______ ______ ______ __ __
/ __ //__ __// __ // __ / /__ __// __ / / ____// / / /
/ / /_/ / / / /_/ // /_/ / / / / /_/ / / /__ / // /
_\ \ / / / __ // __/ / / / __/ / __ / / /
/ /_/ / / / / / / // /\ \ / / / /\ \ / /___ / /\ \
/_____/ /_/ /_/ /_//_/ \_\ /_/ /_/ \_\/_____//_/ \_\
________________ _
\__(=======/_=_/____.--'-`--.___
\ \ `,--,-.___.----'
.--`\\--'../
'---._____.|]
Mission: Destroy 20 Klingon ships in 46 stardates with 3 starbases.
Enter command:
--- Commands -----------------
nav = Navigation
srs = Short Range Scan
lrs = Long Range Scan
pha = Phaser Control
tor = Photon Torpedo Control
she = Shield Control
com = Access Computer
Enter command: srs
-=--=--=--=--=--=--=--=- Region: Altair IV
Quadrant: [2,5]
* Sector: [1,6]
Stardate: 2287
* Time remaining: 46
Condition: GREEN
<*> Energy: 3000
Shields: 0
* Photon Torpedoes: 10
-=--=--=--=--=--=--=--=- Docked: False
Enter command: lrs
-------------------
| 117 | 118 | 004 |
-------------------
| 006 | 003 | 008 |
-------------------
| 004 | 001 | 115 |
-------------------
Enter command: nav
Enter course (1.0--9.0): 3
Enter warp factor (0.1--8): 1
Warp engines engaged.
-=--=--=--=--=--=--=--=- Region: Risa
* * Quadrant: [2,4]
Sector: [1,6]
+++ * * Stardate: 2288
* Time remaining: 45
>!< Condition: RED
<*> * Energy: 3000
Shields: 0
* * Photon Torpedoes: 10
-=--=--=--=--=--=--=--=- Docked: True
Condition RED: Klingon ship detected.
Lowering shields as part of docking sequence...
Enterprise successfully docked with starbase.
Enter command: pha
Phasers locked on target.
Enter phaser energy (1--3000): 500
Firing phasers...
Hit ship at sector [5,3]. Klingon shield strength dropped to 206.
Enterprise hit by ship at sector [5,3]. No damage due to starbase shields.
Enter command: pha
Phasers locked on target.
Enter phaser energy (1--2500): 500
Firing phasers...
Klingon ship destroyed at sector [5,3].
Enter command: srs
-=--=--=--=--=--=--=--=- Region: Risa
* * Quadrant: [2,4]
Sector: [1,6]
* * Stardate: 2288
* Time remaining: 45
>!< Condition: GREEN
<*> * Energy: 2000
Shields: 0
* * Photon Torpedoes: 10
-=--=--=--=--=--=--=--=- Docked: True
Enter command:
原始游戏中有许多细微差别.企业的不同部分多久发生一次故障?光子鱼雷如何以及何时随机偏离其指定目标?等等.没关系.就像我在上面说的那样,这种游戏在每次交易时都应该被重新发明.星际迷航>宇宙的确切参数取决于编码器.例如,在我的版本中,企业中不同部分的故障取决于您使用它们的频率.如果您过多地依赖计算机来定位Klingon,则计算机将开始出现故障.(There are many subtle nuances in the original game. How often do different parts of the Enterprise malfunction? How and when do photon torpedoes randomly deviate from their specified targets? And so on. It doesn’t really matter. As I said above, this is the kind of game that deserves to be reinvented everytime it trades hands. The exact parameters of the Star Trek universe are up to the coder. For example, in my version, different parts of the Enterprise malfunction depending on how often you use them. If you rely on the computer for targeting Klingon ships too much, the computer will start to fail.)
重写游戏带来了BASIC版本一个有趣的方面.定位是使用极坐标完成的,但在BASIC代码中找不到任何三角函数.我认为这些功能不可用.取而代之的是,使用近似三角函数的不同比率将角度转换为方向向量.这意味着即使您使用三角法确定了完美的目标,在输入角度时,实际轨迹也会略有偏离.尽管如此,这是一个非常聪明的数学技巧.至于我,我利用了(Rewriting the game brought up an interesting aspect of the BASIC version. Targeting is done using polar coordinates, but you won’t find any trigonometric functions in the BASIC code. I assume the functions were unavailable. Instead, the angle is converted into a direction vector using different ratios that approximate the trigonometric functions. That means even if you worked out perfect targeting using trigonometry, when you entered in the angle, the actual trajectory will be slightly off. Nonetheless, it’s a pretty clever math trick. As for me, I took advantage of) Math.Sin()
和(and) Math.Cos()
.(.)
最后,如果您准备进入ASCII星际迷航世界,并保存联合会免受Klingon加号的攻击,请下载随附的源代码.(Finally, if you’re ready to enter the ASCII Star Trek universe and save the Federation from attacking Klingon plus-signs, download the attached source code.)
参考文献(References)
- 星际迷航游戏历史:(Star Trek Game History:) http://www3.sympatico.ca/maury/games/space/star_trek.html(http://www3.sympatico.ca/maury/games/space/star_trek.html)
- 维基:(Wiki:) http://en.wikipedia.org/wiki/Star_Trek_%28text_game%29(*http://en.wikipedia.org/wiki/Star_Trek_%28text_game%29*)
- 迈克`梅菲尔德的原始代码:(Mike Mayfield’s Original Code:) http://www.dunnington.u-net.com/public/startrek/STTR1(http://www.dunnington.u-net.com/public/startrek/STTR1)
- 增强版:(Enhanced Version:) http://newton.freehostia.com/hp/bas/TREKPT.txt(http://newton.freehostia.com/hp/bas/TREKPT.txt)
- 超级星际迷航:(Super Star Trek:) http://www.atariarchives.org/bcc1/showpage.php?page=275(http://www.atariarchives.org/bcc1/showpage.php?page=275)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C# Windows Dev 新闻 翻译