public void Setup(Vector3 target, houses home, main m) { m_main = m; m_target = target; m_home = home; m_speed *= Random.Range(speed_variation.x, speed_variation.y); lookingForAlternate = false; }
void assignNewHouses(int ces) { newHouses.Clear(); for (int i = 0; i < ces; i++) { houses template = new houses(); template.no = ++no; template.houseType = decideToHouseType(); template.ekoz = decideEos(); (template.roomNumber, template.saloonNumber) = decideRoomNumber(template.houseType); template.price = decideToPrice(template); newHouses.Add(template); } }
/// <summary> /// finds house according to no(id). /// </summary> /// <param name="no">id of house</param> /// <param name="type">is house bought or new or old? /// 1= new /// 2= bought /// 3= old (will be add) /// enter this value to faster find /// </param> /// <returns></returns> houses searchHouse(int no, int type = 0) { if (type == 0) { foreach (houses template in newHouses) { if (no == template.no) { return(template); } } foreach (houses template in boughtHouses) { if (no == template.no) { return(template); } } } if (type == 1)//new { foreach (houses template in newHouses) { if (no == template.no) { return(template); } } } if (type == 2)//bought { foreach (houses template in boughtHouses) { if (no == template.no) { return(template); } } } houses garbageHouse = new houses(); garbageHouse.Name = "garbage"; return(garbageHouse); }
public void buyingHouse(int no, int uiNo) { uiNo--; print("no: " + no + " uiNo: " + uiNo); houses boughtHouse = searchHouse(no, 1); print(boughtHouse.price); print(player.money); if (player.money >= boughtHouse.price) { player.money -= boughtHouse.price; boughtHouses.Add(boughtHouse); //------------------------------------------------ //increaseColor(newHouses[uiNo].transform.Find("transparent").gameObject, 0f, 110); print("boughted"); } else { print("u have no enough money dude"); } }
/* ********************************************************* * Arguments: th = sidereal time (angle 0..360 degrees * hsy = letter code for house system; * A equal * E equal * B Alcabitius * C Campanus * G 36 Gauquelin sectors * H horizon / azimut * K Koch * M Morinus * O Porphyry * P Placidus * R Regiomontanus * T Polich/Page ("topocentric") * U Krusinski-Pisa-Goelzer * V equal Vehlow * W equal, whole sign * X axial rotation system/ Meridian houses * Y APC houses * fi = geographic latitude * ekl = obliquity of the ecliptic * iteration_count = number of iterations in * Placidus calculation; can be 1 or 2. * ********************************************************* * Koch and Placidus don't work in the polar circle. * We swap MC/IC so that MC is always before AC in the zodiac * We than divide the quadrants into 3 equal parts. * ********************************************************* * All angles are expressed in degrees. * Special trigonometric functions sind, cosd etc. are * implemented for arguments in degrees. ***********************************************************/ int CalcH( double th, double fi, double ekl, char hsy, int iteration_count, houses hsp) { double tane, tanfi, cosfi, tant, sina, cosa, th2; double a, c, f, fh1, fh2, xh1, xh2, rectasc, ad3, acmc, vemc; int i, ih, ih2, retc = SwissEph.OK; double sine, cose; double[] x = new double[3]; double krHorizonLon; /* BK 14.02.2006 */ cose = cosd(ekl); sine = sind(ekl); tane = tand(ekl); /* north and south poles */ if (Math.Abs(Math.Abs(fi) - 90) < VERY_SMALL) { if (fi < 0) fi = -90 + VERY_SMALL; else fi = 90 - VERY_SMALL; } tanfi = tand(fi); /* mc */ if (Math.Abs(th - 90) > VERY_SMALL && Math.Abs(th - 270) > VERY_SMALL) { tant = tand(th); hsp.mc = atand(tant / cose); if (th > 90 && th <= 270) hsp.mc = SE.swe_degnorm(hsp.mc + 180); } else { if (Math.Abs(th - 90) <= VERY_SMALL) hsp.mc = 90; else hsp.mc = 270; } /* if */ hsp.mc = SE.swe_degnorm(hsp.mc); /* ascendant */ hsp.ac = Asc1(th + 90, fi, sine, cose); hsp.cusp[1] = hsp.ac; hsp.cusp[10] = hsp.mc; if (hsy > 95) hsy = (char)(hsy - 32);/* translate into capital letter */ switch (hsy) { case 'A': /* equal houses */ case 'E': /* * within polar circle we swap AC/DC if AC is on wrong side */ acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); hsp.cusp[1] = hsp.ac; } for (i = 2; i <= 12; i++) hsp.cusp[i] = SE.swe_degnorm(hsp.cusp[1] + (i - 1) * 30); break; case 'C': /* Campanus houses and Horizon or Azimut system */ case 'H': if (hsy == 'H') { if (fi > 0) fi = 90 - fi; else fi = -90 - fi; /* equator */ if (Math.Abs(Math.Abs(fi) - 90) < VERY_SMALL) { if (fi < 0) fi = -90 + VERY_SMALL; else fi = 90 - VERY_SMALL; } th = SE.swe_degnorm(th + 180); } fh1 = asind(sind(fi) / 2); fh2 = asind(Math.Sqrt(3.0) / 2 * sind(fi)); cosfi = cosd(fi); if (Math.Abs(cosfi) == 0) { /* '==' should be save! */ if (fi > 0) xh1 = xh2 = 90; /* cosfi = VERY_SMALL; */ else xh1 = xh2 = 270; /* cosfi = -VERY_SMALL; */ } else { xh1 = atand(Math.Sqrt(3.0) / cosfi); xh2 = atand(1 / Math.Sqrt(3.0) / cosfi); } hsp.cusp[11] = Asc1(th + 90 - xh1, fh1, sine, cose); hsp.cusp[12] = Asc1(th + 90 - xh2, fh2, sine, cose); if (hsy == 'H') hsp.cusp[1] = Asc1(th + 90, fi, sine, cose); hsp.cusp[2] = Asc1(th + 90 + xh2, fh2, sine, cose); hsp.cusp[3] = Asc1(th + 90 + xh1, fh1, sine, cose); /* within polar circle, when mc sinks below horizon and * ascendant changes to western hemisphere, all cusps * must be added 180 degrees. * houses will be in clockwise direction */ if (Math.Abs(fi) >= 90 - ekl) { /* within polar circle */ acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); hsp.mc = SE.swe_degnorm(hsp.mc + 180); for (i = 1; i <= 12; i++) hsp.cusp[i] = SE.swe_degnorm(hsp.cusp[i] + 180); } } if (hsy == 'H') { for (i = 1; i <= 3; i++) hsp.cusp[i] = SE.swe_degnorm(hsp.cusp[i] + 180); for (i = 11; i <= 12; i++) hsp.cusp[i] = SE.swe_degnorm(hsp.cusp[i] + 180); /* restore fi and th */ if (fi > 0) fi = 90 - fi; else fi = -90 - fi; th = SE.swe_degnorm(th + 180); acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); } } break; case 'K': /* Koch houses */ if (Math.Abs(fi) >= 90 - ekl) { /* within polar circle */ retc = SwissEph.ERR; goto porphyry; } sina = sind(hsp.mc) * sine / cosd(fi); if (sina > 1) sina = 1; if (sina < -1) sina = -1; cosa = Math.Sqrt(1 - sina * sina); /* always >> 0 */ c = atand(tanfi / cosa); ad3 = asind(sind(c) * sina) / 3.0; hsp.cusp[11] = Asc1(th + 30 - 2 * ad3, fi, sine, cose); hsp.cusp[12] = Asc1(th + 60 - ad3, fi, sine, cose); hsp.cusp[2] = Asc1(th + 120 + ad3, fi, sine, cose); hsp.cusp[3] = Asc1(th + 150 + 2 * ad3, fi, sine, cose); break; case 'O': /* Porphyry houses */ porphyry: /* * within polar circle we swap AC/DC if AC is on wrong side */ acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); hsp.cusp[1] = hsp.ac; acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); } hsp.cusp[2] = SE.swe_degnorm(hsp.ac + (180 - acmc) / 3); hsp.cusp[3] = SE.swe_degnorm(hsp.ac + (180 - acmc) / 3 * 2); hsp.cusp[11] = SE.swe_degnorm(hsp.mc + acmc / 3); hsp.cusp[12] = SE.swe_degnorm(hsp.mc + acmc / 3 * 2); break; case 'R': /* Regiomontanus houses */ fh1 = atand(tanfi * 0.5); fh2 = atand(tanfi * cosd(30)); hsp.cusp[11] = Asc1(30 + th, fh1, sine, cose); hsp.cusp[12] = Asc1(60 + th, fh2, sine, cose); hsp.cusp[2] = Asc1(120 + th, fh2, sine, cose); hsp.cusp[3] = Asc1(150 + th, fh1, sine, cose); /* within polar circle, when mc sinks below horizon and * ascendant changes to western hemisphere, all cusps * must be added 180 degrees. * houses will be in clockwise direction */ if (Math.Abs(fi) >= 90 - ekl) { /* within polar circle */ acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); hsp.mc = SE.swe_degnorm(hsp.mc + 180); for (i = 1; i <= 12; i++) hsp.cusp[i] = SE.swe_degnorm(hsp.cusp[i] + 180); } } break; case 'T': /* 'topocentric' houses */ fh1 = atand(tanfi / 3.0); fh2 = atand(tanfi * 2.0 / 3.0); hsp.cusp[11] = Asc1(30 + th, fh1, sine, cose); hsp.cusp[12] = Asc1(60 + th, fh2, sine, cose); hsp.cusp[2] = Asc1(120 + th, fh2, sine, cose); hsp.cusp[3] = Asc1(150 + th, fh1, sine, cose); /* within polar circle, when mc sinks below horizon and * ascendant changes to western hemisphere, all cusps * must be added 180 degrees. * houses will be in clockwise direction */ if (Math.Abs(fi) >= 90 - ekl) { /* within polar circle */ acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); hsp.mc = SE.swe_degnorm(hsp.mc + 180); for (i = 1; i <= 12; i++) hsp.cusp[i] = SE.swe_degnorm(hsp.cusp[i] + 180); } } break; case 'V': /* equal houses after Vehlow */ /* * within polar circle we swap AC/DC if AC is on wrong side */ acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); hsp.cusp[1] = hsp.ac; } hsp.cusp[1] = SE.swe_degnorm(hsp.ac - 15); for (i = 2; i <= 12; i++) hsp.cusp[i] = SE.swe_degnorm(hsp.cusp[1] + (i - 1) * 30); break; case 'W': /* equal, whole-sign houses */ /* * within polar circle we swap AC/DC if AC is on wrong side */ acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); hsp.cusp[1] = hsp.ac; } hsp.cusp[1] = hsp.ac - (hsp.ac % 30.0); for (i = 2; i <= 12; i++) hsp.cusp[i] = SE.swe_degnorm(hsp.cusp[1] + (i - 1) * 30); break; case 'X': { /* * Meridian or axial rotation system: * ecliptic points whose rectascensions * are armc + n * 30 */ int j; double a2 = th; for (i = 1; i <= 12; i++) { j = i + 10; if (j > 12) j -= 12; a2 = SE.swe_degnorm(a2 + 30); if (Math.Abs(a2 - 90) > VERY_SMALL && Math.Abs(a2 - 270) > VERY_SMALL) { tant = tand(a2); hsp.cusp[j] = atand(tant / cose); if (a2 > 90 && a2 <= 270) hsp.cusp[j] = SE.swe_degnorm(hsp.cusp[j] + 180); } else { if (Math.Abs(a2 - 90) <= VERY_SMALL) hsp.cusp[j] = 90; else hsp.cusp[j] = 270; } /* if */ hsp.cusp[j] = SE.swe_degnorm(hsp.cusp[j]); } acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); } break; } case 'M': { /* * Morinus * points of the equator (armc + n * 30) are transformed * into the ecliptic coordinate system */ int j; double a3 = th; double[] x3 = new double[3]; for (i = 1; i <= 12; i++) { j = i + 10; if (j > 12) j -= 12; a3 = SE.swe_degnorm(a3 + 30); x3[0] = a3; x3[1] = 0; SE.swe_cotrans(x3, x3, ekl); hsp.cusp[j] = x3[0]; } acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); } break; } case 'B': { /* Alcabitius */ /* created by Alois 17-sep-2000, followed example in Matrix electrical library. The code reproduces the example! See http://www.astro.com/cgi/adict.cgi query: alcabitius in the resuotl page, see program code example. I think the Alcabitius code in Walter Pullen's Astrolog 5.40 is wrong, because he remains in RA and forgets the transform to the ecliptic. */ double dek, r, sna, sda, sn3, sd3; #if FALSE if (Math.Abs(fi) >= 90 - ekl) { /* within polar circle */ retc = ERR; goto porphyry; } #endif acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); hsp.cusp[1] = hsp.ac; acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); } dek = asind(sind(hsp.ac) * sine); /* declination of Ascendant */ /* must treat the case fi == 90 or -90 */ r = -tanfi * tand(dek); /* must treat the case of abs(r) > 1; probably does not happen * because dek becomes smaller when fi is large, as ac is close to * zero Aries/Libra in that case. */ sda = Math.Acos(r) * SwissEph.RADTODEG; /* semidiurnal arc, measured on equator */ sna = 180 - sda; /* complement, seminocturnal arc */ sd3 = sda / 3; sn3 = sna / 3; rectasc = SE.swe_degnorm(th + sd3); /* cusp 11 */ /* project rectasc onto eclipitic with pole height 0, i.e. along the declination circle */ hsp.cusp[11] = Asc1(rectasc, 0, sine, cose); rectasc = SE.swe_degnorm(th + 2 * sd3); /* cusp 12 */ hsp.cusp[12] = Asc1(rectasc, 0, sine, cose); rectasc = SE.swe_degnorm(th + 180 - 2 * sn3); /* cusp 2 */ hsp.cusp[2] = Asc1(rectasc, 0, sine, cose); rectasc = SE.swe_degnorm(th + 180 - sn3); /* cusp 3 */ hsp.cusp[3] = Asc1(rectasc, 0, sine, cose); } break; case 'G': /* 36 Gauquelin sectors */ for (i = 1; i <= 36; i++) { hsp.cusp[i] = 0; } if (Math.Abs(fi) >= 90 - ekl) { /* within polar circle */ retc = SwissEph.ERR; goto porphyry; } /*************** forth/second quarter ***************/ /* note: Gauquelin sectors are counted in clockwise direction */ a = asind(tand(fi) * tane); for (ih = 2; ih <= 9; ih++) { ih2 = 10 - ih; fh1 = atand(sind(a * ih2 / 9) / tane); rectasc = SE.swe_degnorm((90 / 9) * ih2 + th); tant = tand(asind(sine * sind(Asc1(rectasc, fh1, sine, cose)))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[ih] = rectasc; } else { /* pole height */ f = atand(sind(asind(tanfi * tant) * ih2 / 9) / tant); hsp.cusp[ih] = Asc1(rectasc, f, sine, cose); for (i = 1; i <= iteration_count; i++) { tant = tand(asind(sine * sind(hsp.cusp[ih]))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[ih] = rectasc; break; } /* pole height */ f = atand(sind(asind(tanfi * tant) * ih2 / 9) / tant); hsp.cusp[ih] = Asc1(rectasc, f, sine, cose); } } hsp.cusp[ih + 18] = SE.swe_degnorm(hsp.cusp[ih] + 180); } /*************** first/third quarter ***************/ for (ih = 29; ih <= 36; ih++) { ih2 = ih - 28; fh1 = atand(sind(a * ih2 / 9) / tane); rectasc = SE.swe_degnorm(180 - ih2 * 90 / 9 + th); tant = tand(asind(sine * sind(Asc1(rectasc, fh1, sine, cose)))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[ih] = rectasc; } else { f = atand(sind(asind(tanfi * tant) * ih2 / 9) / tant); /* pole height */ hsp.cusp[ih] = Asc1(rectasc, f, sine, cose); for (i = 1; i <= iteration_count; i++) { tant = tand(asind(sine * sind(hsp.cusp[ih]))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[ih] = rectasc; break; } f = atand(sind(asind(tanfi * tant) * ih2 / 9) / tant); /* pole height */ hsp.cusp[ih] = Asc1(rectasc, f, sine, cose); } } hsp.cusp[ih - 18] = SE.swe_degnorm(hsp.cusp[ih] + 180); } hsp.cusp[1] = hsp.ac; hsp.cusp[10] = hsp.mc; hsp.cusp[19] = SE.swe_degnorm(hsp.ac + 180); hsp.cusp[28] = SE.swe_degnorm(hsp.mc + 180); break; case 'U': /* Krusinski-Pisa */ /* * The following code was written by Bogdan Krusinski in 2006. * [email protected] * * Definition: * "Krusinski - house system based on the great circle passing through * ascendant and zenith. This circle is divided into 12 equal parts * (1st cusp is ascendent, 10th cusp is zenith), then the resulting * points are projected onto the ecliptic through meridian circles. * The house cusps in space are half-circles perpendicular to the equator * and running from the north to the south celestial pole through the * resulting cusp points on the house circle. The points where they * cross the ecliptic mark the ecliptic house cusps." * * Description of the algorithm: * Transform into great circle running through Asc and zenit (where arc * between Asc and zenith is always 90 deg), and then return with * house cusps into ecliptic. Eg. solve trigonometrical triangle * with three transformations and two rotations starting from ecliptic. * House cusps in space are meridian circles. * * Notes: * 1. In this definition we assume MC on ecliptic as point where * half-meridian (from north to south pole) cuts ecliptic, * so MC may be below horizon in arctic regions. * 2. Houses could be calculated in all latitudes except the poles * themselves (-90,90) and points on arctic circle in cases where * ecliptic is equal to horizon and then ascendant is undefined. * But ascendant when 'horizon=ecliptic' could be deduced as limes * from both sides of that point and houses with that provision can * be computed also there. * * Starting values for calculations: * - Asc ecliptic longitude * - right ascension of MC (RAMC) * - geographic latitude. */ /* * within polar circle we swap AC/DC if AC is on wrong side */ acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); } /* A0. Start point - ecliptic coords of ascendant */ x[0] = hsp.ac; /* Asc longitude */ x[1] = 0.0; /* Asc declination */ x[2] = 1.0; /* Radius to test validity of subsequent transformations. */ SE.swe_cotrans(x, x, -ekl); /* A1. Transform into equatorial coords */ x[0] = x[0] - (th - 90); /* A2. Rotate */ SE.swe_cotrans(x, x, -(90 - fi)); /* A3. Transform into horizontal coords */ krHorizonLon = x[0]; /* ...save asc lon on horizon to get back later with house cusp */ x[0] = x[0] - x[0]; /* A4. Rotate */ SE.swe_cotrans(x, x, -90); /* A5. Transform into this house system great circle (asc-zenith) */ /* As it is house circle now, simple add 30 deg increments... */ for (i = 0; i < 6; i++) { /* B0. Set 'n-th' house cusp. * Note that IC/MC are also calculated here to check * if really this is the asc-zenith great circle. */ x[0] = 30.0 * i; x[1] = 0.0; SE.swe_cotrans(x, x, 90); /* B1. Transform back into horizontal coords */ x[0] = x[0] + krHorizonLon; /* B2. Rotate back. */ SE.swe_cotrans(x, x, 90 - fi); /* B3. Transform back into equatorial coords */ x[0] = SE.swe_degnorm(x[0] + (th - 90)); /* B4. Rotate back -> RA of house cusp as result. */ /* B5. Where's this house cusp on ecliptic? */ /* ... so last but not least - get ecliptic longitude of house cusp: */ hsp.cusp[i + 1] = atand(tand(x[0]) / cosd(ekl)); if (x[0] > 90 && x[0] <= 270) hsp.cusp[i + 1] = SE.swe_degnorm(hsp.cusp[i + 1] + 180); hsp.cusp[i + 1] = SE.swe_degnorm(hsp.cusp[i + 1]); hsp.cusp[i + 7] = SE.swe_degnorm(hsp.cusp[i + 1] + 180); } break; case 'Y': /* APC houses */ for (i = 1; i <= 12; i++) { hsp.cusp[i] = apc_sector(i, fi * SwissEph.DEGTORAD, ekl * SwissEph.DEGTORAD, th * SwissEph.DEGTORAD); } hsp.ac = hsp.cusp[1]; hsp.mc = hsp.cusp[10]; /* within polar circle, when mc sinks below horizon and * ascendant changes to western hemisphere, all cusps * must be added 180 degrees. * houses will be in clockwise direction */ if (Math.Abs(fi) >= 90 - ekl) { /* within polar circle */ acmc = SE.swe_difdeg2n(hsp.ac, hsp.mc); if (acmc < 0) { hsp.ac = SE.swe_degnorm(hsp.ac + 180); hsp.mc = SE.swe_degnorm(hsp.mc + 180); for (i = 1; i <= 12; i++) hsp.cusp[i] = SE.swe_degnorm(hsp.cusp[i] + 180); } } break; default: /* Placidus houses */ //#ifndef _WINDOWS //if (hsy != 'P') // fprintf (stderr, "swe_houses: make Placidus, unknown key %c\n", hsy); //#endif if (Math.Abs(fi) >= 90 - ekl) { /* within polar circle */ retc = SwissEph.ERR; goto porphyry; } a = asind(tand(fi) * tane); fh1 = atand(sind(a / 3) / tane); fh2 = atand(sind(a * 2 / 3) / tane); /* ************ house 11 ******************** */ rectasc = SE.swe_degnorm(30 + th); tant = tand(asind(sine * sind(Asc1(rectasc, fh1, sine, cose)))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[11] = rectasc; } else { /* pole height */ f = atand(sind(asind(tanfi * tant) / 3) / tant); hsp.cusp[11] = Asc1(rectasc, f, sine, cose); for (i = 1; i <= iteration_count; i++) { tant = tand(asind(sine * sind(hsp.cusp[11]))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[11] = rectasc; break; } /* pole height */ f = atand(sind(asind(tanfi * tant) / 3) / tant); hsp.cusp[11] = Asc1(rectasc, f, sine, cose); } } /* ************ house 12 ******************** */ rectasc = SE.swe_degnorm(60 + th); tant = tand(asind(sine * sind(Asc1(rectasc, fh2, sine, cose)))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[12] = rectasc; } else { f = atand(sind(asind(tanfi * tant) / 1.5) / tant); /* pole height */ hsp.cusp[12] = Asc1(rectasc, f, sine, cose); for (i = 1; i <= iteration_count; i++) { tant = tand(asind(sine * sind(hsp.cusp[12]))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[12] = rectasc; break; } f = atand(sind(asind(tanfi * tant) / 1.5) / tant); /* pole height */ hsp.cusp[12] = Asc1(rectasc, f, sine, cose); } } /* ************ house 2 ******************** */ rectasc = SE.swe_degnorm(120 + th); tant = tand(asind(sine * sind(Asc1(rectasc, fh2, sine, cose)))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[2] = rectasc; } else { f = atand(sind(asind(tanfi * tant) / 1.5) / tant); /* pole height */ hsp.cusp[2] = Asc1(rectasc, f, sine, cose); for (i = 1; i <= iteration_count; i++) { tant = tand(asind(sine * sind(hsp.cusp[2]))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[2] = rectasc; break; } f = atand(sind(asind(tanfi * tant) / 1.5) / tant); /* pole height */ hsp.cusp[2] = Asc1(rectasc, f, sine, cose); } } /* ************ house 3 ******************** */ rectasc = SE.swe_degnorm(150 + th); tant = tand(asind(sine * sind(Asc1(rectasc, fh1, sine, cose)))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[3] = rectasc; } else { f = atand(sind(asind(tanfi * tant) / 3) / tant); /* pole height */ hsp.cusp[3] = Asc1(rectasc, f, sine, cose); for (i = 1; i <= iteration_count; i++) { tant = tand(asind(sine * sind(hsp.cusp[3]))); if (Math.Abs(tant) < VERY_SMALL) { hsp.cusp[3] = rectasc; break; } f = atand(sind(asind(tanfi * tant) / 3) / tant); /* pole height */ hsp.cusp[3] = Asc1(rectasc, f, sine, cose); } } break; } /* end switch */ if (hsy != 'G' && hsy != 'Y') { hsp.cusp[4] = SE.swe_degnorm(hsp.cusp[10] + 180); hsp.cusp[5] = SE.swe_degnorm(hsp.cusp[11] + 180); hsp.cusp[6] = SE.swe_degnorm(hsp.cusp[12] + 180); hsp.cusp[7] = SE.swe_degnorm(hsp.cusp[1] + 180); hsp.cusp[8] = SE.swe_degnorm(hsp.cusp[2] + 180); hsp.cusp[9] = SE.swe_degnorm(hsp.cusp[3] + 180); } /* vertex */ if (fi >= 0) f = 90 - fi; else f = -90 - fi; hsp.vertex = Asc1(th - 90, f, sine, cose); /* with tropical latitudes, the vertex behaves strange, * in a similar way as the ascendant within the polar * circle. we keep it always on the western hemisphere.*/ if (Math.Abs(fi) <= ekl) { vemc = SE.swe_difdeg2n(hsp.vertex, hsp.mc); if (vemc > 0) hsp.vertex = SE.swe_degnorm(hsp.vertex + 180); } /* * some strange points: */ /* equasc (equatorial ascendant) */ th2 = SE.swe_degnorm(th + 90); if (Math.Abs(th2 - 90) > VERY_SMALL && Math.Abs(th2 - 270) > VERY_SMALL) { tant = tand(th2); hsp.equasc = atand(tant / cose); if (th2 > 90 && th2 <= 270) hsp.equasc = SE.swe_degnorm(hsp.equasc + 180); } else { if (Math.Abs(th2 - 90) <= VERY_SMALL) hsp.equasc = 90; else hsp.equasc = 270; } /* if */ hsp.equasc = SE.swe_degnorm(hsp.equasc); /* "co-ascendant" W. Koch */ hsp.coasc1 = SE.swe_degnorm(Asc1(th - 90, fi, sine, cose) + 180); /* "co-ascendant" M. Munkasey */ if (fi >= 0) hsp.coasc2 = Asc1(th + 90, 90 - fi, sine, cose); else /* southern hemisphere */ hsp.coasc2 = Asc1(th + 90, -90 - fi, sine, cose); /* "polar ascendant" M. Munkasey */ hsp.polasc = Asc1(th - 90, fi, sine, cose); return retc; }
/* * this function is required for very special computations * where no date is given for house calculation, * e.g. for composite charts or progressive charts. * cusps are returned in double cusp[13], * or cusp[37] with house system 'G'. * cusp[1...12] houses 1 - 12 * additional points are returned in ascmc[10]. * ascmc[0] = ascendant * ascmc[1] = mc * ascmc[2] = armc * ascmc[3] = vertex * ascmc[4] = equasc * "equatorial ascendant" * * ascmc[5] = coasc1 * "co-ascendant" (W. Koch) * * ascmc[6] = coasc2 * "co-ascendant" (M. Munkasey) * * ascmc[7] = polasc * "polar ascendant" (M. Munkasey) * */ public int swe_houses_armc( double armc, double geolat, double eps, char hsys, CPointer<double> cusp, CPointer<double> ascmc) { houses h = new houses(); int i, retc = 0; int ito; if (char.ToUpper(hsys) == 'G') ito = 36; else ito = 12; armc = SE.swe_degnorm(armc); retc = CalcH(armc, geolat, eps, (char)hsys, 2, h); cusp[0] = 0; for (i = 1; i <= ito; i++) { cusp[i] = h.cusp[i]; } ascmc[0] = h.ac; /* Asc */ ascmc[1] = h.mc; /* Mid */ ascmc[2] = armc; ascmc[3] = h.vertex; ascmc[4] = h.equasc; ascmc[5] = h.coasc1; /* "co-ascendant" (W. Koch) */ ascmc[6] = h.coasc2; /* "co-ascendant" (M. Munkasey) */ ascmc[7] = h.polasc; /* "polar ascendant" (M. Munkasey) */ for (i = SwissEph.SE_NASCMC; i < 10; i++) ascmc[i] = 0; #if TRACE //swi_open_trace(NULL); //if (swi_trace_count <= TRACE_COUNT_MAX) { // if (swi_fp_trace_c != NULL) { // fputs("\n/*SWE_HOUSES_ARMC*/\n", swi_fp_trace_c); // fprintf(swi_fp_trace_c, " armc = %.9f;", armc); // fprintf(swi_fp_trace_c, " geolat = %.9f;", geolat); // fprintf(swi_fp_trace_c, " eps = %.9f;", eps); // fprintf(swi_fp_trace_c, " hsys = %d;\n", hsys); // fprintf(swi_fp_trace_c, " retc = swe_houses_armc(armc, geolat, eps, hsys, cusp, ascmc);\n"); // fputs(" printf(\"swe_houses_armc: %f\\t%f\\t%f\\t%c\\t\\n\", ", swi_fp_trace_c); // fputs(" armc, geolat, eps, hsys);\n", swi_fp_trace_c); // fputs(" printf(\"retc = %d\\n\", retc);\n", swi_fp_trace_c); // fputs(" printf(\"cusp:\\n\");\n", swi_fp_trace_c); // fputs(" for (i = 0; i < 12; i++)\n", swi_fp_trace_c); // fputs(" printf(\" %d\\t%f\\n\", i, cusp[i]);\n", swi_fp_trace_c); // fputs(" printf(\"ascmc:\\n\");\n", swi_fp_trace_c); // fputs(" for (i = 0; i < 10; i++)\n", swi_fp_trace_c); // fputs(" printf(\" %d\\t%f\\n\", i, ascmc[i]);\n", swi_fp_trace_c); // fflush(swi_fp_trace_c); // } // if (swi_fp_trace_out != NULL) { trace("swe_houses_armc: %f\t%f\t%f\t%c\t\n", armc, geolat, eps, hsys); trace("retc = %d\n", retc); trace("cusp:\n"); for (i = 0; i < 12; i++) trace(" %d\t%f\n", i, cusp[i]); trace("ascmc:\n"); for (i = 0; i < 10; i++) trace(" %d\t%f\n", i, ascmc[i]); // fflush(swi_fp_trace_out); // } //} #endif //#if 0 ///* for test of swe_house_pos(). // * 1st house will be 0, second 30, etc. */ //for (i = 1; i <=12; i++) { // double x[6]; // x[0] = cusp[i]; x[1] = 0; x[2] = 1; // cusp[i] = (swe_house_pos(armc, geolat, eps, hsys, x, NULL) - 1) * 30; //} //#endif return retc; }
int decideToPrice(houses house) { int price = 0; if (house.houseType == 1) { /*1= bahçe 2= teras 3= havuz */ foreach (int i in house.ekoz) { if (i == 1) { price += 10000; } if (i == 3) { price += 30000; } if (i == 2) { price += 100000; } } if (house.roomNumber != 3) { price += Random.Range(50000, 450001); if (house.roomNumber == 7) { price += 100000; } else if (house.roomNumber == 6) { price += 70000; } else if (house.roomNumber == 5) { price += 50000; } else if (house.roomNumber == 4) { price += 10000; } } else { price += Random.Range(50000, 250001); } } else if (house.houseType == 2) { /*1= bahçe 2= teras 3= havuz */ foreach (int i in house.ekoz) { if (i == 1) { price += 100000; } if (i == 3) { price += 50000; } if (i == 2) { price += 100000; } } if (house.roomNumber == 2) { price += 50000; } else if (house.roomNumber == 3) { price += Random.Range(50000, 200001); } else if (house.roomNumber == 4) { price += Random.Range(50000, 750001); } else if (house.roomNumber == 5) { price += Random.Range(50000, 750001); price += 300000; } else if (house.roomNumber == 6) { price += Random.Range(50000, 750001); price += 600000; } } else if (house.houseType == 4) { /*1= bahçe 2= teras 3= havuz */ foreach (int i in house.ekoz) { if (i == 1) { price += 300000; } if (i == 3) { price += 500000; } if (i == 2) { price += 400000; } } if (house.roomNumber == 3) { price += Random.Range(500000, 1500001); } else if (house.roomNumber == 4) { price += Random.Range(500000, 4500001); } else if (house.roomNumber == 5) { price += Random.Range(500000, 4500001); price += 300000; } else if (house.roomNumber == 6) { price += Random.Range(500000, 4500001); price += 500000; } else if (house.roomNumber == 7) { price += Random.Range(50000, 750001); price += 800000; } } else if (house.houseType == 3) { /*1= bahçe 2= teras 3= havuz */ foreach (int i in house.ekoz) { if (i == 1) { price += 100000; } if (i == 3) { price += 400000; } if (i == 2) { price += 300000; } } if (house.roomNumber == 2) { price += Random.Range(200000, 300001); } else if (house.roomNumber == 3) { price += Random.Range(200000, 600001); } else if (house.roomNumber == 4) { price += Random.Range(200000, 1300001); } else if (house.roomNumber == 5) { price += Random.Range(200000, 1300001); price += 100000; } else if (house.roomNumber == 6) { price += Random.Range(200000, 1300001); price += 400000; } } price -= price % 1000; return(price); }
public void AddHouse(houses h) { allHouses.Add(h); }