- 136.2k
- 14
- 154
- 394
- 136.2k
- 14
- 154
- 394
UsingSince I was curious, I also made a program using the actual PI-digits and drawing them in the specified pattern one by one using the Canvas builtin Λ is. Which surprisingly enough is not that much larger (97 bytes ):
See this 05AB1E tip of mine (section How to compress large integers? and How to compress integer lists?) to understand how the compressed parts works.
See this 05AB1E tip of mine
So we use the following options for an in-depth explanation of how the Canvas builtin works.:
- \$a\$ length:
2(all lines are of size 2; or basically 1 since they're overlapping previous lines) - \$b\$ the characters we want to display, which are the digits of PI with the spaces we added to travel around
- \$c\$ the directions, where
8is a reset to the origin where we started, and the other directions are:
7 0 1
↖ ↑ ↗
6 ← X → 2
↙ ↓ ↘
5 4 3
Here some of the first steps:
char: 3; direction: 2→
3
char: 1; direction: 2→
31
char: 4; direction: 2→
314
char: 1; direction: 2→
3141
char: 5; direction: 2→
31415
char: 9; direction: 2→
314159
char: 2; direction: 4↓
314159
2
char: 6; direction: 2→
314159
26
char: 5; direction: 4↓
314159
26
5
char: 3; direction: 6←
314159
26
35
char: 5; direction: 6←
314159
26
535
char: space; direction: 6←
314159
26
535
char: 8; direction: 5↙
314159
26
535
8
char: 9; direction: 2→
314159
26
535
89
etc.
Also note how I take advantage of the palindromized part 535 here so I'm able to draw those digits backwards. With most other digit-substrings I have to first go to the correct position with spaces before drawing the actual digits in direction 2→.
I use this same palindroized approach also for the digit-substrings 323 and 626.
The reason the first 3 of the PI-digits is replaced with a 4 is because we use a length of bug2 (since lines are overlapping), which causes a minor issue in thethis case when we reset-direction to the origin location with 'direction' 8. TheSince we had to insert the dot anyway this doesn't really matter too much.
The 46 to 64 is because we couldn't move around to the next section with spaces like we did with all the other digits for the final 0, since it's encapsulated inside other digits and we can't reach it.
See this 05AB1E tip of mine for an in-depth explanation of how the Canvas builtin works.
Using the actual PI-digits and drawing them in the specified pattern using the Canvas builtin Λ is surprisingly enough not that much larger (97 bytes ):
See this 05AB1E tip of mine (section How to compress large integers? and How to compress integer lists?) to understand how the compressed parts works.
See this 05AB1E tip of mine for an in-depth explanation of how the Canvas builtin works.
The reason the first 3 of the PI-digits is replaced with a 4 is because of bug in the reset-direction 8. The 46 to 64 is because we couldn't move around to the next section with spaces like we did with all the other digits for the final 0, since it's encapsulated inside other digits.
Since I was curious, I also made a program using the actual PI-digits and drawing them in the specified pattern one by one using the Canvas builtin Λ. Which surprisingly enough is not that much larger (97 bytes ):
See this 05AB1E tip of mine (section How to compress large integers? and How to compress integer lists?) to understand how the compressed parts works.
So we use the following options for the Canvas builtin:
- \$a\$ length:
2(all lines are of size 2; or basically 1 since they're overlapping previous lines) - \$b\$ the characters we want to display, which are the digits of PI with the spaces we added to travel around
- \$c\$ the directions, where
8is a reset to the origin where we started, and the other directions are:
7 0 1
↖ ↑ ↗
6 ← X → 2
↙ ↓ ↘
5 4 3
Here some of the first steps:
char: 3; direction: 2→
3
char: 1; direction: 2→
31
char: 4; direction: 2→
314
char: 1; direction: 2→
3141
char: 5; direction: 2→
31415
char: 9; direction: 2→
314159
char: 2; direction: 4↓
314159
2
char: 6; direction: 2→
314159
26
char: 5; direction: 4↓
314159
26
5
char: 3; direction: 6←
314159
26
35
char: 5; direction: 6←
314159
26
535
char: space; direction: 6←
314159
26
535
char: 8; direction: 5↙
314159
26
535
8
char: 9; direction: 2→
314159
26
535
89
etc.
Also note how I take advantage of the palindromized part 535 here so I'm able to draw those digits backwards. With most other digit-substrings I have to first go to the correct position with spaces before drawing the actual digits in direction 2→.
I use this same palindroized approach also for the digit-substrings 323 and 626.
The reason the first 3 of the PI-digits is replaced with a 4 is because we use a length of 2 (since lines are overlapping), which causes a minor issue in this case when we reset to the origin location with 'direction' 8. Since we had to insert the dot anyway this doesn't really matter too much.
The 46 to 64 is because we couldn't move around to the next section with spaces like we did with all the other digits for the final 0, since it's encapsulated inside other digits and we can't reach it.
See this 05AB1E tip of mine for an in-depth explanation of how the Canvas builtin works.
- 136.2k
- 14
- 154
- 394
•Eó£ƵZ3|ã
xWм7qèý`ÚA¿нÏ9,ÖcPÇŸ›ÎŸt¤,,ûUÅ ̈ù—¤ï`ÿ3⁄4ζ@η@••71⁄4P•в•pÏ{ʒÂfĆ ̈¿Yy•15вú•DŠ\•4в£»31DTʒÂfĆ ̈¿ZF•15вú•DŠ\•4в£»31DT/:
•Eó£ƵZ3|ã
xWм7qèý`ÚA¿нÏ9,ÖcPÇŸ›ÎŸt¤,,ûUÅ ̈ù—¤ï`ÿ3⁄4ζ@η@•
# Push compressed integer 31746388586852694571167828992290814184914816000404856451284780420784056983357043462437313025051647834765116670748406087616
•71⁄4P• # Push compressed integer 502885
в # Convert the larger integer to base-502885 as list:
# [59,0,64,230781,314159,26,502884,535,83279,1971,89,433,6939,79,44,937,323,749,510,84,58209,626]
•pÏ{ʒÂfĆ ̈¿Yy•ʒÂfĆ ̈¿ZF• # Push compressed integer 60230047425392376760356855
15в # Convert it to base-15 as list:
# [12,1,1,14,0,6,5,5,0,4,3,0,13,7,3,8,7,3,4,34,1211,0]
ú # Pad the integers in the first list with leading spaces,
# where the amount of spaces is that of the second list at the same indices:
# [" 59"," 0"," 64"," 230781","314159"," 26"," 502884"," 535","83279"," 1971"," 89","433"," 6939"," 79"," 44"," 937"," 323"," 749"," 510"," 84"," 58209","626"]
•DŠ\• # Push compressed integer 880633
4в # Convert it to base-4 as list: [3,1,1,2,3,3,3,3,2,1]
£ # Split the list of strings into parts of that size:
# [[" 59"," 0"," 64"],[" 230781"],["314159"],[" 26"," 502884"],[" 535","83279"," 1971"],[" 89","433"," 6939"],[" 79"," 44"," 937"],[" 323"," 749"," 510"],[" 84"," 58209"],["626"]]
» # Join each inner list by spaces, and then each string by newlines
31 # Push 31
D # Duplicate it
T/ # Divide the copy by 10: 3.1
: # Replace the "31" with "3.1" in the string
# (after which the result is output implicitly)
Using the actual PI-digits and drawing them in the specified pattern using the Canvas builtin Λ is surprisingly enough not that much larger (97 bytes ):
2žs•3]]\ ́ë:O•23в£J•ΘüÁи‘•11в0šúS•2q2ú≠‚¶ ́"§Δ2мfý∍η4ÀÕÌÌbÁa@÷\Y`ÍĆUγG11l ́TMt‹≠@k¤C•9вO•23в£J•ΘüÁи‘•11в0šúS•2q4Beçq̧ßI/ÖÅ? ×ばつΣ3ÛuÌÎvêmtTYx¡n‡¢lΛf4ÙI1¿çÑv•9в.Λ46Â:„ 4„3..;
2 # Push a 2
žs # Push an infinite list of PI digits: [3,1,4,1,5,...]
•3]]\ ́ë:O• # Push compressed integer 243177533433411924
23в # Convert it to base-23 as list: [11,2,5,2,3,22,3,3,5,3,2,10,1]
£ # Split the PI-digits into parts of that size
J # Join each inner list of digits together:
# [31415926535,89,79323,84,626,4338327950288419716939,937,510,58209,749,44,5923078164,0]
•ΘüÁи‘• # Push compressed integer 342434478685
11в # Convert it to base-11 as list: [1,2,2,2,5,3,3,7,7,1,10,2]
0š # Prepend a 0: [0,1,2,2,2,5,3,3,7,7,1,10,2]
ú # Pad the strings with that many leading spaces to the integers:
# ["31415926535"," 89"," 79323"," 84"," 626"," 4338327950288419716939"," 937"," 510"," 58209"," 749"," 44"," 5923078164"," 0"]
S # And convert it to a flattened list of characters
•2q2ú≠‚¶ ́"§Δ2мfý∍η4ÀÕÌÌbÁa@÷\Y`ÍĆUγG11l ́TMt‹≠@k¤C••2q4Beçq̧ßI/ÖÅ? ×ばつΣ3ÛuÌÎvêmtTYx¡n‡¢lΛf4ÙI1¿çÑv•
# Push compressed integer 11074318840040127750044756646557435476017517608314642561627491486388448080779440209868981775986471403138673809771107440116348129217561550864085059321059233554362962027078200378907904337318203317830295973758995759889862300097
9в # Convert it to base-9 as list:
# [2,2,2,2,2,34,2,54,6,6,6,5,2,2,3,2,2,3,6,6,6,6,5,2,5,6,6,6,6,1,1,1,2,1,2,2,2,1,2,2,2,2,1,2,2,2,2,2,4,2,2,2,3,2,2,2,5,6,6,2,2,2,5,6,6,6,2,2,5,6,6,6,6,6,2,6,2,2,2,2,7,6,6,6,6,6,6,6,2,2,7,6,6,8,1,1,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2,1,6,6,6,6]
.Λ # Use the Canvas builtin with these three lists, where
# - the 2 is the length of each line
# - the list ["3","1","4",...," "," ","0"] are the characters to draw
# - the list [2,2,2,...,6,6,6] are the directions
46 # Push 46
 # Bifurcate it (short for Duplicate & Reverse copy): 64
