/// <summary> /// Take a specific block /// - If the given worm is null, this will end up in take nothing /// The method excepts a block that is free to take, else this will end up in an exception /// And go one with the rest of the game /// </summary> /// <returns></returns> public void TakeRainyWorm(RainyWorm worm) { if (worm == null) { TakeNothing(); return; } if (!CanTakeRainyWorm(worm)) { throw new InvalidOperationException("You can not take worm " + worm); } if (_wormsToTake.Contains(worm)) { // taking a worm from the untaken stack _wormsToTake.Remove(worm); CurrentPlayer.AddWorm(worm); } else { // stealing worm of other player var player = _players.First(p => p.TopWorm == worm); CurrentPlayer.AddWorm(player.TakeTopWorm()); } Next(); }