Left Hand vs. Right Hand — Typists Challenge
Perl 5, 261 = 88 + 173 bytes
This is an example where "language options don't count" is a problem. The rigt side solution uses -p
, the left side doesn't. So does it count as the same language or not? And should the options come from the left/right character set ?
Left 88
use -M5.10.0
(or -E
from the commandline) to activate say
Again arguable if this option should count as code and should come from the left side or if it falls under "options to set language version don't count"
say eYYYYZYEYWYYYYYWQYEYQWQEYQYYZYWYYYYYQYQW^q%565504004w4052bw!504!w!04!204bw56550!6!h%
Try it online!
Right 173
Run with the -p
option (which also consists of right characters)
}{*_=\(uuuuuuuuuuuuuiuuuuuuuuuuiuuuuuuuuuuuuuui&Uiipjipjiijij0puiipjiipp0jijipjipjipipp7|Ouiujujjuiuuu0kouuujuiju0jijujuikjujukk7&"7oulio7iouloli77ooliou7liiu7o7lu7io7o77i")
This can almost certainly be improved, but for now it was hard enough to get something working. Not having access to print
, say
, $_
and sub{}
makes output tricky
Try it online!
Whitespace, 1175 1143 655 645 638 632 639 578 (293 + 285) bytes
It had to be done.. ;p
Can definitely be golfed by filling the stack reversed and printing it all at the end in some kind of loop, but this is only my second Whitespace program ever, so I've yet to figure it out.. EDIT: Golfed.
+7 bytes because I misspelled pumpkin
as pumkin
.. (Thanks for noticing, @fəˈnɛtɪk.)
Letters S
(space), T
(tab) and N
(new-line) added as highlighting only.
[..._some_action]
added as explanation only.
Left-sided Pollinium milk; plump pumpkin; lollipop?
:
[S S T T S T T T T N
_Push_-47_?][S S S T S N
_Push_2_p][S S S T N
_Push_1_o][S T S S T N
_Copy_1st_p][S S T T S T N
_Push_-5_i][S S T T S N
_Push_-2_l][S N
S _Duplicate_-2_l][S S S T N
_Push_1_o][S T S S T N
_Copy_1st_l][S S T T S S T T T S N
_Push_-78_space][S S T T T S S T T N
_Push_-51_;][S S S N
_Push_0_n][S S T T S T N
_Push_-5_i][S S T T T N
_Push_-3_k][S S S T S N
_Push_2_p][S S T T N
_Push_-1_m][S S S T T T N
_Push_7_u][S S S T S N
_Push_2_p][S S T T S S T T T S N
_Push_-78_space][S S S T S N
_Push_2_p][S S T T N
_Push_-1_m][S S S T T T N
_Push_7_u][S S T T S N
_Push_-2_l][S S S T S N
_Push_2_p][S S T T S S T T T S N
_Push_-78_space][S S T T T S S T T N
_Push_-51_;][S S T T T N
_Push_-3_k][S S T T S N
_Push_-2_l][S S T T S T N
_Push_-5_i][S S T T N
_Push_-1_m][S S T T S S T T T S N
_Push_-78_space][S S T T N
_Push_-1_m][S S S T T T N
_Push_7_u][S S T T S T N
_Push_-5_i][S S S N
_Push_0_n][S S T T S T N
_Push_-5_i][S S T T S N
_Push_-2_l][S N
S _Duplicate_-2_l][S S S T N
_Push_1_o][S S T T T T T S N
_Push_-30_P][N
S S N
_Create_Label_LOOP][S S S T T S T T T S N
_Push_110][T S S S _Add][T N
S S _Print_as_char][N
S N
N
_Jump_to_Label_LOOP]
Try it online (with raw spaces, tabs and new-lines only).
Right-sided Weatherheaded sweetheart haberdasheress!
:
[S S T T S S S T S S N
_Push_-68_!][S S S T T T S N
_Push_14_s][S N
S _Duplicate_14_s][S S S N
_Push_0_e][S S S T T S T N
_Push_13_r][S S S N
_Push_0_e][S S S T T N
_Push_3_h][S S S T T T S N
_Push_14_s][S S T T S S N
_Push_-4_a][S S T T N
_Push_-1_d][S S S T T S T N
_Push_13_r][S S S N
_Push_0_e][S S T T T N
_Push_-3_b][S S T T S S N
_Push_-4_a][S S S T T N
_Push_3_h][S S T T S S S T S T N
_Push_-69_space][S S S T T T T N
_Push_15_t][S S S T T S T N
_Push_13_r][S S T T S S N
_Push_-4_a][S S S N
_Push_0_e][S S S T T N
_Push_3_h][S S S T T T T N
_Push_15_t][S S S N
_Push_0_e][S N
S _Duplicate_0_e][S S S T S S T S N
_Push_18_w][S S S T T T S N
_Push_14_s][S S T T S S S T S T N
_Push_-69_space][S S T T N
_Push_-1_d][S S S N
_Push_0_e][S S T T N
_Push_-1_d][S S T T S S N
_Push_-4_a][S S S N
_Push_0_e][S S S T T N
_Push_3_h][S S S T T S T N
_Push_13_r][S S S N
_Push_0_e][S S S T T N
_Push_3_h][S S S T T T T N
_Push_15_t][S S T T S S N
_Push_-4_a][S S S N
_Push_0_e][S S T T T T S N
_Push_-14_W][N
S S N
_Create_Label_LOOP][S S S T T S S T S T N
_Push_101][T S S S _Add][T N
S S _Print_as_char][N
S N
N
_Jump_to_Label_LOOP]
Try it online (with raw spaces, tabs and new-lines only).
Explanation:
It first build the stack reversed. Pushing a number is done as follows:
S
at the start: Enable Stack ManipulationS
: Push what follows as number to the stackS
/T
: Sign bit whereS
is positive andT
is negative- Some
T
andS
followed by anN
: Put number as binary to the stack (T=1
andS=0
).
Then it will loop over the stack reversed and print everything as characters. It does this as follows:
- Push 0 (
SSSN
) - Push all numbers indicating the characters reversed as explained above
- Create a
Label_0
(NSSN
)- Duplicate the top of the stack (
SNS
) - If this value is 0: Jump to
Label_1
(NTSTN
) - Else: Pop and print the top of the stack as character (
TNSS
) - Jump to
Label_0
(NSNN
)
- Duplicate the top of the stack (
- Create
Label_1
(NSSTN
)
This above is the default layout for both programs. Here is the change-log for this default layout which lowered the byte-count even further:
All numbers are lowered by the same amount (
100
110
in the first program, and102
101
in the second) to decrease the binary digits used for the now lower numbers, and between step 3.2 and 3.3 the following two sub-steps are added:- Push 110 (
SSSTTSTTTSN
) in program 1, or 101 (SSSTTSSTSTN
) in program 2 - Pop and add the top two values of the stack with each other, and the result is the new top of the stack (
TSSS
)
- Push 110 (
I've also used
SNS
in some cases to duplicate the top of the stack, which is used to golf thell
,ll
,ee
andss
.In addition, step 4 (create
Label_1
) was removed completely. It will exit with an error, but will still output everything correctly (which is allowed according to the meta).It's possible to copy an
n
'th value from the top of the stack (withSTS
+ 0-indexedn
), which is shorter than creating a new number in some cases.
In the first program I've done this for: the secondp
inpop
(STSSTN
(copy 1st) is shorter thanSSSTTSSN
(create number for 'p')), the secondl
inlol
(STSSTN
(copy 1st) is shorter thanSSSTSSSN
(create number for 'l')), the secondp
inp p
(STSSTN
(copy 1st) is shorter thanSSSTTSSN
(create number for 'p')), the secondp
inpumlp
(STSSTTN
(copy 3rd) is shorter thanSSSTTSSN
(create number for 'p')), the secondp
inpmup
(STSSTSN
(copy 2nd) is shorter thanSSSTTSSN
(create number for 'p')), the secondm
inm m
(STSSTN
(copy 1st) is shorter thanSSSTSSTN
(create number for 'm')), the secondi
inini
(STSSTN
(copy 1st) is shorter thanSSSTSTN
(create number for 'i')).
In the second program this isn't done for any. The distance between some is pretty short, likeere
orded
, but creating the number for 'e' (SSTTN
) or 'd' (SSTTSN
) are both shorter or of equal length as copy 1st (STSSTN
), so I couldn't apply this trick in the second program to save bytes. NOTE: After golf-step 7, not all of these apply anymore.In both programs I've changed step 1 of the loop from
SSSN
(Push 0) toSSN
(Push error_value), and removed the steps 3.1 (SNS
Duplicate) and 3.2 (NTSTN
If 0: Exit). Now it will simply exit with an error thatSSN
is an unknown value as soon as it's tries to access it.Removed the
SSN
(error_value) completely in both programs. It will now stop with the error "Can't do Infix Plus" when it tries to do the Add-function with nothing left on the stack.Changed the constant values of
100
and102
to110
and101
respectively. Here the Java program used to generate the110
constant; and here the Java program used to generate the101
constant. Note that there are now less Copy used than described at point 4 above, because the new values are in many cases shorter than the copies, so re-pushing them is shorter.
Lenguage, this many bytes
The left-hand side is 65721878296123796350462639500449228197646164622176218219262161264085219054330862921130017235140285847450697804123168755463678390611789188813352602373675420824698785508893489685489807676509031860196742608788337382365939621331808044899882497347443262020486908162559376082705672994569868 repetitions of the a
character, which is equivalent to the following Brainfuck program:
-[--->+<]>-----.[--->+<]>-.---..---.+++++.-----.++++++++++++.--------.[->+++++<]>-.+[----->+<]>.----.+++.-.--[->+++<]>.+[-->+<]>++.[-->+++++++<]>.----.+++++++++.--------.+++.[------->++<]>.[-->+++++++<]>.+++++.--------.+++.-----.--.+++++.[-->+<]>++++.+[-->+<]>++.++[--->++<]>.+++.---..---.+++++++.-.+.[--->++++<]>-.
Try it online!
The right-hand side is 636605880289050800007960838028215177632402180834140124157618258152393860687206680356620669530585999501769442445842690365640523699585001167392310123764258380235064746704898152544431842440556280249638840374132783257375880144623575829131522611446544303839106505176776161206935275549421170646618266717893044911373119804737614528140 repetitions of the p
character, which is equivalent to the following Brainfuck program:
+[--->++<]>+.++[->++++<]>+.----.--[--->+<]>-.------------.---.+++++++++++++.----------.---.----.+++.+.-.-[--->+<]>-.---[->++++<]>-.++++.[->+++<]>..[--->+<]>---.------------.---.----.--[--->+<]>---.++.[---->+<]>+++.-[--->++<]>--.-------.+.+++.+++++++++++++.--------------.---.--[--->+<]>--.-----------.---.+++++++++++++.-------------.[--->+<]>----..+[-->+++++<]>-.
Try it online!