Token.cs 480 B

12345678910111213141516171819202122232425
  1. namespace Day3;
  2. public record Point2D(int X, int Y)
  3. {
  4. public IEnumerable<Point2D> SurroundingAndSelf()
  5. {
  6. for (var y = -1; y < 2; y++)
  7. {
  8. for (var x = -1; x < 2; x++)
  9. {
  10. yield return new Point2D(X + x, Y + y);
  11. }
  12. }
  13. }
  14. }
  15. public abstract class Token
  16. {
  17. public Point2D Position { get; }
  18. protected Token(Point2D position)
  19. {
  20. Position = position;
  21. }
  22. }