Apr 072024
 

I had understood in principle that printf is Turing complete, but I am still aghast at this interactive game of tic-tac-toe implemented with a single printf statement.

Computing the NOT of a single value is also easy:

printf("%1$255d%1$s%hhn", a, b)

will compute

*b = (strlen(a)+255)%256 = strlen(a)-1

and again, because strlen(x) is either 1 or 0 we have

*c = !b

From here we can compute any binary circuit.

Previously, previously, previously, previously, previously, previously, previously, previously, previously, previously.

External feed Read More at the Source: https://www.jwz.org/blog/2024/04/the-turing-police-say-x-wins/

 2024-04-07

Sorry, the comment form is closed at this time.