ActionScript 3 Quine

A quine is a programm emitting its own source-code. I guess this is the most simple variant one could produce.

package
{
	import flash.display.Sprite;

	/**
	 * @author Joa Ebert
	 */
	public class Main extends Sprite
	{
		public function Main()
		{
			var i: int;
			var c: Function = String.fromCharCode;
			var q: Array = [
				'package',
				'{',
				'\timport flash.display.Sprite',
				'',
				'\t/**',
				'\t * @author Joa Ebert',
				'\t */',
				'\tpublic class Main extends Sprite',
				'\t{',
				'\t\tpublic function Main()',
				'\t\t{',
				'\t\t\tvar i: int;',
				'\t\t\tvar c: Function = String.fromCharCode;',
				'\t\t\tvar q: Array = [',
				'\t\t\t];',
				'\t\t\tfor(;i<14;++i)trace(q[i]);',
				'\t\t\tfor(i=0;i<21;++i)trace(c(9)+c(9)+c(9)+c(9)+c(39)+String(q[i]).replace(new RegExp(c(92)+"x09","g"),c(92)+"t")+c(39)+",");',
				'\t\t\tfor(i=14;i<21;++i)trace(q[i]);',
				'\t\t}',
				'\t}',
				'}',
			];
			for(;i<14;++i)trace(q[i]);
			for(i=0;i<21;++i)trace(c(9)+c(9)+c(9)+c(9)+c(39)+String(q[i]).replace(new RegExp(c(92)+"x09","g"),c(92)+"t")+c(39)+",");
			for(i=14;i<21;++i)trace(q[i]);
		}
	}
}

One Comment

  1. Posted Mar 19, 2010 at 12:00 am | Permalink

    another quine
    http://wonderfl.net/code/0c7bdc540272539d4e19542ff89434ce0906bb9b

3 Trackbacks

  1. [...] Saved by aerickson on Sun 11-1-2009 AIM Express 7 Beta 4 Saved by Maxwell26 on Thu 08-1-2009 ActionScript 3 Quine Saved by jaschu on Thu 01-1-2009 にゃあプロジェクト – ウェブログ Saved by [...]

  2. By Websites tagged "sprite" on Postsaver on May 5, 2009 at 12:17 am

    [...] – ActionScript 3 Quine saved by luckyandbruisershow2009-04-19 – Mega Man 9 to have optional 8-bit bugs, sprite flicker [...]

  3. [...] blog.joa-ebert.com [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*