피에트, 120 코덱
codelsize 20의 경우 :
참고 / 어떻게 작동합니까?
배열 또는 문자열을 입력으로 사용할 수 없으므로이 프로그램은 일련의 정수 (아스키 문자를 나타냄)를 입력으로 사용하여 작동합니다. 처음에는 문자 입력을 사용하는 것에 대해 생각했지만 종료를위한 멋진 솔루션을 찾기 위해 고심 했으므로 이제 1보다 작은 숫자가 입력되면 종료됩니다. 그래서 지금은 필요에 맞지 않을 수 있습니다, 그것은 해지 원래 부정적인 값이었다, 그러나 나는 프로그램을 작성 후 초기화를 변경했다 2
만, 1
(추적 이미지에 45분의 26). 챌린지 규칙에 따라 인쇄 가능한 ASCII 문자 만 허용되므로 문제가되지 않습니다.
루프를 다시 입력하는 데 오랜 시간 동안 어려움을 겪었지만 결국에는 우아한 솔루션을 찾았습니다. 입력 pointer
또는 switch
판독을 읽기 위해 녹색 코덱으로 다시 전환 될 때까지 통역사 만 벽으로 실행됩니다 (추적 이미지에서 43-> 44).
먼저 입력을 복제하고 1을 추가 한 다음 입력이 1보다 큰지 확인하여 루프 종료가 발생합니다.이 경우 코덱 선택기가 트리거되고 하위 경로에서 실행이 계속됩니다. 그렇지 않은 경우 프로그램은 왼쪽으로 계속 진행됩니다 (추적 이미지의 밝은 노란색 코덱, 31/50).
지원되는 입력 크기는 인터프리터 구현에 따라 다르지만 올바른 인터프리터를 사용하여 임의로 큰 입력을 지원할 수 있습니다 (예 BigInteger
: 내부 값으로 사용되는 Java 인터프리터 )
설정에 불필요한 것이 하나 DUP
있고 CC
(트레이스 이미지에 7-> 8-> 9) 있음을 보았습니다 . 어떻게 된건 지 모르겠습니다. 이것은 사실상 noop입니다. 코덱 선택기를 16 번 토글하여 아무런 변화가 없습니다.
니 피트 추적 이미지
설정 및 첫 번째 루프 :
루프 종료, 출력 및 종료 :
출력
하나의 출력 만 포함하면 용서하십시오. 입력하는 데 시간이 오래 걸립니다 : ^)
String: "Eagles are great!"
PS B:\Marvin\Desktop\Piet> .\npiet.exe adler32.png
? 69
? 97
? 103
? 108
? 101
? 115
? 32
? 97
? 114
? 101
? 32
? 103
? 114
? 101
? 97
? 116
? 33
? -1
918816254
[65, -1]에 대한 Npiet 추적
trace: step 0 (0,0/r,l nR -> 1,0/r,l dR):
action: push, value 4
trace: stack (1 values): 4
trace: step 1 (1,0/r,l dR -> 2,0/r,l dB):
action: duplicate
trace: stack (2 values): 4 4
trace: step 2 (2,0/r,l dB -> 3,0/r,l nM):
action: multiply
trace: stack (1 values): 16
trace: step 3 (3,0/r,l nM -> 4,0/r,l nC):
action: duplicate
trace: stack (2 values): 16 16
trace: step 4 (4,0/r,l nC -> 5,0/r,l nY):
action: duplicate
trace: stack (3 values): 16 16 16
trace: step 5 (5,0/r,l nY -> 6,0/r,l nM):
action: duplicate
trace: stack (4 values): 16 16 16 16
trace: step 6 (6,0/r,l nM -> 7,0/r,l nC):
action: duplicate
trace: stack (5 values): 16 16 16 16 16
trace: step 7 (7,0/r,l nC -> 8,0/r,l nY):
action: duplicate
trace: stack (6 values): 16 16 16 16 16 16
trace: step 8 (8,0/r,l nY -> 9,0/r,l lB):
action: switch
trace: stack (5 values): 16 16 16 16 16
trace: stack (5 values): 16 16 16 16 16
trace: step 9 (9,0/r,l lB -> 10,0/r,l dM):
action: multiply
trace: stack (4 values): 256 16 16 16
trace: step 10 (10,0/r,l dM -> 11,0/r,l nR):
action: multiply
trace: stack (3 values): 4096 16 16
trace: step 11 (11,0/r,l nR -> 12,0/r,l lY):
action: multiply
trace: stack (2 values): 65536 16
trace: step 12 (12,0/r,l lY -> 13,0/r,l lM):
action: duplicate
trace: stack (3 values): 65536 65536 16
trace: step 13 (13,0/r,l lM -> 14,0/r,l nM):
action: push, value 3
trace: stack (4 values): 3 65536 65536 16
trace: step 14 (14,0/r,l nM -> 15,0/r,l dM):
action: push, value 2
trace: stack (5 values): 2 3 65536 65536 16
trace: step 15 (15,0/r,l dM -> 16,0/r,l lC):
action: roll
trace: stack (3 values): 16 65536 65536
trace: step 16 (16,0/r,l lC -> 17,0/r,l nB):
action: sub
trace: stack (2 values): 65520 65536
trace: step 17 (17,0/r,l nB -> 18,0/r,l dB):
action: push, value 1
trace: stack (3 values): 1 65520 65536
trace: step 18 (18,0/r,l dB -> 19,0/r,l dM):
action: add
trace: stack (2 values): 65521 65536
trace: step 19 (19,0/r,l dM -> 19,1/d,r dC):
action: duplicate
trace: stack (3 values): 65521 65521 65536
trace: step 20 (19,1/d,r dC -> 18,1/l,l lC):
action: push, value 1
trace: stack (4 values): 1 65521 65521 65536
trace: step 21 (18,1/l,l lC -> 17,1/l,l nC):
action: push, value 1
trace: stack (5 values): 1 1 65521 65521 65536
trace: step 22 (17,1/l,l nC -> 16,1/l,l dB):
action: sub
trace: stack (4 values): 0 65521 65521 65536
trace: step 23 (16,1/l,l dB -> 15,1/l,l lB):
action: push, value 1
trace: stack (5 values): 1 0 65521 65521 65536
trace: step 24 (15,1/l,l lB -> 13,2/l,l dG):
action: in(number)
? 65
trace: stack (6 values): 65 1 0 65521 65521 65536
trace: step 25 (13,2/l,l dG -> 12,2/l,l dR):
action: duplicate
trace: stack (7 values): 65 65 1 0 65521 65521 65536
trace: step 26 (12,2/l,l dR -> 11,2/l,l lR):
action: push, value 1
trace: stack (8 values): 1 65 65 1 0 65521 65521 65536
trace: step 27 (11,2/l,l lR -> 10,2/l,l lY):
action: add
trace: stack (7 values): 66 65 1 0 65521 65521 65536
trace: step 28 (10,2/l,l lY -> 9,2/l,l nY):
action: push, value 1
trace: stack (8 values): 1 66 65 1 0 65521 65521 65536
trace: step 29 (9,2/l,l nY -> 8,1/l,r nB):
action: greater
trace: stack (7 values): 1 65 1 0 65521 65521 65536
trace: step 30 (8,1/l,r nB -> 7,1/l,r lY):
action: switch
trace: stack (6 values): 65 1 0 65521 65521 65536
trace: stack (6 values): 65 1 0 65521 65521 65536
trace: step 31 (7,1/l,l lY -> 6,2/l,l nY):
action: push, value 2
trace: stack (7 values): 2 65 1 0 65521 65521 65536
trace: step 32 (6,2/l,l nY -> 5,3/l,l dB):
action: pointer
trace: stack (6 values): 65 1 0 65521 65521 65536
trace: step 33 (5,3/r,l dB -> 7,4/r,l dM):
action: add
trace: stack (5 values): 66 0 65521 65521 65536
trace: step 34 (7,4/r,l dM -> 8,4/r,l dC):
action: duplicate
trace: stack (6 values): 66 66 0 65521 65521 65536
trace: step 35 (8,4/r,l dC -> 9,3/r,l lC):
action: push, value 3
trace: stack (7 values): 3 66 66 0 65521 65521 65536
trace: step 36 (9,3/r,l lC -> 10,3/r,l nC):
action: push, value 2
trace: stack (8 values): 2 3 66 66 0 65521 65521 65536
trace: step 37 (10,3/r,l nC -> 11,3/r,l dY):
action: roll
trace: stack (6 values): 0 66 66 65521 65521 65536
trace: step 38 (11,3/r,l dY -> 12,3/r,l dG):
action: add
trace: stack (5 values): 66 66 65521 65521 65536
trace: step 39 (12,3/r,l dG -> 13,3/r,l lG):
action: push, value 2
trace: stack (6 values): 2 66 66 65521 65521 65536
trace: step 40 (13,3/r,l lG -> 14,3/r,l nG):
action: push, value 1
trace: stack (7 values): 1 2 66 66 65521 65521 65536
trace: step 41 (14,3/r,l nG -> 15,3/r,l dR):
action: roll
trace: stack (5 values): 66 66 65521 65521 65536
trace: white cell(s) crossed - continuing with no command at 17,3...
trace: step 42 (15,3/r,l dR -> 17,3/r,l lB):
trace: step 43 (17,3/r,l lB -> 13,2/l,l dG):
action: in(number)
? -1
trace: stack (6 values): -1 66 66 65521 65521 65536
trace: step 44 (13,2/l,l dG -> 12,2/l,l dR):
action: duplicate
trace: stack (7 values): -1 -1 66 66 65521 65521 65536
trace: step 45 (12,2/l,l dR -> 11,2/l,l lR):
action: push, value 1
trace: stack (8 values): 1 -1 -1 66 66 65521 65521 65536
trace: step 46 (11,2/l,l lR -> 10,2/l,l lY):
action: add
trace: stack (7 values): 0 -1 66 66 65521 65521 65536
trace: step 47 (10,2/l,l lY -> 9,2/l,l nY):
action: push, value 1
trace: stack (8 values): 1 0 -1 66 66 65521 65521 65536
trace: step 48 (9,2/l,l nY -> 8,1/l,r nB):
action: greater
trace: stack (7 values): 0 -1 66 66 65521 65521 65536
trace: step 49 (8,1/l,r nB -> 7,1/l,r lY):
action: switch
trace: stack (6 values): -1 66 66 65521 65521 65536
trace: stack (6 values): -1 66 66 65521 65521 65536
trace: step 50 (7,1/l,r lY -> 6,1/l,r dY):
action: pop
trace: stack (5 values): 66 66 65521 65521 65536
trace: step 51 (6,1/l,r dY -> 4,1/l,r lY):
action: push, value 3
trace: stack (6 values): 3 66 66 65521 65521 65536
trace: step 52 (4,1/l,r lY -> 3,1/l,r nY):
action: push, value 2
trace: stack (7 values): 2 3 66 66 65521 65521 65536
trace: step 53 (3,1/l,r nY -> 2,1/l,r nM):
action: duplicate
trace: stack (8 values): 2 2 3 66 66 65521 65521 65536
trace: step 54 (2,1/l,r nM -> 1,1/l,r dG):
action: pointer
trace: stack (7 values): 2 3 66 66 65521 65521 65536
trace: step 55 (1,1/r,r dG -> 2,2/r,r lR):
action: roll
trace: stack (5 values): 65521 66 66 65521 65536
trace: step 56 (2,2/r,r lR -> 2,3/d,l nR):
action: push, value 1
trace: stack (6 values): 1 65521 66 66 65521 65536
trace: step 57 (2,3/d,l nR -> 2,4/d,l lC):
action: switch
trace: stack (5 values): 65521 66 66 65521 65536
trace: stack (5 values): 65521 66 66 65521 65536
trace: step 58 (2,4/d,r lC -> 2,5/d,r nM):
action: mod
trace: stack (4 values): 66 66 65521 65536
trace: step 59 (2,5/d,r nM -> 4,5/r,r dM):
action: push, value 3
trace: stack (5 values): 3 66 66 65521 65536
trace: step 60 (4,5/r,r dM -> 6,5/r,r lM):
action: push, value 2
trace: stack (6 values): 2 3 66 66 65521 65536
trace: step 61 (6,5/r,r lM -> 7,5/r,r nC):
action: roll
trace: stack (4 values): 65521 66 66 65536
trace: step 62 (7,5/r,r nC -> 8,5/r,r dM):
action: mod
trace: stack (3 values): 66 66 65536
trace: step 63 (8,5/r,r dM -> 11,5/r,r lM):
action: push, value 3
trace: stack (4 values): 3 66 66 65536
trace: step 64 (11,5/r,r lM -> 12,5/r,r nM):
action: push, value 1
trace: stack (5 values): 1 3 66 66 65536
trace: step 65 (12,5/r,r nM -> 13,5/r,r dC):
action: roll
trace: stack (3 values): 66 65536 66
trace: step 66 (13,5/r,r dC -> 14,5/r,r nB):
action: multiply
trace: stack (2 values): 4325376 66
trace: step 67 (14,5/r,r nB -> 15,5/r,r nM):
action: add
trace: stack (1 values): 4325442
trace: step 68 (15,5/r,r nM -> 16,5/r,r dB):
action: out(number)
4325442
trace: stack is empty
trace: white cell(s) crossed - continuing with no command at 19,5...
trace: step 69 (16,5/r,r dB -> 19,5/r,r nM):