diff --git a/67_One_Check/csharp/Board.cs b/67_One_Check/csharp/Board.cs new file mode 100644 index 00000000..213a54d7 --- /dev/null +++ b/67_One_Check/csharp/Board.cs @@ -0,0 +1,18 @@ +namespace OneCheck; + +internal class Board +{ + private readonly int[][] _checkers; + + public Board() + { + _checkers = + Enumerable.Range(0, 8) + .Select(r => Enumerable.Range(0, 8) + .Select(c => r > 1 && r < 6 && c > 1 && c < 6 ? 0 : 1).ToArray()) + .ToArray(); + } + + public override string ToString() => + string.Join(Environment.NewLine, _checkers.Select(r => string.Join(" ", r.Select(c => $" {c}")))); +} \ No newline at end of file diff --git a/67_One_Check/csharp/Game.cs b/67_One_Check/csharp/Game.cs new file mode 100644 index 00000000..924fc04c --- /dev/null +++ b/67_One_Check/csharp/Game.cs @@ -0,0 +1,20 @@ +namespace OneCheck; + +internal class Game +{ + private readonly IReadWrite _io; + private readonly Board _board; + + public Game(IReadWrite io) + { + _io = io; + _board = new Board(); + } + + public void Play() + { + _io.Write(Streams.Introduction); + + _io.WriteLine(_board); + } +} diff --git a/67_One_Check/csharp/Program.cs b/67_One_Check/csharp/Program.cs new file mode 100644 index 00000000..4a3ab83b --- /dev/null +++ b/67_One_Check/csharp/Program.cs @@ -0,0 +1,5 @@ +global using Games.Common.IO; +global using static OneCheck.Resources.Resource; +using OneCheck; + +new Game(new ConsoleIO()).Play(); diff --git a/67_One_Check/csharp/Resources/Introduction.txt b/67_One_Check/csharp/Resources/Introduction.txt index bc891a6e..409f6b37 100644 --- a/67_One_Check/csharp/Resources/Introduction.txt +++ b/67_One_Check/csharp/Resources/Introduction.txt @@ -17,13 +17,14 @@ question 'Jump from ?' Here is the numerical board: -1 2 3 4 5 6 7 8 -9 10 11 12 13 14 15 16 -17 18 19 20 21 22 23 24 -25 26 27 28 29 30 31 32 -33 34 35 36 37 38 39 40 -41 42 43 44 45 46 47 48 -49 50 51 52 53 54 55 56 -57 58 59 60 61 62 63 64 + 1 2 3 4 5 6 7 8 + 9 10 11 12 13 14 15 16 + 17 18 19 20 21 22 23 24 + 25 26 27 28 29 30 31 32 + 33 34 35 36 37 38 39 40 + 41 42 43 44 45 46 47 48 + 49 50 51 52 53 54 55 56 + 57 58 59 60 61 62 63 64 And here is the opening position of the checkers. +