Skip to main content
explain how to work around QUOSHUNT
Source Link
ais523
  • 11
  • 19
  • 35
  • SUM: instead of adding, multiply the right-hand side by -1 and subtract (as shown in the code sample above)
  • SMALLR: multiply by sides by -1, use BIGGR then multiply the result by -1
  • QUOSHUNT: represent every number as a pair of numbers, a numerator and a denominator, effectively treating it as a rational; to multiply, multiply the numerators and denominators; to divide, multiply one number's numberator by the other's denominator and vice versa; addition, subtraction and comparison can be done by multiplying each number's numerator and denominator by the other's denominator first; if the rounding behaviour of integer division is required, you can subtract the numerator modulo the denominator from the denominator; if a crash on division by zero is required, you can manually check for the denominator being zero and exit the program manually via setting all the variables to values that will cause it to drop out of loops
  • BOTH SAEM: replace with NOT DIFFRINT
  • VISIBLE: there's no replacement for this, but I/O is not needed for Turing completeness
  • IF U SAY SO: there's no direct replacement for this, so you have to write the program without using functions
  • SMOOSH: there's no direct replacement for this, so you have to write the program without using strings other than string literals
  • SUM: instead of adding, multiply the right-hand side by -1 and subtract (as shown in the code sample above)
  • SMALLR: multiply by sides by -1, use BIGGR then multiply the result by -1
  • BOTH SAEM: replace with NOT DIFFRINT
  • VISIBLE: there's no replacement for this, but I/O is not needed for Turing completeness
  • IF U SAY SO: there's no direct replacement for this, so you have to write the program without using functions
  • SMOOSH: there's no direct replacement for this, so you have to write the program without using strings other than string literals
  • SUM: instead of adding, multiply the right-hand side by -1 and subtract (as shown in the code sample above)
  • SMALLR: multiply by sides by -1, use BIGGR then multiply the result by -1
  • QUOSHUNT: represent every number as a pair of numbers, a numerator and a denominator, effectively treating it as a rational; to multiply, multiply the numerators and denominators; to divide, multiply one number's numberator by the other's denominator and vice versa; addition, subtraction and comparison can be done by multiplying each number's numerator and denominator by the other's denominator first; if the rounding behaviour of integer division is required, you can subtract the numerator modulo the denominator from the denominator; if a crash on division by zero is required, you can manually check for the denominator being zero and exit the program manually via setting all the variables to values that will cause it to drop out of loops
  • BOTH SAEM: replace with NOT DIFFRINT
  • VISIBLE: there's no replacement for this, but I/O is not needed for Turing completeness
  • IF U SAY SO: there's no direct replacement for this, so you have to write the program without using functions
  • SMOOSH: there's no direct replacement for this, so you have to write the program without using strings other than string literals
Source Link
ais523
  • 11
  • 19
  • 35

LOLCODE, cracks Pyautogui's answer

So it turns out that in LOLCODE, you can use a variable as a loop variable even if it hasn't been declared, and then assign to it and otherwise treat it as a normal variable while you're still inside the loop:

HAI 1.2
IM IN YR ROUTER UPPIN YR HAX WILE DIFFRINT HAX AN 8388607
HAX R DIFF OF HAX AN PRODUKT OF HAX AN -1
IM OUTTA YR ROUTER
KTHXBYE

Try it online! (Adds a VISIBLE HAX to show what's happening in the program; this can't be included in the crack itself due to VISIBLE containing an S.)

This means that it's fairly easy to work around the inability to use S for variable declaration, at least for integer variables; simply create a lot of nested loops that declare all the variables you need, then run your entire program on the first iteration of those loops. (You can break out of the loops via setting all the variables to known values other than 0, and using those known values as the sentinels which terminate the loops.)

Other uses of S, and how to work around them:

  • SUM: instead of adding, multiply the right-hand side by -1 and subtract (as shown in the code sample above)
  • SMALLR: multiply by sides by -1, use BIGGR then multiply the result by -1
  • BOTH SAEM: replace with NOT DIFFRINT
  • VISIBLE: there's no replacement for this, but I/O is not needed for Turing completeness
  • IF U SAY SO: there's no direct replacement for this, so you have to write the program without using functions
  • SMOOSH: there's no direct replacement for this, so you have to write the program without using strings other than string literals

The S in SMOOSH almost leads to a difficult philosophical problem: is LOLCODE Turing-complete without functions or calculated strings? The issue is that the stock LOLCODE interpreter has limits on the size of integers, and on the length of strings, but only the former is mentioned in the specification. If you consider both limits to be implementation details that don't block Turing-completeness, then the language is Turing-complete – you can use bignum integers to implement, e.g., Blindfolded Arithmetic. If you consider integers to be limited size but strings to be unlimited size, then the language is not Turing-complete without S due to the inability to store arbitrary amounts of data – there's no way but SMOOSH to create new strings. Fortunately, the problem was probably resolved in advance by the cop question itself (which specifies that "actual 'Turing Completeness'" is not required when running into "things like maximum sizes for pointers" – the issue of maximum integer sizes seems to be comparable, although we might need a clarification from the OP to make sure), so I hope that this is a valid crack.

Post Made Community Wiki by ais523