using static System.Linq.Enumerable;
public static void Main() {
Matrix m1 = new(4,4); m1.SetMine(new(1,1));
Matrix m2 = new(4,4); m2.SetMine(new(1,1));
Matrix xx = new(4,4); xx.SetMine(new(2, 2));
public record struct Cell(char Value);
public record Coordinate (int X, int Y);
public Matrix(int x, int y) {
_matrix = new Cell[x, y];
_matrix[m, n] = new('.');
public void SetMine(Coordinate c)
=> _matrix[c.X, c.Y] = new('*');
private string CellsAsString()
=> string.Concat(_matrix.OfType<Cell>().Select(c => c.Value));
public override bool Equals(object other)
=> this.CellsAsString().Equals((other as Matrix)?.CellsAsString());
public override int GetHashCode()
=> this.CellsAsString().GetHashCode();