Author Topic: Bot Code Analysis Tool  (Read 14977 times)

Offline Prsn828

  • Bot Destroyer
  • ***
  • Posts: 139
    • View Profile
Re: Bot Code Analysis Tool
« Reply #15 on: August 24, 2010, 09:47:08 AM »
I've worked out a mental image of the program structure.
Not that it's important from a user perspective, but I'm basically going to use seperate files (modules) for each functionality.

As far as the interpreter is concerned, I believe I have thought of a good way to handle that.
It will take a while to program though...

Related to the interpreter, I have come up with an interesting thought.
It appears to me that the transition between frames has an effect on a bot's variables that could be represented (with the exception of external stimuli) by something like an excel sheet filled with formulas.
It might be a stretch, but I think I may be able to design an interpreter FORMAT, meaning different formats could represent different versions of darwinbots, or different settings.
The same can also be applied to the sysvars, although I'm also thinking about trying to parse them from the wiki to ensure they are up to date (maybe a file override of sysvars could be allowed as well...)

If I do get a working format for the interpreter, we may want to consider integrating it into darwinbots (since we certainly aren't overwhelmed by the amount of settings it has right now  :P)
This would make tweaking the behavior and balance of the program much easier to do.

Now that I think about it, I wonder if it is possible to treat bot-code as a programming language (and as a result, I could make a higher level language that compiles into bot-code...)
I'll play around with that idea a bit after I get some of the other parts coded (or when I can't control my ADHD any more and it forces me to think about it  :P)

If anyone can point me to information about how I might query the wiki, it would be greatly appreciated.
As it is right now I can only really display the full page when attempting to provide tool-tips, and without being able to retrieve any actual (read: useful to a program) information, I can't really provide any auto-complete features without hard-coding (or locally storing) all of the related information.
Information in this case refers to: valid keywords (add, sub, mod, etc.), the list of sysvars (and their numbers), the usage of keywords (number and order of arguments), etc.

I'll stop at that for now.
As always I will keep everyone (well-)informed.
So, what will it be? Will you submit to my will, or must I bend reality to suit my needs?
Better answer before I do BOTH!

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Bot Code Analysis Tool
« Reply #16 on: August 24, 2010, 06:56:16 PM »
Here is a thought:

Lets say we got:
Quote
*50 2 add 1 sub 50 store

Can you make the thing you are working on suggest

Quote
50 inc

Or, here is another example

Quote
*50 *50 mult 50 store

program suggests:

Quote
*50 2 pow 50 store

Please make this work on 'suggest' bases. We don't need the program changing stuff automatically bc there might be an evolutionary advantage in the long-form.
Thank you, keep up the good work.


Offline Prsn828

  • Bot Destroyer
  • ***
  • Posts: 139
    • View Profile
Re: Bot Code Analysis Tool
« Reply #17 on: August 25, 2010, 09:07:42 AM »
Here is a thought:

Lets say we got:
Quote
*50 2 add 1 sub 50 store

Can you make the thing you are working on suggest

Quote
50 inc

Or, here is another example

Quote
*50 *50 mult 50 store

program suggests:

Quote
*50 2 pow 50 store

Please make this work on 'suggest' bases. We don't need the program changing stuff automatically bc there might be an evolutionary advantage in the long-form.
Thank you, keep up the good work.

It will be as you have suggested.
All of those are actually quite good examples of what I am eventually hoping to make it capable of.

In addition, I will probably add in "pointer inference", or the ability to determine if a value (or expression) is supposed to evaluate to a memory location reference.
For individual values followed by the reference operator, this is trivial.
For more complex expressions it could be useful in decyphering the meaning of an evolved code.

I also might add evolution-based optimization.

To explain:

