public void GetThisPartyStarted(int numberofElves) { var firstElf = new Elf(1, 1, null, null); var elf = firstElf; for (var i = 2; i < numberofElves + 1; i++) { var nextElf = new Elf(i, 1, null, elf); elf.Next = nextElf; elf = nextElf; } elf.Next = firstElf; firstElf.Previous = elf; Target = firstElf.Next; CurrentPlayer = firstElf; }
public void GetThisPartyStarted(int numberofElves) { var firstElf = new Elf(1, 1, null, null); var elf = firstElf; var targetIndex = GetTargetId(numberofElves, firstElf.Id); for (var i = 2; i < numberofElves + 1; i++) { var nextElf = new Elf(i, 1, null, elf); elf.Next = nextElf; elf = nextElf; if (targetIndex == i) { Target = elf; } } Participants = numberofElves; elf.Next = firstElf; firstElf.Previous = elf; CurrentPlayer = firstElf; }
public void TakePresents(Elf target) { NumberOfPresents += target.NumberOfPresents; target.NumberOfPresents = 0; }