Advertisement

Software writing software?

Started by January 11, 2006 05:11 PM
12 comments, last by GameDev.net 18 years, 9 months ago
Is there such a thing as software that writes software or changes itself?
sure.
Advertisement
Yes to both.

As for "software that writes software", it depends on what you consider to be a specification for the end-product. For example, a C compiler is "software that writes software", as it takes a high level human readable specification and generates code executable by a CPU.

Going even higher level than that, there are things like spreadsheet compilers that can generate a piece of software without any "code" at all.

As for software that changes itself, read up on self modifying code here.

http://en.wikipedia.org/wiki/Self-modifying_code

(my byline from the Gamedev Collection series, which I co-edited) John Hattan has been working steadily in the casual game-space since the TRS-80 days and professionally since 1990. After seeing his small-format games turned down for what turned out to be Tandy's last PC release, he took them independent, eventually releasing them as several discount game-packs through a couple of publishers. The packs are actually still available on store-shelves, although you'll need a keen eye to find them nowadays. He continues to work in the casual game-space as an independent developer, largely working on games in Flash for his website, The Code Zone (www.thecodezone.com). His current scheme is to distribute his games virally on various web-portals and widget platforms. In addition, John writes weekly product reviews and blogs (over ten years old) for www.gamedev.net from his home office where he lives with his wife and daughter in their home in the woods near Lake Grapevine in Texas.

Quote: Original post by johnhattan
Yes to both.

As for "software that writes software", it depends on what you consider to be a specification for the end-product. For example, a C compiler is "software that writes software", as it takes a high level human readable specification and generates code executable by a CPU.

Going even higher level than that, there are things like spreadsheet compilers that can generate a piece of software without any "code" at all.

As for software that changes itself, read up on self modifying code here.

http://en.wikipedia.org/wiki/Self-modifying_code




Now that I have had a few replies....I now know that it was "self-modifying code" that I was asking about.
That Wikipedia article focuses on languages where it might be considered a hack to write self-modifying code (I'm not sure about ASM, I'm not an ASM programmer). You should know that Prolog programmers, for instance, readily write software that alters itself.
There are various levels of self-modifying code...

A program might directly overlay specific functions based on the users hardware configuration when performance or memory footprint is critical, often from a predefined library of hand-optimised routines (but run-time generation is also a possibility.) Usualy the process that injects the overlays is also the process that executes them.

An executable virus on the other hand might employ a simple code rearangement strategy, where instructions arent modified, but simply rearranged. Usualy the process that rearranges the instructions is not the process that eventualy executes them. This type of self-modifying codes only purpose is to make it harder to identify and beyond that has absolutely no practical value.

If neither of these two types fits with what you are trying to accomplish, then its quite likely that you are barking up the wrong tree.

Advertisement
Quote: Original post by MDI
That Wikipedia article focuses on languages where it might be considered a hack to write self-modifying code (I'm not sure about ASM, I'm not an ASM programmer). You should know that Prolog programmers, for instance, readily write software that alters itself.


Its considered a hack anywhere that it isn't formalized, including ASM. The majority of self-modifying ASM code out there is only used to measure the size of the processors instruction prefetch queue. Extremely unreliable since the introduction of the Pentium but very reliable on 80486 and lower.

It is no longer possible to modify code about to be executed as a modern processors has very long instruction lookahead queues to facilitate out of order executions. They also scan ahead through both conditional and unconditional branches, making it extremely hard to ever know the exact state of the processor.
I once wrote a screen fill routine in 6502 assembler on an Apple 2 that modified itself.
Can someone talk about what place does "self-modifying code" have in AI reearch?

I read somewhere, perhaps it was it the Wiki on SMC, that genetic algorithms "sort of" do this. Is that accurate?
Well, in Prolog, the program is able to modify itself by writing new rules and facts to the knowledgebase as time goes on. This allows the program to "learn" from its experiences.

Genetic algorithms are not self modifying, however, in this sense.

This topic is closed to new replies.

Advertisement