Redstone是Minecraft游戏中的一种材料,可用于许多复杂的装置。对于此程序,您只需模拟三个项目:红石线(用R表示),红石火炬(用T表示)和块(用B表示)。
以下是有关红石原理的基本规则列表:
A redstone torch sends power to any adjacent redstone wire.
TRRRR
^This redstone wire is powered.
Redstone wire can only hold power for 15 blocks.
TRRRRRRRRRRRRRRRR
^This last wire is unpowered, because the torch is >15 blocks away.
A block is said to be powered if a powered redstone wire is found adjacent to it.
TRRRB
^This block is powered.
If a block next to a redstone torch is powered, then the torch stops emitting power.
T
R
R
R
B <This block is powered.
T <This redstone torch does not emit power because of the block next to it.
R <This redstone is unpowered because the torch is not providing power.
R
输入将以不超过64x64的二维数组形式给出,如下所示:
TRRR
B
TBRTRR
R
RRRRRRRRR
R
RRRRRR
可以确保输入没有任何“时钟”,也不会由火炬驱动的红石指向火炬打开的块。每个输入只有一个红石电路。
您的程序必须将每个字符更改为1或0,表示此项目是带电/不通电的1,如果不带电/不通电则为0。
此输入应具有以下输出:
1111
1
100000
1
111111111
1
001111
这是一个代码高尔夫,因此一如既往地赢得了最短的代码。
111\n0 1\n000
是输出;似乎在规则之内。我将设置输入限制,说您不能有类似的情况TRR B R RRR
反复闪烁。
我们是否可以像您的示例那样假设每个输入阵列仅包含一个从上到下运行的完整电路,还是我们必须为从阵列中任何位置开始的多个独立电路编写代码?
—
格雷厄姆
@格雷厄姆:每个输入只有一个红石电路。
—
beary605
知道了《我的世界》游戏后,我认为在您的示例中,鉴于第2行上的方块,并不能阻止相邻的割炬通电(红石实际上并未连接到方块)。这是错误还是简化?
—
tomsmeding
"TRR\nB B\nRRT"
?