Talk:Truth-machine

From Esolang
Jump to navigation Jump to search

Shouldn't this be at Truth machine? —Maharba 01:03, 23 February 2012 (UTC)

No. :D It is "truth-machine". --Keymaker 07:37, 23 February 2012 (UTC)
Should it be redirected from Truth machine? SunnyMoon (talk) 11:01, 7 September 2020 (UTC)
I think that would be a good idea, as many people seem to write it 'wrong'. I don't know how to do that however. --Keymaker (talk) 08:46, 8 September 2020 (UTC)
Made the redirection! --SunnyMoon (talk) 11:59, 8 September 2020 (UTC)

What if the input is neither '0' nor '1'? (Assuming input for the language works over an alphabet larger than just {0,1}.) I'd assume the behaviour of the program can be undefined in this case, but I thought I'd ask to clarify. (The SMITH truth-machine I just added outputs a single 1 if the input was something other than 0 or 1.) Chris Pressey (talk) 02:57, 10 September 2012 (UTC)

I've been interpreting it as undefined, anyway, in the spirit that this test is meant to be as permissive as possible for languages that have trouble doing much. :) --Ørjan (talk) 04:33, 10 September 2012 (UTC)
Yes, correct, it is undefined. Input that is not 0 or 1 should not happen. --Keymaker (talk) 16:31, 10 September 2012 (UTC)

About the Kipple "in principle" Truth-machine: if I understand it right, in case of '1' it will push an infinite number of '1's to the output stack, but those 1s will never actually be outputted because the programs never ends. A Truth-machine in Chef would have the same issue, and I guess that's why there is no Chef Truth-machine on the page yet. Should I add one? --Koen (talk) 12:22, 11 September 2012 (UTC)

Yes, go ahead. --Keymaker (talk) 13:23, 11 September 2012 (UTC)

itflabtijtslwi truth-machine simplification proposal

Couldn't

GGiGG/1/11/i

work for the itflabtijtslwi truth-machine? KaiQ (talk) 22:00, 19 January 2014 (UTC)

No. The problem is that if you input 1, the /1/11/ substitution command runs forever and you never get to the printing step. The complicated self-replicating method for /// and itflabtijtslwi is actually the simplest way we have found to make useful infinite loops in them. --Ørjan (talk) 02:33, 21 January 2014 (UTC)
Yes. Good point. KaiQ (talk) 01:37, 22 January 2014 (UTC)

Is it possible to add "psuedo-truth-machines"?

In the language ,,,, there cannot be any infinite loops. The best it can do is to output a finite number of 1's. Does that count? Should I add the program to the list? SunnyMoon (talk) 20:04, 29 August 2020 (UTC)

I wouldn't add it. Some languages just aren't capable of running a valid truth-machine. A truth-machine needs to be capable of infinite repetition. --Keymaker (talk) 08:48, 8 September 2020 (UTC)

Using integer overflow for a compact 18 bytes Truth-machine in Brainfuck?

If integer overflow wraps around, it can be used to make a Truth-machine. I'm assuming it's common practice for overflow to wrap around, but asking here to be sure? The online interpreter i found uses signed bytes that wrap. Anyway, here is the code:

,.[-->+[>>]<[.]<<]

Detailed explanation: Start by reading the input and printing it. Providing 0 gives the ASCII value 48 which is even, subtracting 2 (--) each time in the loop will cause even numbers to exit and terminate the program. Providing 1 gives the ASCII value 49 which is odd, subtracting 2 then causes the loop to never stop. If P is the period of the overflow, then in the second cell we add exactly P (>+), then this cell Will be back to 0 which Will skip the next section of code ([>>]). Normally, the stack pointer would be pointing at 0 in this section: (<[.]) but when the previous section is skipped, it instead points at the first cell. As this happens when P has been added to the second cell, 2P must be subtracted from the input n in the first cell, but as P is the period, this means n+2P mod P = n. The first cell contains 1 which will then be printed forever in: ([.]).

There are a few variations of this concept, but of the ones I found, this one looks the best IMO. There are also 17 bytes versions if negative cells can be used. Flyingmadpakke (talk) 18:17, 6 July 2021 (UTC)

Using wrapping integers (of 0-255 range) is common, yet many brainfuck programs (for example all of mine, several of dbc's) are made not relying on that. I would add the program to the list along with a simple mention that it uses wrapping 0-255 cells in its approach. A neat program by the way! --Keymaker (talk) 07:01, 7 July 2021 (UTC)
Added and ty :D I also gave a very short explanation, though I'm not sure if that is appropriate for this page, or if that should be reserved for its own page, like the language page itself? Flyingmadpakke (talk) 16:58, 7 July 2021 (UTC)