: # Replace the 46 with 64 in the string
„ 4„3..; # Replace the first " 4" with "3."
# (after which the result is output implicitly)
•Eó£ƵZ3|ã
xWм7qèý`ÚA¿нÏ9,ÖcPÇŸ›ÎŸt¤,,ûUÅ ̈ù—¤ï`ÿ3⁄4ζ@η@••71⁄4P•в•pÏ{ʒÂfĆ ̈¿Yy•15вú•DŠ\•4в£»31DT/:
•Eó£ƵZ3|ã
xWм7qèý`ÚA¿нÏ9,ÖcPÇŸ›ÎŸt¤,,ûUÅ ̈ù—¤ï`ÿ3⁄4ζ@η@•
# Push compressed integer 31746388586852694571167828992290814184914816000404856451284780420784056983357043462437313025051647834765116670748406087616
•71⁄4P• # Push compressed integer 502885
в # Convert the larger integer to base-502885 as list:
# [59,0,64,230781,314159,26,502884,535,83279,1971,89,433,6939,79,44,937,323,749,510,84,58209,626]
•pÏ{ʒÂfĆ ̈¿Yy• # Push compressed integer 60230047425392376760356855
15в # Convert it to base-15 as list:
# [12,1,1,14,0,6,5,5,0,4,3,0,13,7,3,8,7,3,4,3,12,0]
ú # Pad the integers in the first list with leading spaces,
# where the amount of spaces is that of the second list at the same indices:
# [" 59"," 0"," 64"," 230781","314159"," 26"," 502884"," 535","83279"," 1971"," 89","433"," 6939"," 79"," 44"," 937"," 323"," 749"," 510"," 84"," 58209","626"]
•DŠ\• # Push compressed integer 880633
4в # Convert it to base-4 as list: [3,1,1,2,3,3,3,3,2,1]
£ # Split the list of strings into parts of that size:
# [[" 59"," 0"," 64"],[" 230781"],["314159"],[" 26"," 502884"],[" 535","83279"," 1971"],[" 89","433"," 6939"],[" 79"," 44"," 937"],[" 323"," 749"," 510"],[" 84"," 58209"],["626"]]
» # Join each inner list by spaces, and then each string by newlines
31 # Push 31
D # Duplicate it
T/ # Divide the copy by 10: 3.1
: # Replace the "31" with "3.1" in the string
# (after which the result is output implicitly)
Using the actual PI-digits and drawing them using the Canvas builtin Λ is surprisingly enough not that much larger (97 bytes ):
2žs•3]]\ ́ë:O•23в£J•ΘüÁи‘•11в0šúS•2q2ú≠‚¶ ́"§Δ2мfý∍η4ÀÕÌÌbÁa@÷\Y`ÍĆUγG11l ́TMt‹≠@k¤C•9в.Λ46Â:„ 4„3..;
2 # Push a 2
žs # Push an infinite list of PI digits: [3,1,4,1,5,...]
•3]]\ ́ë:O• # Push compressed integer 243177533433411924
23в # Convert it to base-23 as list: [11,2,5,2,3,22,3,3,5,3,2,10,1]
£ # Split the PI-digits into parts of that size
J # Join each inner list of digits together:
# [31415926535,89,79323,84,626,4338327950288419716939,937,510,58209,749,44,5923078164,0]
•ΘüÁи‘• # Push compressed integer 342434478685
11в # Convert it to base-11 as list: [1,2,2,2,5,3,3,7,7,1,10,2]
0š # Prepend a 0: [0,1,2,2,2,5,3,3,7,7,1,10,2]
ú # Pad the strings with that many leading spaces to the integers:
# ["31415926535"," 89"," 79323"," 84"," 626"," 4338327950288419716939"," 937"," 510"," 58209"," 749"," 44"," 5923078164"," 0"]
S # And convert it to a flattened list of characters
•2q2ú≠‚¶ ́"§Δ2мfý∍η4ÀÕÌÌbÁa@÷\Y`ÍĆUγG11l ́TMt‹≠@k¤C•
# Push compressed integer 1107431884004012775004475664655743547601751760831464256162749148638844808077944020986898177598647140313867380977
9в # Convert it to base-9 as list:
# [2,2,2,2,2,3,2,5,6,6,6,5,2,2,3,2,2,3,6,6,6,6,5,2,5,6,6,6,6,1,1,1,2,1,2,2,2,1,2,2,2,2,1,2,2,2,2,2,4,2,2,2,3,2,2,2,5,6,6,2,2,2,5,6,6,6,2,2,5,6,6,6,6,6,2,6,2,2,2,2,7,6,6,6,6,6,6,6,2,2,7,6,6,8,1,1,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2,1,6,6,6,6]
.Λ # Use the Canvas builtin with these three lists, where
# - the 2 is the length of each line
# - the list ["3","1","4",...," "," ","0"] are the characters to draw
# - the list [2,2,2,...,6,6,6] are the directions
46 # Push 46
 # Bifurcate it (short for Duplicate & Reverse copy): 64