Consider a line of code in a bot.
This code could be considered like a function, as it is deterministic in behavior (except when it involves rnd, but that doesn't really change anything).
By applying a fitness and evaluating mutations of the function, one could evolve a new function, having the same effect on the memory of the bot, but using more or less expressions (or expressions with more or less energy requirements).
Of course, given the resulting change to the memory of the bot, it is theoretically even possible to evolve the code from nothing, but I don't know how useful such a feature might be. (a preson can generally write the code faster than the changes they want it to make, I believe).

And as you said, it would only be suggestions.
It would be quite rude to change the code of the bot without asking  :P
So, what will it be? Will you submit to my will, or must I bend reality to suit my needs?
Better answer before I do BOTH!

Offline Prsn828

  • Bot Destroyer
  • ***
  • Posts: 139
    • View Profile
Re: Bot Code Analysis Tool
« Reply #18 on: September 01, 2010, 09:27:19 AM »
I have a working browser in place, so I can now garuntee wiki-based command descriptions. (Unless the wiki gets removed  :P)

I switched to Qt as it has a GUI development tool, and is more fully documented than WxPython.  It also has a better browser in its toolkit.

I have the input capturing of the editor set up too, and am going to move handling of the editor's special functionalities into a seperate file soon (right now it is laying around in the initializer).

Thanks to the way Qt's text widget works, I should be able to save in-progress bots along with some meta-data in an HTML format.  This is the format the widget uses for formatting, and it has built-in support for reporting as either fully formatted HTML or as plain text.  This way I could keep track of what sections are post-fix and what sections are in-fix without any extra coding.

As far as an interpreter goes, I'm considering various approaches, but have not settled on anything yet.

Code conversion will be divided into three categories (or at least right now they are):
  • Mutations
  • Evolutions
  • Conversions
All three may overlap a little, but for the most part they are distinct.

Mutation is just that, the mutation of the code, whether by switching out for equivalent statements or changing the code altogether.

Evolution makes use of mutation to derive more (or less, if you really want it to) efficient, effective, or desirable (whatever you choose for it to mean) implementations of a section of code.
I might also allow evolving code to meet certain specifications somehow, but for now it's just a thought.

Conversion is more concrete.
It deals with post-fix to/from in-fix, as well as any other non-random algorithm-based conversions (like sysvar to numbers, and comment/uncomment of code)

As always, I will tell you more when I get some more work done on this.
So, what will it be? Will you submit to my will, or must I bend reality to suit my needs?
Better answer before I do BOTH!

Offline Prsn828

  • Bot Destroyer
  • ***
  • Posts: 139
    • View Profile
Re: Bot Code Analysis Tool
« Reply #19 on: September 05, 2010, 11:16:09 AM »
Big update!

I have the wiki searching working (it definitely isn't in its final state, but it is perfectly usable).
I also have the menu set up.

Right now I am working on implementing the load and save mechanisms (prompts, formats, and all that good stuff).

As soon as saving and loading is complete I will make an executable and provide a link to a download for it.

As always, more news when it happens.
So, what will it be? Will you submit to my will, or must I bend reality to suit my needs?
Better answer before I do BOTH!

Offline Ammeh

  • Queen of the Internets
  • Bot Destroyer
  • ***
  • Posts: 169
    • View Profile
Re: Bot Code Analysis Tool
« Reply #20 on: September 06, 2010, 03:19:29 AM »
Awesome, looking forward to this  :happy:

Offline Prsn828

  • Bot Destroyer
  • ***
  • Posts: 139
    • View Profile
Re: Bot Code Analysis Tool
« Reply #21 on: September 08, 2010, 08:58:39 AM »
I've taken some time off of work (Five day weekend  :P ), so I will probably be able to get a release out sometime between Friday morning and Tuesday night.

I have loading working already, so now I just need the saving part, which for now will be plain and simple.
Hopefully I can make the excecutable without too much difficulty.

On a slightly related note, I have realized that using the search functionality (that searches the wiki when you press ctrl+space) works not only on words, but also on numbers.  This will surely come in handy when I try to work out some of the conversion functionality.  Of course, that also means we will need to take slightly better care of our wiki (It's mostly fine right now, but some pages don't seem to follow the conventions that the rest of the wiki uses).

More news to come soon (most likely once I have an excecutable).
So, what will it be? Will you submit to my will, or must I bend reality to suit my needs?
Better answer before I do BOTH!

Offline Shasta

  • Administrator
  • Bot Destroyer
  • *****
  • Posts: 231
    • View Profile
Re: Bot Code Analysis Tool
« Reply #22 on: September 09, 2010, 08:26:29 PM »
The wiki could really use some maintenance. I started to tidy some things up... and got busy with other stuff. I'll hopefully get around to it in a little while but if someone has nothing to do help would be great :)

Offline Prsn828

  • Bot Destroyer
  • ***
  • Posts: 139
    • View Profile
Re: Bot Code Analysis Tool
« Reply #23 on: September 11, 2010, 08:29:32 AM »
Saving and loading are working now!

Maybe an hour before I release the first (sub-alpha) version!

There is lots more work to be done on it, so don't expect this to be all that great (although it is nice to have the power of the wiki at your disposal.)
So, what will it be? Will you submit to my will, or must I bend reality to suit my needs?
Better answer before I do BOTH!

Offline Prsn828

  • Bot Destroyer
  • ***
  • Posts: 139
    • View Profile
Re: Bot Code Analysis Tool
« Reply #24 on: September 11, 2010, 09:49:24 AM »
Link to the download is on the first post!

Eventually I will change the name of it, but this is a very quick release, so for now just bear with me.

On another note, now that I have the first release out, I will be adding features.

Any suggestions are more than welcome.
« Last Edit: September 11, 2010, 09:55:38 AM by Prsn828 »
So, what will it be? Will you submit to my will, or must I bend reality to suit my needs?
Better answer before I do BOTH!

Offline Ammeh

  • Queen of the Internets
  • Bot Destroyer
  • ***
  • Posts: 169
    • View Profile
Re: Bot Code Analysis Tool
« Reply #25 on: September 11, 2010, 03:58:09 PM »
Downloading now...

12.3Mb O_o

Before you do a final release, get shasta or nums to give you a link the exe compressor thing. It's pretty damn effective.

Edit: maybe I'm doing something wrong, but all I can do is open, save or save as. When I open it loads it into a textbox, but that's all.
« Last Edit: September 11, 2010, 04:01:38 PM by Sammeh »

Offline Billy

  • Bot Destroyer
  • ***
  • Posts: 175
    • View Profile
Re: Bot Code Analysis Tool
« Reply #26 on: September 11, 2010, 04:52:15 PM »
I'm getting the same problem as Sammeh, it doesn't do anything. How do you get it to work?
"I cannot persuade myself that a beneficent and omnipotent God would have designedly created parasitic wasps with the express intention of their feeding within the living bodies of Caterpillars."

-Charles Darwin

Offline Prsn828

  • Bot Destroyer
  • ***
  • Posts: 139
    • View Profile
Re: Bot Code Analysis Tool
« Reply #27 on: September 11, 2010, 05:35:52 PM »
Press control-space to run a search on the wiki.  Right now load, save, and the search, are the only features I have so far, but now that it is at a usable point it will be easier to add new features to it.
So, what will it be? Will you submit to my will, or must I bend reality to suit my needs?
Better answer before I do BOTH!

Offline Shasta

  • Administrator
  • Bot Destroyer
  • *****
  • Posts: 231
    • View Profile
Re: Bot Code Analysis Tool
« Reply #28 on: September 11, 2010, 05:51:56 PM »
12.3Mb O_o

Before you do a final release, get shasta or nums to give you a link the exe compressor thing. It's pretty damn effective.
I just tried to compress it. Got an error saying it had already been packed by upx. :blink:

Offline Prsn828

  • Bot Destroyer
  • ***
  • Posts: 139
    • View Profile
Re: Bot Code Analysis Tool
« Reply #29 on: September 11, 2010, 06:24:00 PM »
I'm not surprised. It's written in python, so it has a bootstrapped version of python inside of it, besides all of the code for the actual program.  Of course, this also means that it won't grow in size very much as new features get added  :P
So, what will it be? Will you submit to my will, or must I bend reality to suit my needs?
Better answer before I do BOTH!