Example #1
0
        public string Process2()
        {
            var previous = new SeatLayout(ToString());

            foreach (var seat in _seats.Values)
            {
                if (seat.Status == SeatStatus.Floor)
                {
                    continue;
                }

                var seen = previous.SeenFrom(seat.Row, seat.Column);

                if (seat.Status == SeatStatus.Occupied && seen.X >= 5)
                {
                    seat.Status = SeatStatus.Empty;
                }
                else if (seat.Status == SeatStatus.Empty && seen.X == 0)
                {
                    seat.Status = SeatStatus.Occupied;
                }
            }

            return(ToString());
        }