| | 1 | | namespace FpMineSweeper |
| | 2 | | { |
| | 3 | | public static partial class Prelude |
| | 4 | | { |
| 3 | 5 | | public static string str(Cell cell) => cell switch |
| 3 | 6 | | { |
| 4 | 7 | | { IsCovered: true } => ".", |
| 4 | 8 | | { IsBomb: true } => "*", |
| 4 | 9 | | var x => x.NearBombsCount.ToString() |
| 3 | 10 | | }; |
| | 11 | |
|
| | 12 | | public static Cell cell(bool isBomb, int nearBombsCount = 0, bool isCovered = true) => |
| 6 | 13 | | new Cell(0, 0, isBomb, nearBombsCount, isCovered); |
| | 14 | | public static Cell cell((int X, int Y) pos, bool isBomb, int nearBombsCount = 0, bool isCovered = true) => |
| 18 | 15 | | new Cell(pos.X, pos.Y, isBomb, nearBombsCount, isCovered); |
| | 16 | |
|
| | 17 | | public static MineFieldInit mineField(int width, int height) => |
| 3 | 18 | | new MineFieldInit(width, height); |
| | 19 | | } |
| | 20 | | } |