|
|
|
@ -2,6 +2,9 @@
|
|
|
|
|
|
|
|
|
|
public class Cell : Position, IEquatable<Cell>
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The value of the cell.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private int? _value;
|
|
|
|
|
public int? Value {
|
|
|
|
|
get => _value;
|
|
|
|
@ -15,18 +18,39 @@ public class Cell : Position, IEquatable<Cell>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The fact that the cell is dangerous or not.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private bool IsDangerous { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Atribute to know if the cell is a penalty cell.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private bool Penalty { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Constructor of the Cell class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="x">the x position</param>
|
|
|
|
|
/// <param name="y">the y position</param>
|
|
|
|
|
/// <param name="isDangerous">if the cell is a dangerous cell or not</param>
|
|
|
|
|
public Cell(int x, int y,bool isDangerous = false):base(x,y)
|
|
|
|
|
{
|
|
|
|
|
IsDangerous = isDangerous;
|
|
|
|
|
Penalty = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Function in order to return the fact that the cell is dangerous or not.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>If the cell is dangerous or not</returns>
|
|
|
|
|
public bool GetCellType() => IsDangerous;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Redefine the equal operation between cells.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="obj">The object to compare with the current cell.</param>
|
|
|
|
|
/// <returns>true if the specified object is equal to the current cell; otherwise, false.</returns>
|
|
|
|
|
public bool Equals(Cell? other)
|
|
|
|
|
{
|
|
|
|
|
if (other == null) return false;
|
|
|
|
|