4 ms·
I'm sure the idea here was a physical quine, although since it only contains 2.5% of its own G-code it's not really a quine, any more than a "Hello World" progr
by Fwirt 3mo ago
I'm sure the idea here was a physical quine, although since it only contains 2.5% of its own G-code it's not really a quine, any more than a "Hello World" program is a quine since the string "Hello World" is in the program text. It would be trivial to generate something like this depending on which part of the G-code you pick.
- LeifCarrotson 3mo agoMany G-code dialects contain subprogram calls, loops, and conditionals that seem like they'd permit a physical quine. The standard RepRap firmware breaks the rules by taking input: https://reprap.org/wiki/G-code#M98:_Call_Macro.2FSubprogram https://reprap.org/wiki/G-code#M98:_Call_Macro.2FSubprogram but Fanuc and other dialects allow M97 to call a subroutine chained to the end of a program.
- Fwirt 3mo agoG-code is like assembly language for CNC. It’s human readable, you can write it by hand if necessary, most machines will compile it internally to machine instructions, and there are a million different flavors with incompatible macros, etc. The flavor I’m most familiar with is Klipper’s interpreter, which will let you write macros, but that would technically be cheating since you could just stuff an entire program into a macro.
- jerf 3mo agoFor anyone thinking of this, I promise to be suitably impressed (defined as "upvoting it when I see it on Hacker News") if anyone does manage to get a true G-code quine in this sense. Go for it.
- smallerize 3mo agoIt's not cheating if you print both.
- MisterTea 3mo agoI work a lot with Aerotech's Aerobasic which is G code mixed with a basic like language. You can generate G code on the fly and execute it, manipulate files, call other programs, text boxes, menu boxes, etc. I wrote a simple teach mode program that puts the machine into jog mode where you move the axes around and create points and associate a command for each, e.g. G0 rapid, G1 coordinated, G2 clockwise arc, G3 counterclockwise arc. Each move is then written to a file that is saved and loaded afterward for testing. Nice system but very costly.
- Centigonal 3mo agopretty sure I'm a physical quine