public void Next(string bunnyName)
        {
            if (!this.bunniesByName.ContainsKey(bunnyName))
            {
                throw new ArgumentException("Bunny does not exist");
            }

            var bunny     = this.bunniesByName[bunnyName];
            var roomIndex = roomsById.IndexOf(bunny.RoomId);

            this.MoveBunnyToRoom(bunny, roomIndex, roomIndex + 1);
        }
        public void HandleEvent(Event CurrentPoint, List <Line> lines, List <Line> lines2)
        {
            if (CurrentPoint.type == "s")
            {
                Event CurrentPointL = new Event(null, null, CurrentPoint.LineIndex, 0, lines[CurrentPoint.LineIndex], null);

                L.Add(CurrentPointL);
                Event tmp1 = L[0];

                KeyValuePair <Event, Event> UpAndDown = L.DirectUpperAndLower(CurrentPointL);

                Point point;
                //upper with point
                if (UpAndDown.Key != null)
                {
                    point = CheckIntersection(lines2[UpAndDown.Key.LineIndex], lines2[CurrentPoint.LineIndex]);
                    if (point != null)
                    {
                        output.Add(point);
                        E.Add(new Event(point, "i", CurrentPoint.LineIndex, UpAndDown.Key.LineIndex, lines[CurrentPoint.LineIndex], lines[UpAndDown.Key.LineIndex]));
                    }
                }
                //lower with point

                if (UpAndDown.Value != null)
                {
                    point = CheckIntersection(lines2[UpAndDown.Value.LineIndex], lines2[CurrentPoint.LineIndex]);
                    if (point != null)
                    {
                        output.Add(point);
                        E.Add(new Event(point, "i", CurrentPoint.LineIndex, UpAndDown.Value.LineIndex, lines[CurrentPoint.LineIndex], lines[UpAndDown.Value.LineIndex]));
                    }
                }
            }
            else if (CurrentPoint.type == "e")
            {
                Event CurrentPointL = new Event(null, null, CurrentPoint.LineIndex, 0, lines[CurrentPoint.LineIndex], null);

                KeyValuePair <Event, Event> UpAndDown = L.DirectUpperAndLower(CurrentPointL);

                if (UpAndDown.Key != null && UpAndDown.Value != null)
                {
                    Point point = CheckIntersection(lines2[UpAndDown.Key.LineIndex], lines2[UpAndDown.Value.LineIndex]);
                    if (point != null)
                    {
                        output.Add(point);
                        E.Add(new Event(point, "i", UpAndDown.Value.LineIndex, UpAndDown.Key.LineIndex, lines[UpAndDown.Value.LineIndex], lines[UpAndDown.Key.LineIndex]));
                    }
                }
                L.Remove(CurrentPointL);
            }
            else
            {
                Line s1 = lines[CurrentPoint.LineIndex];
                Line s2 = lines[CurrentPoint.OtherIndex];

                int indexS1 = L.IndexOf(new Event(null, null, CurrentPoint.LineIndex, 0, lines[CurrentPoint.LineIndex], null));
                int indexS2 = L.IndexOf(new Event(null, null, CurrentPoint.OtherIndex, 0, lines[CurrentPoint.OtherIndex], null));

                if (indexS1 > indexS2)
                {
                    Line tmp = s2;
                    s2 = s1;
                    s1 = tmp;

                    int tmpi = CurrentPoint.LineIndex;
                    CurrentPoint.LineIndex  = CurrentPoint.OtherIndex;
                    CurrentPoint.OtherIndex = tmpi;
                }

                KeyValuePair <Event, Event> UpAndDownS1 = L.DirectUpperAndLower(new Event(null, null, CurrentPoint.LineIndex, 0, s1, null));
                KeyValuePair <Event, Event> UpAndDownS2 = L.DirectUpperAndLower(new Event(null, null, CurrentPoint.OtherIndex, 0, s2, null));
                //s1 with upper of s2
                if (UpAndDownS2.Key != null)
                {
                    Point point1 = CheckIntersection(lines2[CurrentPoint.LineIndex], lines2[UpAndDownS2.Key.LineIndex]);
                    if (point1 != null)
                    {
                        output.Add(point1);
                        E.Add(new Event(point1, "i", CurrentPoint.LineIndex, UpAndDownS2.Key.LineIndex, s1, lines[UpAndDownS2.Key.LineIndex]));
                    }
                }

                //s2 with lower s1
                if (UpAndDownS1.Value != null)
                {
                    Point point2 = CheckIntersection(lines2[CurrentPoint.OtherIndex], lines2[UpAndDownS1.Value.LineIndex]);
                    if (point2 != null)
                    {
                        output.Add(point2);
                        E.Add(new Event(point2, "i", CurrentPoint.OtherIndex, UpAndDownS1.Value.LineIndex, s2, lines[UpAndDownS1.Value.LineIndex]));
                    }
                }
                //swap
                L.Remove(new Event(null, null, CurrentPoint.LineIndex, 0, s1, null));
                L.Remove(new Event(null, null, CurrentPoint.OtherIndex, 0, s2, null));

                L.Add(new Event(null, null, CurrentPoint.LineIndex, 0, new Line(CurrentPoint.point, s1.End), null));
                L.Add(new Event(null, null, CurrentPoint.OtherIndex, 0, new Line(CurrentPoint.point, s2.End), null));
                lines[CurrentPoint.LineIndex].Start  = CurrentPoint.point;
                lines[CurrentPoint.OtherIndex].Start = CurrentPoint.point;
            }
        }