Author Topic: Hey guys, need some language help  (Read 2817 times)

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Hey guys, need some language help
« on: May 26, 2013, 12:31:34 PM »
I am trying to write a help document for the snapshot query program. As you may know language is not my strong side, and I am writing this document from scratch. Can someone peer review this thing and let me know if it makes any sense. thanks.

Quote
Basic query structure:

   varaiblename= value ,variablename= value , ...

You can search based on only one variable. example:


   name="test.txt"

   This will search for all robots named test.txt.


The 'name' variable supports special characters:

   * means zero or more characters
   ? means Any single character
   # Any single digit (0-9)

   [charlist] Any single character in charlist. example:


   name="[a-c]"

   This will search for a one character robot named a or b or c.


   [!charlist] Any single character not in charlist.

   To match special characters enclose them in brackets. example:


   name="[[]"

   This will match the  [   bracket.


   A hyphen (-) can appear either at the beginning (after an exclamation point
   if one is used) or at the end of charlist to match itself.

You can either search for the other variables directly or using the 'to' keyword. example:


   fitness= 16

   This will find all robots that have 16 as there fitness.


   fitness= 4 to 16

   This will find all robots that have from 4 ro 16 as there fitness.


The following operators are supported: add sub mult div pow
Please use reverse polish notation. example:


   energy= 2 3 add 2 mult to 2 4 pow

   This will search for robots between 10 and 16 energy.


The following bulit in keywords are supported: min, max, absmin, absmax

Use absmin and absmax to figure out the absolute minimum and absolute maximum
of a given variable name even if the search was narowed by a previuse call. example:


   Lets say we have three robots with the following:
   fitness=2 energy= 1
   fitness=2 energy= 2
   fitness=4 energy= 3

   If we call:
   fitness=2, energy= absmin to absmax

   Then the absmin in this case is 1 and the absmax in this case is 3.

   
Use min and max simply to figure out minimum and maximum of the remaining
robots in a query. example:


   Using the example above if we call:
   fitness=2, energy= min to max

   Then the min in this case is 1 and the max in this case is 2.


Note: absmin and absmax are calculated as min and max after a name query.
A name variable (if used) must always be the first variable in a query. example:


   Lets say we have three robots with the following:
   name="test1" energy= 1
   name="test1" energy= 2
   name="test2" energy= 3

   In this example, if we restrict the search to name="test1" then
   our energy absmin is 1 and our absmax is 2.

   If you search for all robots (name="*") you do not need to
   specify the name query at all and absmin and absmax
   works across all robots.


Finally, you can use keywords in combination with operators. example:


   energy= absmin absmax absmin sub 2 div add to absmax

   This will search the upper 50% of robots' energy.

« Last Edit: May 26, 2013, 04:48:46 PM by Botsareus »

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Hey guys, need some language help
« Reply #1 on: May 26, 2013, 07:17:34 PM »
looks like no one cares  :(


If it suffices as is let me know; It should work identically to the explanation. This is one of the rare cases where you do not need to actually test something to figure out how it works. If that last statement is not true , let me know and I'll post a version excluding the help file here. I should be done with it by mid Tuesday or Wednesday. For now someone help and save me the trouble of posting more then one version.
« Last Edit: May 26, 2013, 07:24:36 PM by Botsareus »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Hey guys, need some language help
« Reply #2 on: May 26, 2013, 08:00:34 PM »
It's memorial day weekend, we're all busy having fun :)  Have some patience.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Hey guys, need some language help
« Reply #3 on: May 26, 2013, 09:22:59 PM »
oh lol, Good point. I knew Monday was going to be a wash, but I totally forgot that you guys celebrate this stuff all weekend. (seeing Peter and Ricky online did not help me figure it out , plus I have seen no one I knew at the pool) Looks like them v8 just keep on coming.  :P

Offline Peter

  • Bot God
  • *****
  • Posts: 1177
    • View Profile
Re: Hey guys, need some language help
« Reply #4 on: May 27, 2013, 12:35:58 PM »
Seems good, sorry for the late response. Didn't have anything to add. Problem with something like this is that I have a hard time spotting errors unless I actually use the help. :x
Oh my god, who the hell cares.