Advertisement
jargon

Keal SDK: Constellation (re: Trapwire / Tartan)

Mar 16th, 2013
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. "TrapWire / Tartan" source code package in a nutshell. (As presented here with permission from the original author of the original code, myself.) Love, Peace & Harmony, Homies.
  2.  
  3. Keal SDK's "Constellation" Module:
  4.  
  5. fn v(a,b){c=0;r=0;t=0;foreach(a as k=>v){if(isset(b[k])){c++;t=b[k]-v;r+=t*t;}}if((c!==0)&&(r!==0)){r=sqrt(r);}ret r;}fn s(h,a,b){r=0;t=0;e=v(h[a],h[b]);foreach(h as c=>d){if((a!==c)&&(b!==c)){t++;f=v(h[a],h[c]);g=v(h[b],h[c]);if(e>f){r++;}if(e>g){r++;}}}ret 1-r/2/t;}
  6.  
  7. Copyrighted 1994-2012 by "Timothy Robert Keal" under GPL + Creative Commons, "Attribution" / "Not for Profit" licenses.
  8.  
  9. http://www.gnu.org/licenses/gpl.html
  10. http://creativecommons.org/licenses/by/2.0/legalcode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement