Dis, 154 bytes
}*^_!!!_!_!!{{__!!{!!!!{!!!{_______________>>*_________________|*_^______!!!___!!{___________________________!!!{!{!!!!_{_!____{{!!{{!{{{{{{{{{{{___!!!!{!
On my dis.web
How it works
This time I subtracted 62 from the input.
Getchar to store to register A:
}
Goto 62 (as address 43 points):
*^
Obtw memory 43-45 as data:
>>*
Address 63-66 as code:
| (Store op(A,62) to address 44)
*_^ (goto what address 44 says)
Address 4-153 is lookup table:
!!!_!_!!{{__!!{!!!!{!!!{_______________>>*_________________|*_^______!!!___!!{___________________________!!!{!{!!!!_{_!____{{!!{{!{{{{{{{{{{{___!!!!{!
How generated
disMath = {
get subtract(){
BASE=3;
function _op_by_digit(x, y) {
return ( x - y + BASE ) % BASE;
}
return function _subtract(x, y) {
if ( x < 1 && y < 1 ) return 0;
return _op_by_digit(x%BASE, y%BASE) + BASE*_subtract(Math.floor(x/BASE), Math.floor(y/BASE));
}
}
};
input = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
truthy = "1ACFHLRSacdfgiklmnopqrstx";
// [33,42,62,94,95,123,124,125].forEach(j=>{
[62].forEach(j=>{
hello =
[input, truthy].map(str=>
[...str]
.map(char=>char.codePointAt(0))
.map(x=>disMath.subtract(x,j)+1).sort((x,y)=>x>y||(x==y)-1))
// console.log(j,hello[0])
})
init = "}*^";
program = init;
for ( i = init.length; i <= 153; i++ ) {
if ( 43 <= i && i <= 44 ) program += ">";
else if ( i === 45 ) program += "*";
else if ( i === 63 ) { program += "|*_^"; i = 67-1}
else if ( hello[1].includes(i) ) program += "{";
else if ( hello[0].includes(i) ) program += "!";
else program += "_";
}
console.log(program);
console.log(program.length, i);
Try it online!
Dis, 163 bytes
}*__|*__^__________!!!___!{!___!!!!__!{!__{!{!*!!{!!!{!___________________________{{{{{{{{{___!!!{!!____________________________________!!!!{{!!!_{!!_____{!{{{!{{!
Assumes ASCII input. Reaches to {
to output a byte if truthy, no output if falsey.
Try on dis.web!
Screencast to verify every test case (YouTube)
How it works
Get a character:
}
Subtract 33 (!
) from the character's code at memory 45:
*__|
Goto what memory 45 says:
*__^
It should go to one of 19 thru 162:
!!!___!{!___!!!!__!{!__{!{!*!!{!!!{!___________________________{{{{{{{{{___!!!{!!____________________________________!!!!{{!!!_{!!_____{!{{{!{{!
Obtw Memory 43-49, which is accessed by memory 1-8:
!{!*!!{
How I generated code above
disMath = {
get subtract(){
BASE=3;
function _op_by_digit(x, y) {
return ( x - y + BASE ) % BASE;
}
return function _subtract(x, y) {
if ( x < 1 && y < 1 ) return 0;
return _op_by_digit(x%BASE, y%BASE) + BASE*_subtract(Math.floor(x/BASE), Math.floor(y/BASE));
}
}
};
input = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
truthy = "1ACFHLRSacdfgiklmnopqrstx";
hello = [input, truthy].map(str=>[...str].map(char=>char.codePointAt(0)).map(x=>disMath.subtract(x,33)+1).sort((x,y)=>x>y||(x==y)-1))
init = "}*__|*__^";
program = init;
for ( i = 9; i <= 162; i++ ) {
if ( i == 46 ) program += "*";
else if ( hello[1].includes(i) ) program += "{";
else if ( hello[0].includes(i) ) program += "!";
else program += "_";
}
console.log(program);
console.log(program.length);
Try it online!
More explains
I first tried what operation to do could reduce code space.
For each possible inputs and truthy cases (let them x), I tried x subtracted by command character on Dis (which is one of 33, 42, 62, 94, 95, 123, 124, 125).
At first I tried if the program who begins with }*|*^
works;
1ACFHLRSacdfgiklmnopqrstx
\$\endgroup\$