From bfc2c27188da820cdf88b3017ca7b9bd19f7486c Mon Sep 17 00:00:00 2001 From: Nikita Goltsev Date: Wed, 10 Jul 2024 16:08:05 +0300 Subject: [PATCH] CortUpdate --- ConsoleGame/CortClass.cs | 21 ++++++++++----- ConsoleGame/Program.cs | 26 ++++++++++++++++--- .../Debug/net8.0/ConsoleGame.AssemblyInfo.cs | 2 +- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/ConsoleGame/CortClass.cs b/ConsoleGame/CortClass.cs index daba74d..114f519 100644 --- a/ConsoleGame/CortClass.cs +++ b/ConsoleGame/CortClass.cs @@ -8,22 +8,23 @@ namespace ConsoleGame { internal class CortClass { - ushort[][] cort; - ushort lenX, lenY; + int[][] cort; + int lenX, lenY; public CortClass(ushort n, ushort m) { lenX = n; lenY = m; - cort = new ushort[m][n]; + cort = new int[m][]; + inpInRow(ref cort, m, n); cortInp(ref cort); } - private void cortInp(ref ushort[][] cort) + private void cortInp(ref int[][] cort) { - for(ushort posY = 0; posY < this.lenY; posY++) + for(int posY = 0; posY < this.lenY; posY++) { - for (ushort posX = 0; posX < this.lenX; posX++) + for (int posX = 0; posX < this.lenX; posX++) { if((posX == 0 )||(posY == 0) || (posX == this.lenX - 1) || (posY == this.lenY - 1)){ cort[posX][posY] = 1; } @@ -31,6 +32,14 @@ private void cortInp(ref ushort[][] cort) } } + private void inpInRow(ref int[][] arr, int rows, int columns) + { + for (int i = 0; i < rows; i++){ arr[i] = new int[columns]; } + } + public int[][] getCort() + { + return this.cort; + } } } diff --git a/ConsoleGame/Program.cs b/ConsoleGame/Program.cs index 14c9c6e..c59539a 100644 --- a/ConsoleGame/Program.cs +++ b/ConsoleGame/Program.cs @@ -7,13 +7,15 @@ public class ConsoleGame public static void Main(string[] args) { - ushort n = 16; - ushort m = 64; - checkForConsole(); + // checkForConsole(); while (true) { + cortPianter(64, 16); // Key reader + char exit = keyReader(); + if(exit == 'e') { break; } + } } @@ -35,5 +37,23 @@ private static void setAndPrint(int posX, int posY, ConsoleColor colorToPrint) { Console.BackgroundColor = defaultColor; } + + private static char keyReader() + { + char keyChar = 'e'; + Console.ReadKey(); + return keyChar; + } + + private static void cortPianter(int n, int m) + { + for(int i = 0; i < m; i++) + { + for (int j = 0; j < n; j++) + { + if(cortClass.)setAndPrint(n, m, ConsoleColor.Cyan); + } + } + } } } \ No newline at end of file diff --git a/ConsoleGame/obj/Debug/net8.0/ConsoleGame.AssemblyInfo.cs b/ConsoleGame/obj/Debug/net8.0/ConsoleGame.AssemblyInfo.cs index 1dc0798..b2cbb00 100644 --- a/ConsoleGame/obj/Debug/net8.0/ConsoleGame.AssemblyInfo.cs +++ b/ConsoleGame/obj/Debug/net8.0/ConsoleGame.AssemblyInfo.cs @@ -14,7 +14,7 @@ [assembly: System.Reflection.AssemblyCompanyAttribute("ConsoleGame")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9c723bcf4ca217807a5f200ca3972a786cd0a53b")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+da3724d5bf465c85acb43200a9b6c97d2a00538e")] [assembly: System.Reflection.AssemblyProductAttribute("ConsoleGame")] [assembly: System.Reflection.AssemblyTitleAttribute("ConsoleGame")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]