public void first_cry() { if (time == 1) { // was just born, figure out time and directions: // find time: if (audibleHillMessage != null) { if (audibleHillMessage.content < 0) { initialTime = audibleHillMessage.content - HillAI.initTime; } } if (initialTime < 5) { // in the beginning, figure out direction: int count = 0; int total = 0; for (Ant a : visibleFriends()) { if (a.caste == Caste.Gatherer) { total++; if (a.id < self.id) count++; } } dir = (360 * count) / (total + 1); moveInDirection(dir); } else { // later, just go some random direction: dir = SeededRandomizer.nextDouble() * 360; } // initialize hills: for (int i = 0; i < HillAI.NR_HILLS; ++i) { hills.add(new LinkedList<Snapshot>()); indices[i] = 0; } // add my hill: for (Hill h : visibleHills) { if (h.playerID == self.playerID) { hills.get(HillAI.HILL_IND).add(visibleHills.get(0)); } } nr_hill = 0; } }