public void PartOne() { while (true) { //_seats.Print(); //Console.WriteLine(); //Console.ReadKey(); var next = ApplyModel(); if (next.Equals(_seats)) { break; } _seats = next; } int cnt = 0; for (int x = 0; x < _seats.Cols(); x++) { for (int y = 0; y < _seats.Rows(); y++) { if (_seats.Get(x, y) == _occupied) { cnt++; } } } Console.WriteLine(cnt); }
char CurrentState(int x, int y) { if (x < 0 || y < 0 || x >= _seats.Cols() || y >= _seats.Rows()) { return(_boundary); } return(_seats.Get(x, y)); }