Jump to content

Recommended Posts

A Quine is a program that can output it's own source without having direct access or user intervention.

(This Means no reading of the script file, prompting for source input, packaging the source, or using inbuilt source references)

A Quine is not necessarily malicious or self-duplicating, but rather an attempt at a theory.

Definition of Quine

Why torture ourselves making this this way? The reason is to [re]prove a concept of computing: that it is possible for a turing-complete language to output it's own source-code. (or optionally, output a program in another language that outputs the original source code; aka. a multiquine )

Here, are some AutoIt3 Quines:

My Quines:

One-line quines from my reply on Page 2:

ConsoleWrite(StringReplace("ConsoleWrite(StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))",'%'&'s',Chr(34)&"ConsoleWrite(StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))"&Chr(34)))
MsgBox(0,'',StringReplace("MsgBox(0,'',StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))",'%'&'s',Chr(34)&"MsgBox(0,'',StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))"&Chr(34)))

Old 2-Line Quine:

$x="$x=%srnMsgBox(0,'Quine Example',StringFormat($x,Chr(34)&$x&Chr(34)))"
MsgBox(0,'Quine Example',StringFormat($x,Chr(34)&$x&Chr(34)))

Skeleton/Customizable Quine (Page 2)

Global $gsQuine
eq("MsgBox(0,'program','first exec line')")
eq("MsgBox(0,'program','second exec line')")
Func eq($s)
Execute($s)
$gsQuine&=BinaryToString(0x22287165)&$s&BinaryToString(0x0A0D2922)
EndFunc
$x="Global $gsQuinern%sFunc eq($s)rnExecute($s)rn$gsQuine&=BinaryToString(0x22287165)&$s&BinaryToString(0x0A0D2922)rnEndFuncrn$x=%srnMsgBox(0,'Quine Example',StringFormat($x,$gsQuine,Chr(34)&$x&Chr(34)))"
MsgBox(0,'Quine Example',StringFormat($x,$gsQuine,Chr(34)&$x&Chr(34)))

Any Questions? :)

Quines by Michel Claveau:

$x="MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x)"
MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x)

$g=chr(34)
$x="MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x)"
MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x)

Images of past quines:

Posted Image

Posted Image

- - -

And for my next magic trick :) - an AutoIt3 / PHP Polyglot (non-quine and all too simple)

A Polyglot is a script that can perform the same actions in multiple languages without manipulation of the code.

;=- <?php
;/*
ConsoleWrite(";=- Hello World -=;");
;*/
; echo "Hello World";
; ?> -=;

In either language, this outputs ";=- Hello World -=;" to the console.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Sorry for bumping, but I just had to.

Just read the wikpedia page on Quine and thought to myself: Hey! Wonder if it have been done in autoit? And indeed it had!

Very nice work (and in only 2 lines):)

Edited by monoceres

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

I thought the point was to output the whole source. There it only goes up to "MsgBox(0, 'Quine"

You might have a vaild point there lets wait for Crash

lulz

*edit to conform

Edited by Gargy
01000001 01110101 01110100 01101111 01001001 01110100 00100000
An immortal object must be copied, so that we get a mortal copy of it, since we try not to destroy immortal objects.
Link to comment
Share on other sites

First:

Stop centering the text in the posts, are newspapers and books center justified? No.

Second:

Just include the entire source code using FileInstall()

- or -

Using a preprocessor directive:

#AutoIt3Wrapper_res_SaveSource

See other options:

http://www.autoitscript.com/forum/index.ph...install++source

Edited by weaponx
Link to comment
Share on other sites

Wow! don't think I've ever gotten this many replies.

Um yeah I think the $ before MsgBox was a typo when I was removing lines from it - I'll go fix it now.

Also, I'd be pleased if someone can make a different example

- although StringFormat is certainly easier than anything else I could think of.

wrapping the string in a function to try one-line makes it complicated, ugh because you have to repeat it 2+ etc.... *shrugs*

Let me know...

Shorter version of the "PHP/AutoIt" Polyglot (Editbox is broken on the first post)

;=- <?php /*
ConsoleWrite(";=- Hello World -=;");*/ echo "Hello World"; ?> -=;

PS:

I don't know exactly why it was only partially outputting for some - but just in case, try the newest edit that removed the extra '$' before MsgBox

-- also I noticed the icon on the dialog box where the problem is, I suppose it's possible there might be a compatibility issue with WINE? I don't know.

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Hi!

This release, without the StringFormat:

$x="MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x)"
MsgBox(0,'Quine','$x='&chr(34)&$x&chr(34)&@CRLF&$x)

Variante:

$g=chr(34)
$x="MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x)"
MsgBox(0,'Q','$g=chr(34)'&@CRLF&'$x='&$g&$x&$g&@CRLF&$x)

_

Edited by Michel Claveau
Link to comment
Share on other sites

Cool! that works good :)

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

I am failing to see how this would be useful, you have to replicate every line of commands for running and outputting to the user. If you used something like this below you only have to define the code once:

$var = 'MsgBox(0,"","TEST")'

;Escape double quotes
$var = StringReplace($var, '"', '""')

;Format run command
$runCMD = StringFormat('"%s" /AutoIt3ExecuteLine "%s"', @AutoItExe, $var)

RunWait($runCMD)
Link to comment
Share on other sites

Wait you want run autoit on linux with wine ?? i tried for years and fail

I've been running Autoit under wine for around 8 Months now :)

@Weaponx:

I don't believe there is supposed to be a point. I think it's more of a "See if I can" type of thing.

Link to comment
Share on other sites

  • 1 month later...

Sorry for bump, but can this output source as the line is called?

Like, script is on line 1, it shows only line 1, then it moves to 2, ect...

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Link to comment
Share on other sites

  • 2 weeks later...

Sorry for bump, but can this output source as the line is called?

Like, script is on line 1, it shows only line 1, then it moves to 2, ect...

do you want line 2 to output line 2 and line 3 to output line 3 ?

that sounds very difficult

Edited by crashdemons

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

here are two One-Line-Quines for Console and MsgBox

ConsoleWrite(StringReplace("ConsoleWrite(StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))",'%'&'s',Chr(34)&"ConsoleWrite(StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))"&Chr(34)))

MsgBox(0,'',StringReplace("MsgBox(0,'',StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))",'%'&'s',Chr(34)&"MsgBox(0,'',StringReplace(%s,'%'&'s',Chr(34)&%s&Chr(34)))"&Chr(34)))

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...