Make each train move forwards slowly until it finds a parachute. When the back train finds the parachute of the front train, make it move forwards faster to catch up with the front train.
label1: MF
If (P)
{
// Do nothing (because of no then?)
}
ELSE
{
MF;
MB;
GOTO label1;
}
label 2:MF
GOTO label2;
GO forward 2 times, backward 1 times until meet the other train's parachute go forward like crazy (to bump into the other - it's still Forward then backward - meaning it's go slower). I use MF one time in label 2, mean it take 2 clock cycle to go one step forward. In label1 it took 5 clock cycle to go forward one steps. So if we use more MF in label2 two of them will bump into eachother faster. No variable used.
发布评论
评论(2)
让每列火车缓慢前进,直到找到降落伞。当后面的列车发现前面的列车的降落伞时,使其更快地向前行驶以追上前面的列车。
如果您想让火车到达彼此所需的时间更少,但需要编写一些额外的代码行,您可以展开第二个循环。
Make each train move forwards slowly until it finds a parachute. When the back train finds the parachute of the front train, make it move forwards faster to catch up with the front train.
If you want to make it take less time for the trains to reach each other, at the cost of some extra lines of code, you can unroll the second loop.
向前走 2 次,向后走 1 次,直到遇到另一列火车的降落伞,疯狂地向前行驶(撞到另一列火车 - 它仍然是向前然后向后 - 意味着它走得更慢)。我在标签2中使用了一次MF,意味着前进一步需要2个时钟周期。
在label1中,前进一步需要5个时钟周期。因此,如果我们在 label2 中使用更多 MF,其中两个会更快地碰撞。
没有使用变量。
GO forward 2 times, backward 1 times until meet the other train's parachute go forward like crazy (to bump into the other - it's still Forward then backward - meaning it's go slower). I use MF one time in label 2, mean it take 2 clock cycle to go one step forward.
In label1 it took 5 clock cycle to go forward one steps. So if we use more MF in label2 two of them will bump into eachother faster.
No variable used.