/* Returns the winner of this run conflict. */ public Player RunConflictWinner(RunConflict conflict) { Player strongestPlayer = null; double bestConflictStrength = 0; Random rnd = new Random(); foreach (Player involvedPlayer in conflict.InvolvedPlayers) { double tmpConflictStrength = involvedPlayer.ConflictStrength(conflict.ConflictType); if (strongestPlayer == null || tmpConflictStrength > bestConflictStrength) { bestConflictStrength = tmpConflictStrength; strongestPlayer = involvedPlayer; } } return strongestPlayer; }
/* Returns an empty conflict if there is no conflict with this conflict-point. */ private RunConflict SearchRunConflict(List<RunConflict> conflicts, Point point) { foreach (RunConflict conflict in conflicts) { if (conflict.ConflictPoint.Equals(point)) { return conflict; } } RunConflict emptyConflict = new RunConflict(point); conflicts.Add(emptyConflict); return emptyConflict; }