home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource1 / ast40dos / intrpret.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-04  |  21.9 KB  |  643 lines

  1. /*
  2. ** Astrolog (Version 4.00) File: intrpret.c
  3. **
  4. ** IMPORTANT NOTICE: the graphics database and chart display routines
  5. ** used in this program are Copyright (C) 1991-1993 by Walter D. Pullen
  6. ** (cruiser1@stein.u.washington.edu). Permission is granted to freely
  7. ** use and distribute these routines provided one doesn't sell,
  8. ** restrict, or profit from them in any way. Modification is allowed
  9. ** provided these notices remain with any altered or edited versions of
  10. ** the program.
  11. **
  12. ** The main planetary calculation routines used in this program have
  13. ** been Copyrighted and the core of this program is basically a
  14. ** conversion to C of the routines created by James Neely as listed in
  15. ** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  16. ** available from Matrix Software. The copyright gives us permission to
  17. ** use the routines for personal use but not to sell them or profit from
  18. ** them in any way.
  19. **
  20. ** The PostScript code within the core graphics routines are programmed
  21. ** and Copyright (C) 1992-1993 by Brian D. Willoughby
  22. ** (brianw@sounds.wa.com). Conditions are identical to those above.
  23. **
  24. ** The extended accurate ephemeris databases and formulas are from the
  25. ** calculation routines in the program "Placalc" and are programmed and
  26. ** Copyright (C) 1989,1991,1993 by Astrodienst AG and Alois Treindl
  27. ** (alois@azur.ch). The use of that source code is subject to
  28. ** regulations made by Astrodienst Zurich, and the code is not in the
  29. ** public domain. This copyright notice must not be changed or removed
  30. ** by any user of this program.
  31. **
  32. ** Initial programming 8/28,30, 9/10,13,16,20,23, 10/3,6,7, 11/7,10,21/1991.
  33. ** X Window graphics initially programmed 10/23-29/1991.
  34. ** PostScript graphics initially programmed 11/29-30/1992.
  35. ** Last code change made 12/31/1993.
  36. */
  37.  
  38. #include "astrolog.h"
  39.  
  40. #ifdef INTERPRET
  41.  
  42. /*
  43. ******************************************************************************
  44. ** Interpretation Subroutines.
  45. ******************************************************************************
  46. */
  47.  
  48. /* This function is used by the interpretation routines to print out lines  */
  49. /* of text with newlines inserted just before the end of screen is reached. */
  50.  
  51. void FieldWord(string)
  52. char *string;
  53. {
  54.   static char line[STRING*4];
  55.   static int cursor = 0;
  56.   int i, j;
  57.  
  58.   /* Hack: Dump buffer if function called with a null string. */
  59.  
  60.   if (*string == 0) {
  61.     line[cursor] = 0;
  62.     fprintf(S, "%s\n", line);
  63.     cursor = 0;
  64.     return;
  65.   }
  66.   if (cursor)
  67.     line[cursor++] = ' ';
  68.   for (i = 0; (line[cursor] = string[i]); i++, cursor++)
  69.     ;
  70.  
  71.   /* When buffer overflows 80 columns, print out one line and start over. */
  72.  
  73.   while (cursor >= screenwidth-1) {
  74.     for (i = screenwidth-1; line[i] != ' '; i--)
  75.       ;
  76.     line[i] = 0;
  77.     fprintf(S, "%s\n", line);
  78.     line[0] = line[1] = ' ';
  79.     for (j = 2; (line[j] = line[i+j-1]) != 0; j++)
  80.       ;
  81.     cursor -= (i-1);
  82.   }
  83. }
  84.  
  85.  
  86. /* Display a general interpretation of what each sign of the zodiac, house, */
  87. /* and planet or object means. This is called to do the -I0 switch table.   */
  88.  
  89. void InterpretGeneral()
  90. {
  91.   char string[STRING];
  92.   int i;
  93.  
  94.   fprintf(S,
  95.     "Signs of the zodiac represent psychological characteristics.\n\n");
  96.   for (i = 1; i <= SIGNS; i++) {
  97.     AnsiColor(signansi(i));
  98.     sprintf(string, "%s is", signname[i]); FieldWord(string);
  99.     sprintf(string, "%s, and", description[i]); FieldWord(string);
  100.     sprintf(string, "%s.", desire[i]); FieldWord(string);
  101.     FieldWord("");
  102.   }
  103.   AnsiColor(DEFAULT);
  104.   fprintf(S, "\nHouses represent different areas within one's life.\n\n");
  105.   for (i = 1; i <= SIGNS; i++) {
  106.     AnsiColor(signansi(i));
  107.     sprintf(string, "The %d%s House is the area of life dealing with",
  108.       i, post[i]); FieldWord(string);
  109.     sprintf(string, "%s.", lifearea[i]); FieldWord(string);
  110.     FieldWord("");
  111.   }
  112.   AnsiColor(DEFAULT);
  113.   fprintf(S, "\nPlanets represent various parts of one's mind or self.\n\n");
  114.   for (i = 1; i <= OBJECTI; i++) {
  115.     if (ignore[i] || IsCusp(i))
  116.       continue;
  117.     AnsiColor(objectansi[i]);
  118.     sprintf(string, "%s%s%s%s represents one's",
  119.       i < 3 || (i >= THINGS && i <= OBJECTS) ? "The " : "",
  120.       i == _NOD ? "North " : (i == _FOR ? "Part of " : ""), objectname[i],
  121.       i == 13 ? " Athena" : ""); FieldWord(string);
  122.     sprintf(string, "%s.", mindpart[i]); FieldWord(string);
  123.     FieldWord("");
  124.   }
  125.   AnsiColor(DEFAULT);
  126. }
  127.  
  128.  
  129. /* Display a general interpretation of what each aspect type means. This */
  130. /* is called when printing the interpretation table in the -I0 switch.   */
  131.  
  132. void InterpretAspectGeneral()
  133. {
  134.   char string[STRING];
  135.   int i;
  136.  
  137.   fprintf(S, "\nAspects are different relationships between planets.\n\n");
  138.   for (i = 1; i <= MIN(aspects, ASPECTI); i++) {
  139.     AnsiColor(aspectansi[i]);
  140.     sprintf(string, "When planets are %s, one", aspectname[i]);
  141.     FieldWord(string); sprintf(string, interact[i], ""); FieldWord(string);
  142.     FieldWord("another.");
  143.     if (therefore[i][0]) {
  144.       sprintf(string, "%s.", therefore[i]); FieldWord(string);
  145.     }
  146.     FieldWord("");
  147.   }
  148.   return;
  149. }
  150.  
  151.  
  152. /* Print the interpretation of each planet in sign and house, as specified */
  153. /* with the -I switch. This is basically array accessing combining the     */
  154. /* meanings of each planet, sign, and house, and a couple of other things. */
  155.  
  156. void InterpretLocation()
  157. {
  158.   char string[STRING], c;
  159.   int i, j;
  160.  
  161.   printl();
  162.   for (i = 1; i <= OBJECTI; i++) {
  163.     if (ignore[i] || IsCusp(i))
  164.       continue;
  165.     AnsiColor(objectansi[i]);
  166.     j = ZTOS(planet[i]); c = Dignify(i, j);
  167.     sprintf(string, "%s%s%s%s in %s", ret[i] < 0.0 ? "Retrograde " : "",
  168.       i == _NOD ? "North " : (i == _FOR ? "Part of " : ""), objectname[i],
  169.       i == 13 ? " Athena" : "", signname[j]);
  170.     FieldWord(string);
  171.     sprintf(string, "and %d%s House:", inhouse[i], post[inhouse[i]]);
  172.     FieldWord(string);
  173.     FieldWord("This person's"); FieldWord(mindpart[i]); FieldWord("is");
  174.     if (((int) planet[i]) % 30 < 10)
  175.       FieldWord("very");
  176.     sprintf(string, "%s, and", description[j]); FieldWord(string);
  177.     sprintf(string, "%s.", desire[j]); FieldWord(string);
  178.     FieldWord("Most often this manifests");
  179.     if (ret[i] < 0.0 && i != _NOD)
  180.       FieldWord("in an independent, backward, introverted manner, and");
  181.     FieldWord("in the area of life dealing with");
  182.     sprintf(string, "%s.", lifearea[inhouse[i]]); FieldWord(string);
  183.  
  184.     /* Extra information if planet is in its ruling, falling, etc, sign. */
  185.  
  186.     if (c == 'R')
  187.       FieldWord("This is a major aspect of the person's psyche!");
  188.     else if (c == 'F')
  189.       FieldWord("(This bit plays only a minor part in the person's psyche.)");
  190.     else if (c == 'e')
  191.       FieldWord("It is easy for them to express this part of themself.");
  192.     else if (c == 'd')
  193.       FieldWord("It is difficult for them to express this part of themself.");
  194.     FieldWord("");
  195.   }
  196. }
  197.  
  198.  
  199. /* Print an interpretation for a particular aspect in effect in a chart. */
  200. /* This is called from the InterpretGrid and ChartAspect routines.       */
  201.  
  202. void InterpretAspect(x, y)
  203. int x, y;
  204. {
  205.   char string[STRING*2];
  206.   int n;
  207.  
  208.   n = grid->n[x][y];
  209.   if (n < 1 || n > ASPECTI ||
  210.     IsCusp(x) || IsCusp(y) || x > OBJECTI || y > OBJECTI)
  211.     return;
  212.   AnsiColor(aspectansi[n]);
  213.   sprintf(string, "%s %s %s: This person's", objectname[x],
  214.     aspectname[n], objectname[y]);
  215.   FieldWord(string); FieldWord(mindpart[x]);
  216.   sprintf(string, interact[n],
  217.     modifier[MIN(abs(grid->v[x][y])/150, 2)][n-1]);
  218.   FieldWord(string);
  219.   sprintf(string, "their %s.", mindpart[y]); FieldWord(string);
  220.   if (therefore[n][0]) {
  221.     sprintf(string, "%s.", therefore[n]); FieldWord(string);
  222.   }
  223.   FieldWord("");
  224. }
  225.  
  226.  
  227. /* Print the interpretation of each aspect in the aspect grid, as specified */
  228. /* with the -g -I switch. Again, this is done by basically array accessing  */
  229. /* of the meanings of the two planets in aspect and of the aspect itself.   */
  230.  
  231. void InterpretGrid()
  232. {
  233.   int i, j;
  234.  
  235.   for (i = 1; i < OBJECTI; i++) if (!ignore[i] && !IsCusp(i))
  236.     for (j = i+1; j <= OBJECTI; j++) if (!ignore[j] && !IsCusp(i))
  237.       InterpretAspect(i, j);
  238. }
  239.  
  240.  
  241. /* Print an interpretation for a particular midpoint in effect in a chart. */
  242. /* This is called from the ChartMidpoint routine.                          */
  243.  
  244. void InterpretMidpoint(x, y)
  245. int x, y;
  246. {
  247.   char string[STRING];
  248.   int n, i;
  249.  
  250.   if (IsCusp(x) || IsCusp(y) || x > OBJECTI || y > OBJECTI)
  251.     return;
  252.   n = grid->n[y][x];
  253.   AnsiColor(signansi(n));
  254.   sprintf(string, "%s midpoint %s in %s: The merging of the person's",
  255.     objectname[x], objectname[y], signname[n]);
  256.   FieldWord(string); FieldWord(mindpart[x]);
  257.   FieldWord("with their"); FieldWord(mindpart[y]);
  258.   FieldWord("is");
  259.   if (grid->v[y][x]/60 < 10)
  260.     FieldWord("very");
  261.   sprintf(string, "%s, and", description[n]); FieldWord(string);
  262.   sprintf(string, "%s.", desire[n]); FieldWord(string);
  263.   FieldWord("Most often this manifests in");
  264.   if (ret[x]+ret[y] < 0.0 && x != _NOD && y != _NOD)
  265.     FieldWord("an independent, backward, introverted manner, and");
  266.   FieldWord("the area of life dealing with");
  267.   i = HousePlaceIn(STOZ(n) + (real)grid->v[y][x]/60.0);
  268.   sprintf(string, "%s.", lifearea[i]); FieldWord(string);
  269.   FieldWord("");
  270. }
  271.  
  272.  
  273. /* This is a subprocedure of DisplayInDay(). Print the interpretation for */
  274. /* a particular instance of the various exciting events that can happen.  */ 
  275.  
  276. void InterpretInDay(source, aspect, dest)
  277. int source, aspect, dest;
  278. {
  279.   char string[STRING];
  280.  
  281.   if (source > OBJECTI || dest > OBJECTI)
  282.     return;
  283.  
  284.   /* Interpret object changing direction. */
  285.  
  286.   if (aspect == _DIR) {
  287.     AnsiColor(objectansi[source]);
  288.     FieldWord("Energy representing"); FieldWord(mindpart[source]);
  289.     FieldWord("will tend to manifest in");
  290.     FieldWord(dest ? "an independent, backward, introverted" :
  291.       "the standard, direct, open");
  292.     FieldWord("manner.");
  293.     FieldWord("");
  294.  
  295.   /* Interpret object entering new sign. */
  296.  
  297.   } else if (aspect == _SIG) {
  298.     AnsiColor(objectansi[source]);
  299.     FieldWord("Energy representing"); FieldWord(mindpart[source]);
  300.     sprintf(string, "will be %s,", description[dest]);
  301.     FieldWord(string);
  302.     sprintf(string, "and it %s.", desire[dest]); FieldWord(string);
  303.     FieldWord("");
  304.  
  305.   /* Interpret aspect between transiting planets. */
  306.  
  307.   } else if (aspect > 0 && aspect <= ASPECTI) {
  308.     AnsiColor(aspectansi[aspect]);
  309.     FieldWord("Energy representing"); FieldWord(mindpart[source]);
  310.     sprintf(string, interact[aspect], modifier[1][aspect-1]);
  311.     FieldWord(string);
  312.     sprintf(string, "energies of %s.", mindpart[dest]); FieldWord(string);
  313.     if (therefore[aspect][0]) {
  314.       if (aspect > _CON) {
  315.         sprintf(string, "%s.", therefore[aspect]); FieldWord(string);
  316.       } else
  317.         FieldWord("They will affect each other prominently.");
  318.     }
  319.     FieldWord("");
  320.   }
  321. }
  322.  
  323.  
  324. /* This is a subprocedure of DisplayTransit(). Print the interpretation for */
  325. /* a particular transit of a planet to a natal object of a chart.           */ 
  326.  
  327. void InterpretTransit(source, aspect, dest)
  328. int source, aspect, dest;
  329. {
  330.   char string[STRING];
  331.  
  332.   if (source <= OBJECTS && dest <= OBJECTS && aspect <= ASPECTI) {
  333.     AnsiColor(aspectansi[aspect]);
  334.     FieldWord("Energy representing"); FieldWord(mindpart[source]);
  335.     sprintf(string, interact[aspect], modifier[1][aspect-1]);
  336.     FieldWord(string);
  337.     if (source != dest) {
  338.       sprintf(string, "the person's %s.", mindpart[dest]); FieldWord(string);
  339.     } else
  340.       FieldWord("the same aspect inside the person's makeup.");
  341.     if (therefore[aspect][0]) {
  342.       if (aspect > _CON) {
  343.         sprintf(string, "%s.", therefore[aspect]); FieldWord(string);
  344.       } else
  345.         FieldWord("This part of their psyche will be strongly influenced.");
  346.     }
  347.     FieldWord("");
  348.   }
  349. }
  350.  
  351.  
  352. /* Print the interpretation of one person's planet in another's sign and    */
  353. /* house, in a synastry chart as specified with the -r switch combined with */
  354. /* -I. This is very similar to the interpretation of the standard -v chart  */
  355. /* in InterpretLocation(), but we treat the chart as a relationship here.   */
  356.  
  357. void InterpretSynastry()
  358. {
  359.   char string[STRING], c;
  360.   int i, j;
  361.  
  362.   printl();
  363.   for (i = 1; i <= OBJECTI; i++) {
  364.     if (ignore[i] || IsCusp(i))
  365.       continue;
  366.     AnsiColor(objectansi[i]);
  367.     j = ZTOS(planet[i]); c = Dignify(i, j);
  368.     sprintf(string, "%s%s%s%s in %s,", ret[i] < 0.0 ? "Retrograde " : "",
  369.       i == _NOD ? "North " : (i == _FOR ? "Part of " : ""), objectname[i],
  370.       i == 13 ? " Athena" : "", signname[j]);
  371.     FieldWord(string);
  372.     sprintf(string, "in their %d%s House:", inhouse[i], post[inhouse[i]]);
  373.     FieldWord(string);
  374.     FieldWord("Person1's"); FieldWord(mindpart[i]); FieldWord("is");
  375.     if (((int) planet[i]) % 30 < 10)
  376.       FieldWord("very");
  377.     sprintf(string, "%s, and", description[j]); FieldWord(string);
  378.     sprintf(string, "%s.", desire[j]); FieldWord(string);
  379.     FieldWord("This");
  380.     if (ret[i] < 0.0 && i != _NOD)
  381.       FieldWord(
  382.         "manifests in an independent, backward, introverted manner, and");
  383.     FieldWord("affects Person2 in the area of life dealing with");
  384.     sprintf(string, "%s.", lifearea[inhouse[i]]); FieldWord(string);
  385.  
  386.     /* Extra information if planet is in its ruling, falling, etc, sign. */
  387.  
  388.     if (c == 'R')
  389.       FieldWord("This is a major aspect of Person1's psyche!");
  390.     else if (c == 'F')
  391.       FieldWord("(This bit plays only a minor part in Person1's psyche.)");
  392.     else if (c == 'e')
  393.       FieldWord("Person2 is affected harmoniously in this way.");
  394.     else if (c == 'd')
  395.       FieldWord("Person2 is affected discordantly in this way.");
  396.     FieldWord("");
  397.   }
  398. }
  399.  
  400.  
  401. /* Print an interpretation for a particular aspect in effect in a comparison */
  402. /* relationship chart. This is called from the InterpretGridRelation and     */
  403. /* the DisplayAspectRelation routines.                                       */
  404.  
  405. void InterpretAspectRelation(x, y)
  406. {
  407.   char string[STRING*2];
  408.   int n;
  409.  
  410.   n = grid->n[y][x];
  411.   if (n < 1 || n > ASPECTI ||
  412.     IsCusp(x) || IsCusp(y) || x > OBJECTI || y > OBJECTI)
  413.     return;
  414.   AnsiColor(aspectansi[n]);
  415.   sprintf(string, "%s %s %s: Person1's", objectname[x],
  416.     aspectname[n], objectname[y]);
  417.   FieldWord(string); FieldWord(mindpart[x]);
  418.   sprintf(string, interact[n],
  419.     modifier[MIN(abs(grid->v[y][x])/150, 2)][n-1]);
  420.   FieldWord(string);
  421.   sprintf(string, "Person2's %s.", mindpart[y]); FieldWord(string);
  422.   if (therefore[n][0]) {
  423.     if (n != 1) {
  424.       sprintf(string, "%s.", therefore[n]); FieldWord(string);
  425.     } else
  426.       FieldWord("These parts affect each other prominently.");
  427.   }
  428.   FieldWord("");
  429. }
  430.  
  431.  
  432. /* Print the interpretation of each aspect in the relationship aspect grid, */
  433. /* as specified with the -r0 -g -I switch combination.                      */
  434.  
  435. void InterpretGridRelation()
  436. {
  437.   int i, j;
  438.  
  439.   for (i = 1; i <= OBJECTI; i++) if (!ignore[i])
  440.     for (j = 1; j <= OBJECTI; j++) if (!ignore[j])
  441.       InterpretAspectRelation(i, j);
  442. }
  443.  
  444.  
  445. /* Print the interpretation of a midpoint in the relationship grid, as */
  446. /* specified with the -r0 -m -I switch combination.                    */
  447.  
  448. void InterpretMidpointRelation(x, y)
  449. {
  450.   char string[STRING];
  451.   int n;
  452.  
  453.   if (IsCusp(x) || IsCusp(y) || x > OBJECTI || y > OBJECTI)
  454.     return;
  455.   n = grid->n[y][x];
  456.   AnsiColor(signansi(n));
  457.   sprintf(string, "%s midpoint %s in %s: The merging of person1's",
  458.     objectname[x], objectname[y], signname[n]);
  459.   FieldWord(string); FieldWord(mindpart[x]);
  460.   FieldWord("with person2's"); FieldWord(mindpart[y]);
  461.   FieldWord("is");
  462.   if (grid->v[y][x]/60 < 10)
  463.     FieldWord("very");
  464.   sprintf(string, "%s, and", description[n]); FieldWord(string);
  465.   sprintf(string, "%s.", desire[n]); FieldWord(string);
  466.   if (ret1[x]+ret2[y] < 0.0 && x != _NOD && y != _NOD) {
  467.     FieldWord("Most often this manifests in");
  468.     FieldWord("an independent, backward, introverted manner.");
  469.   }
  470.   FieldWord("");
  471. }
  472. #endif /* INTERPRET */
  473.  
  474.  
  475. /*
  476. ******************************************************************************
  477. ** Chart Influence Subroutines.
  478. ******************************************************************************
  479. */
  480.  
  481. /* This is a subprocedure of ChartInfluence(). Based on the values in the */
  482. /* array parameter 'value', store numbers in array 'rank' reflecting the  */
  483. /* relative order, e.g. value[x] 2nd greatest array value -> rank[x] = 2. */
  484.  
  485. void SortRank(value, rank, size)
  486. real *value;
  487. int *rank;
  488. {
  489.   int h, i, j, k;
  490.  
  491.   value[0] = -1.0;
  492.   for (i = 1; i <= size; i++)
  493.     rank[i] = -1;
  494.   for (h = 1, i = 0; h <= size; h++) {
  495.     if (size != SIGNS && (ignore[h] || !IsThing(h)))
  496.       continue;
  497.     i++;
  498.     k = 0;
  499.     for (j = 1; j <= size; j++) {
  500.       if (size != SIGNS && (ignore[j] || !IsThing(j)))
  501.         continue;
  502.       if (value[j] > value[k] && rank[j] < 0)
  503.         k = j;
  504.     }
  505.  
  506.         /* 'k' is the current position of the 'i'th place planet. */
  507.  
  508.     rank[k] = i;
  509.   }
  510. }
  511.  
  512.  
  513. /* Print out a list of power values and relative rankings, based on the */
  514. /* placements of the planets, and their aspects in the aspect grid, as  */
  515. /* specified with the -j "find influences" switch.                      */
  516.  
  517. void ChartInfluence()
  518. {
  519.   real power[BASE+1], power1[BASE+1], power2[BASE+1],
  520.     total, total1, total2, x;
  521.   int rank[BASE+1], rank1[BASE+1], rank2[BASE+1], i, j, k, l;
  522.   char c;
  523.  
  524.   for (i = 1; i <= BASE; i++)
  525.     power1[i] = power2[i] = 0.0;
  526.   total = total1 = total2 = 0.0;
  527.  
  528.   /* First, for each object, find its power based on its placement alone. */
  529.  
  530.   for (i = 1; i <= BASE; i++) if (!ignore[i] && IsThing(i)) {
  531.     j = ZTOS(planet[i]);
  532.     power1[i] += objectinf[i];            /* Influence of planet itself. */
  533.     power1[i] += houseinf[inhouse[i]];    /* Influence of house it's in. */
  534.     c = Dignify(i, j);
  535.     switch (c) {
  536.     case 'R': x = objectinf[BASE+1]; break;  /* Planets in signs they rule / */
  537.     case 'e': x = objectinf[BASE+2]; break;  /* exalted in have influence.   */
  538.     default:  x = 0.0;
  539.     }
  540.     c = Dignify(i, inhouse[i]);
  541.     switch (c) {
  542.     case 'R': x += houseinf[SIGNS+1]; break; /* Planet in house aligned with */
  543.     case 'e': x += houseinf[SIGNS+2]; break; /* sign ruled has influence.    */
  544.     default: ;
  545.     }
  546.     power1[i] += x;
  547.     if (i != rules[j])                         /* The planet ruling the sign */
  548.       power1[rules[j]] += objectinf[i]/2.0;    /* and the house that the     */
  549.     if (i != (j = rules[inhouse[i]]))          /* current planet is in, gets */
  550.       power1[j] += objectinf[i]/2.0;           /* extra influence.           */
  551.   }
  552.   for (i = 1; i <= SIGNS; i++) {        /* Various planets get influence */
  553.     j = ZTOS(house[i]);                 /* if house cusps fall in signs  */
  554.     power1[rules[j]] += houseinf[i];    /* they rule.                    */
  555.   }
  556.  
  557.   /* Second, for each object, find its power based on aspects it makes. */
  558.  
  559.   CreateGrid(FALSE);
  560.   for (j = 1; j <= BASE; j++) if (!ignore[j] && IsThing(j))
  561.     for (i = 1; i <= BASE; i++) if (!ignore[i] && IsThing(i) && i != j) {
  562.       k = grid->n[MIN(i, j)][MAX(i, j)];
  563.       if (k) {
  564.         l = grid->v[MIN(i, j)][MAX(i, j)];
  565.         power2[j] += aspectinf[k]*objectinf[i]*
  566.           (1.0-dabs((real)l)/60.0/aspectorb[k]);
  567.       }
  568.     }
  569.  
  570.   /* Calculate total power of each planet. */
  571.  
  572.   for (i = 1; i <= BASE; i++) if (!ignore[i] && IsThing(i)) {
  573.     power[i] = power1[i]+power2[i]; total1 += power1[i]; total2 += power2[i];
  574.   }
  575.   total = total1+total2;
  576.  
  577.   /* Finally, determine ranks of the arrays, then print everything out. */
  578.  
  579.   SortRank(power1, rank1, BASE); SortRank(power2, rank2, BASE);
  580.   SortRank(power, rank, BASE);
  581.   fprintf(S, "  Planet:    Position      Aspects    Total Rank  Percent\n");
  582.   for (i = 1; i <= BASE; i++) if (!ignore[i] && IsThing(i)) {
  583.     AnsiColor(objectansi[i]);
  584.     fprintf(S, "%8.8s: ", objectname[i]);
  585.     fprintf(S, "%6.1f (%2d) +%6.1f (%2d) =%7.1f (%2d) /%6.1f%%\n",
  586.       power1[i], rank1[i], power2[i], rank2[i],
  587.       power[i], rank[i], power[i]/total*100.0);
  588.   }
  589.   AnsiColor(DEFAULT);
  590.   fprintf(S, "   Total: %6.1f      +%6.1f      =%7.1f      / 100.0%%\n",
  591.     total1, total2, total);
  592.  
  593.   /* Now, print out a list of power values and relative rankings, based on  */
  594.   /* the power of each sign of the zodiac, as indicated by the placement of */
  595.   /* the planets above, in the chart, as specified with the -j0 switch.     */
  596.  
  597.   if (!(exdisplay & DASHj0))
  598.     return;
  599.   for (i = 1; i <= SIGNS; i++)
  600.     power1[i] = 0.0;
  601.  
  602.   /* For each sign, determine its power based on the power of the object. */
  603.  
  604.   for (i = 1; i <= BASE; i++) if (!ignore[i] && !IsCusp(i)) {
  605.     power1[ZTOS(planet[i])] += objectinf[i] / 2.0;
  606.     power1[inhouse[i]]  += objectinf[i] / 4.0;
  607.     power1[ruler1[i]]   += objectinf[i] / 3.0;
  608.     if (ruler2[i])
  609.       power1[ruler2[i]] += objectinf[i] / 4.0;
  610.   }
  611.   if (!ignore[_NOD]) {
  612.     power1[Mod12((int)planet[_NOD]/30+7)] += power[_NOD] / 2.0; /* South */
  613.     power1[Mod12(inhouse[_NOD]+6)]        += power[_NOD] / 4.0; /* Node. */
  614.   }
  615.   total1 = 0.0;
  616.   for (i = 1; i <= SIGNS; i++)
  617.     total1 += power1[i];
  618.  
  619.   /* Again, determine ranks in the array, and print everything out. */
  620.  
  621.   SortRank(power1, rank1, SIGNS);
  622.   fprintf(S,
  623.     "\n       Sign:  Power Rank  Percent  - Element  Power  Percent\n");
  624.   for (i = 1; i <= SIGNS; i++) {
  625.     AnsiColor(signansi(i));
  626.     fprintf(S, "%11.11s: ", signname[i]);
  627.     fprintf(S, "%6.1f (%2d) /%6.1f%%",
  628.       power1[i], rank1[i], power1[i]/total1*100.0);
  629.     if (i <= 4) {
  630.       fprintf(S, "  -%7.7s:", element[i-1]);
  631.       total2 = 0.0;
  632.       for (j = 1; j < SIGNS; j += 4)
  633.         total2 += power1[i+j-1];
  634.       fprintf(S, "%7.1f /%6.1f%%", total2, total2/total1*100.0);
  635.     }
  636.     printl();
  637.   }
  638.   AnsiColor(DEFAULT);
  639.   fprintf(S, "      Total:%7.1f      / 100.0%%\n", total1);
  640. }
  641.  
  642. /* intrpret.c */
  643.