gpt4 book ai didi

esoteric-languages - Piet中的DP和CC如何变化?

转载 作者:行者123 更新时间:2023-12-04 18:53:18 26 4
gpt4 key购买 nike

根据规范,

Black colour blocks and the edges of the program restrict program flow. If the Piet interpreter attempts to move into a black block or off an edge, it is stopped and the CC is toggled. The interpreter then attempts to move from its current block again. If it fails a second time, the DP is moved clockwise one step. These attempts are repeated, with the CC and DP being changed between alternate attempts. If after eight attempts the interpreter cannot leave its current colour block, there is no way out and the program terminates.


除非我没有正确阅读它,否则这与斐波那契数列示例的行为不符:

(来自: http://www.dangermouse.net/esoteric/piet/samples.html)
具体来说,为什么DP撞到左边缘时会在(0,3)((0,0)是(top,left))处向左转?此时,DP和CC都为LEFT,因此,按我的阅读,顺序应为:
  • 通过在(0,4)处离开边缘尝试(失败)
  • 将CC切换为RIGHT,
  • 尝试(并且失败)通过离开(0,2)的边缘来离开该块。
  • 将DP旋转到UP,
  • 尝试(并成功)通过在(1,1)处进入白色块来离开(1,2)处的块

  • 轨迹指示的行为似乎是DP一直旋转,使CC保持在LEFT。
    我误会了什么?

    最佳答案

    您的分析似乎正确;样本有问题。 (1,1)处的白色块应为黑色。您可以通过获取示例图像并执行它来验证这一点。

    请注意,从DMM的页面链接的interpreters中至少有三个是错误的-Marc Majcher的已标记为这样,Sylvain Tintillier的遍历和输出正确,但从规范中切换了in和inn的含义(this是无错误的版本),并且PietDev错误地遍历了色块。

    编辑:其他白色块可能也需要是黑色的,例如(6,3)处的块。

    关于esoteric-languages - Piet中的DP和CC如何变化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2736380/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com