: # Replace the 46 with 64 in the string
„ 4„3..; # Replace the first " 4" with "3."
# (after which the result is output implicitly)
•Eó£ƵZ3|ã
xWм7qèý`ÚA¿нÏ9,ÖcPÇŸ›ÎŸt¤,,ûUÅ ̈ù—¤ï`ÿ3⁄4ζ@η@••71⁄4P•в•pÏ{ʒÂfĆ ̈¿ZF•15вú•DŠ\•4в£»31DT/:
•Eó£ƵZ3|ã
xWм7qèý`ÚA¿нÏ9,ÖcPÇŸ›ÎŸt¤,,ûUÅ ̈ù—¤ï`ÿ3⁄4ζ@η@•
# Push compressed integer 31746388586852694571167828992290814184914816000404856451284780420784056983357043462437313025051647834765116670748406087616
•71⁄4P• # Push compressed integer 502885
в # Convert the larger integer to base-502885 as list:
# [59,0,64,230781,314159,26,502884,535,83279,1971,89,433,6939,79,44,937,323,749,510,84,58209,626]
•pÏ{ʒÂfĆ ̈¿ZF• # Push compressed integer 60230047425392376760356855
15в # Convert it to base-15 as list:
# [12,1,1,14,0,6,5,5,0,4,3,0,13,7,3,8,7,3,4,4,11,0]
ú # Pad the integers in the first list with leading spaces,
# where the amount of spaces is that of the second list at the same indices:
# [" 59"," 0"," 64"," 230781","314159"," 26"," 502884"," 535","83279"," 1971"," 89","433"," 6939"," 79"," 44"," 937"," 323"," 749"," 510"," 84"," 58209","626"]
•DŠ\• # Push compressed integer 880633
4в # Convert it to base-4 as list: [3,1,1,2,3,3,3,3,2,1]
£ # Split the list of strings into parts of that size:
# [[" 59"," 0"," 64"],[" 230781"],["314159"],[" 26"," 502884"],[" 535","83279"," 1971"],[" 89","433"," 6939"],[" 79"," 44"," 937"],[" 323"," 749"," 510"],[" 84"," 58209"],["626"]]
» # Join each inner list by spaces, and then each string by newlines
31 # Push 31
D # Duplicate it
T/ # Divide the copy by 10: 3.1
: # Replace the "31" with "3.1" in the string
# (after which the result is output implicitly)
Using the actual PI-digits and drawing them in the specified pattern using the Canvas builtin Λ is surprisingly enough not that much larger (97 bytes ):
2žs•3]]\ ́ë:O•23в£J•ΘüÁи‘•11в0šúS•2q4Beçq̧ßI/ÖÅ? ×ばつΣ3ÛuÌÎvêmtTYx¡n‡¢lΛf4ÙI1¿çÑv•9в.Λ46Â:„ 4„3..;
2 # Push a 2
žs # Push an infinite list of PI digits: [3,1,4,1,5,...]
•3]]\ ́ë:O• # Push compressed integer 243177533433411924
23в # Convert it to base-23 as list: [11,2,5,2,3,22,3,3,5,3,2,10,1]
£ # Split the PI-digits into parts of that size
J # Join each inner list of digits together:
# [31415926535,89,79323,84,626,4338327950288419716939,937,510,58209,749,44,5923078164,0]
•ΘüÁи‘• # Push compressed integer 342434478685
11в # Convert it to base-11 as list: [1,2,2,2,5,3,3,7,7,1,10,2]
0š # Prepend a 0: [0,1,2,2,2,5,3,3,7,7,1,10,2]
ú # Pad the strings with that many leading spaces to the integers:
# ["31415926535"," 89"," 79323"," 84"," 626"," 4338327950288419716939"," 937"," 510"," 58209"," 749"," 44"," 5923078164"," 0"]
S # And convert it to a flattened list of characters
•2q4Beçq̧ßI/ÖÅ? ×ばつΣ3ÛuÌÎvêmtTYx¡n‡¢lΛf4ÙI1¿çÑv•
# Push compressed integer 1107440116348129217561550864085059321059233554362962027078200378907904337318203317830295973758995759889862300097
9в # Convert it to base-9 as list:
# [2,2,2,2,2,4,2,4,6,6,6,5,2,2,3,2,2,3,6,6,6,6,5,2,5,6,6,6,6,1,1,1,2,1,2,2,2,1,2,2,2,2,1,2,2,2,2,2,4,2,2,2,3,2,2,2,5,6,6,2,2,2,5,6,6,6,2,2,5,6,6,6,6,6,2,6,2,2,2,2,7,6,6,6,6,6,6,6,2,2,7,6,6,8,1,1,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2,1,6,6,6,6]
.Λ # Use the Canvas builtin with these three lists, where
# - the 2 is the length of each line
# - the list ["3","1","4",...," "," ","0"] are the characters to draw
# - the list [2,2,2,...,6,6,6] are the directions
46 # Push 46
 # Bifurcate it (short for Duplicate & Reverse copy): 64
: # Replace the 46 with 64 in the string
„ 4„3..; # Replace the first " 4" with "3."
# (after which the result is output implicitly)