Thoughts on Rails

Riding the Train of Thought

SmaCK Hack

leave a comment »


If you are upto no good in programming, that is trying out the wackiest things possible in a specific language or on a particular machine… try SmaCK too 🙂 with only 9 instructions, the hypothetical machine emulator makes simple things like multiplication a nice challenge too 😀

http://data.freeshell.org/projects/smack/

This program writes a subroutine and jumps to and from it as it runs… It takes 5 digits as input and then displays them serially, in the order they were taken.

Usage:
$ ./smackem.py -f array.smac
Assuming you copy the following program and save it as “array.smac”

104
2101
1101
614
307300
2102
10510
2103
5102
1101
401
2101
53
104
2101
1101
627
308300
2102
10523
2103
5102
1101
401
2101
516
9

Alright, there's more!! Heres a program that behaves _exactly_ as the one above in the user interface and what it does part… but how does it do it? It modifies itself as it runs!! Yes, no jokes, the program over writes the instructions in it's own code as it runs X)

104
2101
1101
612
307300
27
980999
1101
401
2101
53
104
2101
1101
623
308300
218
80999
1101
401
2101
514
9

This program is also smaller then the one which writes subroutines… I'm sure anybody really interested in getting a dose of weirdo programming will find this interesting X)

Advertisements

Written by hiway

August 5, 2004 at 6:12 am

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: