按字符计数的最短代码输入板的2D表示,并根据输入输出"true"或"false" .
该板由4种类型的瓷砖制成:
# - A solid wall
x - The target the laser has to hit
/ or \ - Mirrors pointing to a direction (depends on laser direction)
v, ^, > or < - The laser pointing to a direction (down, up, right and left respectively)
Run Code Online (Sandbox Code Playgroud)
只有一个激光器,只有一个目标.墙必须形成任何大小的实心矩形,激光和目标放在里面."房间"内的墙壁是可能的.
激光射击并从其原点移动到它指向的方向.如果激光射到墙上,它就会停止.如果激光射到镜子上,它会反射到镜子指向的方向90度.镜子是双面的,这意味着两面都是"反光的"并且可以以两种方式反射光线.如果激光射击激光(^v><)本身,则将其视为墙壁(激光束会破坏投影仪,因此它永远不会击中目标).
Input:
##########
# / \ #
# #
# \ x#
# > / #
##########
Output:
true
Input:
##########
# …