Skip to main content
Commonmark migration
Source Link

Runic Enchantments, 27 bytes

i::i::}3s=?!@-'|A5:}=?!@+=@

Try it online!

Outputs 0 (exactly one zero) for false and any other output (literally whatever is left on the stack) for true.

New interpreter build, updated answer, saved 3 bytes (previous revision miscounted and said 4).

###Explanation:

Explanation:

i::i::                         Read two inputs, duplicating each twice.
      }                        Rotate stack right
       3s                      Rotate the top 3 items to the right
         =? @                  Compare equal, if so, dump stack
           !                   If not, skip next instruction
             -'|A              Subtract, absolute value, (j)
                 5:}           Push two 5s, rotate one to the bottom
                    =? @       Compare 5 with (j), if equal, dump stack
                      ! +=     If not, add the two inputs, compare with remaining 5
                          @    Dump stack (will be 1 for true and 0 for false)

Essentially it reads both inputs 3 times and arranges the stack so that each operation works on a copy of each input (or a literal 5). As the only way to dump a 0 is if all three comparisons are false, simply dumping the rest of the stack avoids having to do anything other than vomiting the entire stack to output and terminating, all posibilities of which are valid truthy values.

Runic Enchantments, 27 bytes

i::i::}3s=?!@-'|A5:}=?!@+=@

Try it online!

Outputs 0 (exactly one zero) for false and any other output (literally whatever is left on the stack) for true.

New interpreter build, updated answer, saved 3 bytes (previous revision miscounted and said 4).

###Explanation:

i::i::                         Read two inputs, duplicating each twice.
      }                        Rotate stack right
       3s                      Rotate the top 3 items to the right
         =? @                  Compare equal, if so, dump stack
           !                   If not, skip next instruction
             -'|A              Subtract, absolute value, (j)
                 5:}           Push two 5s, rotate one to the bottom
                    =? @       Compare 5 with (j), if equal, dump stack
                      ! +=     If not, add the two inputs, compare with remaining 5
                          @    Dump stack (will be 1 for true and 0 for false)

Essentially it reads both inputs 3 times and arranges the stack so that each operation works on a copy of each input (or a literal 5). As the only way to dump a 0 is if all three comparisons are false, simply dumping the rest of the stack avoids having to do anything other than vomiting the entire stack to output and terminating, all posibilities of which are valid truthy values.

Runic Enchantments, 27 bytes

i::i::}3s=?!@-'|A5:}=?!@+=@

Try it online!

Outputs 0 (exactly one zero) for false and any other output (literally whatever is left on the stack) for true.

New interpreter build, updated answer, saved 3 bytes (previous revision miscounted and said 4).

Explanation:

i::i::                         Read two inputs, duplicating each twice.
      }                        Rotate stack right
       3s                      Rotate the top 3 items to the right
         =? @                  Compare equal, if so, dump stack
           !                   If not, skip next instruction
             -'|A              Subtract, absolute value, (j)
                 5:}           Push two 5s, rotate one to the bottom
                    =? @       Compare 5 with (j), if equal, dump stack
                      ! +=     If not, add the two inputs, compare with remaining 5
                          @    Dump stack (will be 1 for true and 0 for false)

Essentially it reads both inputs 3 times and arranges the stack so that each operation works on a copy of each input (or a literal 5). As the only way to dump a 0 is if all three comparisons are false, simply dumping the rest of the stack avoids having to do anything other than vomiting the entire stack to output and terminating, all posibilities of which are valid truthy values.

added 968 characters in body
Source Link

Runic Enchantments, 3027 bytes

i::i::}3s=?!@-'|A"5"n'|A5:}=?!@+=@

Try it online!

With a pending update, 4 bytes can be saved, as presently integer inputs are treated as doubles and don't equal integers of the same value. Hence "5"n instead of just 5. This was an oversight and several factors are being adjusted to account for it (such as using Approximately(a, b) instead of a.Equals(b)).Try it online!

Outputs 0 (exactly one zero) for false and any other output (literally whatever is left on the stack) for true.

New interpreter build, updated answer, saved 3 bytes (previous revision miscounted and said 4).

###Explanation:

i::i::                         Read two inputs, duplicating each twice.
      }                        Rotate stack right
       3s                      Rotate the top 3 items to the right
         =? @                  Compare equal, if so, dump stack
           !                   If not, skip next instruction
             -'|A              Subtract, absolute value, (j)
                 5:}           Push two 5s, rotate one to the bottom
                    =? @       Compare 5 with (j), if equal, dump stack
                      ! +=     If not, add the two inputs, compare with remaining 5
                          @    Dump stack (will be 1 for true and 0 for false)

Essentially it reads both inputs 3 times and arranges the stack so that each operation works on a copy of each input (or a literal 5). As the only way to dump a 0 is if all three comparisons are false, simply dumping the rest of the stack avoids having to do anything other than vomiting the entire stack to output and terminating, all posibilities of which are valid truthy values.

Runic Enchantments, 30 bytes

i::i::}3s=?!@-'|A"5"n:}=?!@+=@

Try it online!

With a pending update, 4 bytes can be saved, as presently integer inputs are treated as doubles and don't equal integers of the same value. Hence "5"n instead of just 5. This was an oversight and several factors are being adjusted to account for it (such as using Approximately(a, b) instead of a.Equals(b)).

Outputs 0 (exactly one zero) for false and any other output (literally whatever is left on the stack) for true.

Runic Enchantments, 27 bytes

i::i::}3s=?!@-'|A5:}=?!@+=@

Try it online!

Outputs 0 (exactly one zero) for false and any other output (literally whatever is left on the stack) for true.

New interpreter build, updated answer, saved 3 bytes (previous revision miscounted and said 4).

###Explanation:

i::i::                         Read two inputs, duplicating each twice.
      }                        Rotate stack right
       3s                      Rotate the top 3 items to the right
         =? @                  Compare equal, if so, dump stack
           !                   If not, skip next instruction
             -'|A              Subtract, absolute value, (j)
                 5:}           Push two 5s, rotate one to the bottom
                    =? @       Compare 5 with (j), if equal, dump stack
                      ! +=     If not, add the two inputs, compare with remaining 5
                          @    Dump stack (will be 1 for true and 0 for false)

Essentially it reads both inputs 3 times and arranges the stack so that each operation works on a copy of each input (or a literal 5). As the only way to dump a 0 is if all three comparisons are false, simply dumping the rest of the stack avoids having to do anything other than vomiting the entire stack to output and terminating, all posibilities of which are valid truthy values.

Source Link

Runic Enchantments, 30 bytes

i::i::}3s=?!@-'|A"5"n:}=?!@+=@

Try it online!

With a pending update, 4 bytes can be saved, as presently integer inputs are treated as doubles and don't equal integers of the same value. Hence "5"n instead of just 5. This was an oversight and several factors are being adjusted to account for it (such as using Approximately(a, b) instead of a.Equals(b)).

Outputs 0 (exactly one zero) for false and any other output (literally whatever is left on the stack) for true.