Example #1
0
		/**
	 * Asses the patients in the village.
	 *
	 * @param v the village that owns the hospital
	 */
		public List<Patient> checkPatientsAssess (Village v)
		{
			double rand;
			bool stayhere;
			List<Patient> up = new List<Patient> ();

			int i = 0;
			while (i < this.assess.Count) {
				Patient p = this.assess [i];
				p.timeLeft = p.timeLeft - 1;
				if (p.timeLeft == 0) {
					//inline stays here
					rand = Village.myRand (v.seed);
					v.seed = (int)(rand * Village.IM);
					stayhere = (rand > 0.1 || v.rootVillage);

					this.assess.RemoveAt (i);
					if (stayhere) {
						inside.Add (p);
						p.timeLeft = 10;
						p.time = p.timeLeft + 10;
					} else {
						freePersonnel = freePersonnel + 1;
						up.Add (p);
					}
				} else
					++i;
			}
			return up;
		}
Example #2
0
		/**
	 * Create a set of villages.  Villages are represented as a quad tree.
	 * Each village contains references to four other villages.  Users
	 * specify the number of levels.
	 *
	 * @param level the number of level of villages.
	 * @param label a unique label for the village
	 * @param back  a link to the "parent" village
	 * @param seed  the user supplied seed value.
	 * @return the village that was created
	 */
		public static Village createVillage (int level, int label, bool isRootV, int seed)
		{
			if (level == 0)
				return null;
			else {
				Village village = new Village (level, label, isRootV, seed);
				for (int i = 3; i >= 0; i--) {
					Village child = createVillage (level - 1, (label * 4) + i + 1, false, seed);
					village.forward [i] = child;
				}
				return village;
			}
		}