Jump to content

Combinatorics Algorithm and Code Generation?


Recommended Posts

Given the following rules:

A program must run without error.

A Program consists of 10 to 30 lines

A line consists of 3 to 40 characters

How many programs could be generated in AutoIt that matched those rules?

What other rules could be used to filter out nonsense or equivalent results?

I was thinking that you could set limits on the number of variables, the types, the naming system, and break apart the structure of all possible programs, then generate combinations of the parts as valid programs.

The reason I ask, is that if you expand the definition of a Program to, say, 200 lines, and you can define specific problem domains within the range of specific rules, then it would be possible to search within ranges for solutions(nth possible result to the xth possible result deal with GUIs, or something like that.)

Granted, it would be difficult to pull anything useful out of it without more rules, but on the other hand, I think that with a large enough generic ruleset, a really useful tool could be developed.

So, just as an idea... can you figure out additional rules or rulesets to add to the list? How would I go about creating valid syntax templates? I was thinking XML would work well, as I could create templates around all the built in functions, and then generate code from generated XML.

<Func $a, $b>myFunction

<While $i = 1>$i<=10>

<varIncrement>$i++

</>

<Exit></>

</>

And that would be the equivalent of

Func myFunction($a,$b)
$i = 1
While $i <= 10
$i = $i +1
Wend
Exit
EndFunc

Anyone have any ideas on a good approach to this? I think it's a really interesting possibility.

Link to comment
Share on other sites

Guys, give it up... Numb3rs is declining in the ratings as the writing has become too repetitive. Let it quietly go into syndication for the reruns and get on with your lives!

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Pfft, Numb3rs aside, I still think it would be very interesting. I'll need an ontology of AutoIt programs in order to make it work, so that's where I'm starting. And it only got repetitive for some people because, while you use math every day, alot of it is boring if you don't know how it works, and 15 second graphical snippets do not a math nerd make. The snippets might inspire us, but we actually go out and buy a book and do the reading afterwards. And there's at least one more season, after that last finale. If not, I'm going to purchase a few thousand Calculus course books and have them air dropped (loose) onto the studio owners' homes.

I figure the range of all 5 line programs would be small enough to work with, to do a proof of concept. Anything more than that, and I think I'd be delving into some pretty hefty AI areas... most programs deal with interpreting meaningful data and then making meaningful decisions based on the data. Describing "meaningful" is extremely difficult.

I might be able to describe areas in which meaningful data is required, and have a kind of Mad Libs type fill in the blanks program generator. That might be fun :) I'll have to see after the 5 line generator.

And thanks, Smorg. This might actually be useful for something, if we explore it a bit more.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...