static Elf NextElfInLine(Elf elf) { var outElves = elves.Where(e => e.Value.NumPresents > 0 && e.Key > elf.Id).OrderBy(e => e.Key); if (outElves.Any()) { return(outElves.First().Value); } else { outElves = elves.Where(e => e.Value.NumPresents > 0 && e.Key < elf.Id).OrderBy(e => e.Key); } if (outElves.Any()) { return(outElves.First().Value); } return(null); }
public void StealPresents(Elf elf) { this.NumPresents += elf.NumPresents; elf.NumPresents = 0; }