# CodeStepByStep

## GameOfFlights2

Write a method named `GameOfFlights2` (similar to the previous exercise, `gameOfFlights`) that uses a line-of-sight system of evaluating neighboring seats rather than direct neighbors. Instead of considering just the eight immediately adjacent seats, consider the first seat found when looking in each of those eight directions. For example, the empty seat below (`L`) would see eight occupied seats if you drew lines up, down, left, right, and diagonally:

```.......#.
...#.....
.#.......
.........
..#L....#
....#....
.........
#........
...#.....
```

In the following example, the leftmost empty seat below would see only one empty seat, but cannot see any of the occupied ones:

```.............
.L.L.#.#.#.#.
.............
```

The empty seat below would see no occupied seats:

```.##.##.
#.#.#.#
##...##
...L...
##...##
#.#.#.#
.##.##.
```

Also, the threshold for occupied seats (`#`) to become unoccupied (`L`) in the next generation should change from 4 to 5. The other rules still apply: empty seats that see no occupied seats become occupied, seats matching no rule don't change, and floor never changes.

Given the same starting layout as above, these new rules cause the seating area to shift around as follows:

```L.LL.LL.LL
LLLLLLL.LL
L.L.L..L..
LLLL.LL.LL
L.LL.LL.LL
L.LLLLL.LL
..L.L.....
LLLLLLLLLL
L.LLLLLL.L
L.LLLLL.LL
```
```#.##.##.##
#######.##
#.#.#..#..
####.##.##
#.##.##.##
#.#####.##
..#.#.....
##########
#.######.#
#.#####.##
```
```#.LL.LL.L#
#LLLLLL.LL
L.L.L..L..
LLLL.LL.LL
L.LL.LL.LL
L.LLLLL.LL
..L.L.....
LLLLLLLLL#
#.LLLLLL.L
#.LLLLL.L#
```
```#.L#.##.L#
#L#####.LL
L.#.#..#..
##L#.##.##
#.##.#L.##
#.#####.#L
..#.#.....
LLL####LL#
#.L#####.L
#.L####.L#
```
```#.L#.L#.L#
#LLLLLL.LL
L.L.L..#..
##LL.LL.L#
L.LL.LL.L#
#.LLLLL.LL
..L.L.....
LLLLLLLLL#
#.LLLLL#.L
#.L#LL#.L#
```
```#.L#.L#.L#
#LLLLLL.LL
L.L.L..#..
##L#.#L.L#
L.L#.#L.L#
#.L####.LL
..#.#.....
LLL###LLL#
#.LLLLL#.L
#.L#LL#.L#
```
```#.L#.L#.L#
#LLLLLL.LL
L.L.L..#..
##L#.#L.L#
L.L#.LL.L#
#.LLLL#.LL
..#.L.....
LLL###LLL#
#.LLLLL#.L
#.L#LL#.L#
```

At this point, the seating arrangement stabilizes and no seats change state on any further iterations. At this point there are 26 occupied seats. So the call of `GameOfFlights2("seats.txt")` should return `26`.

(This exercise is based on the Advent of Code 2020, day 11.)

Method: Write a C# method as described, not a complete program or class.