Skip to content

Commit

Permalink
CortUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
urmasa-tar committed Jul 10, 2024
1 parent da3724d commit bfc2c27
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
21 changes: 15 additions & 6 deletions ConsoleGame/CortClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,38 @@ 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; }

}
}
}

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;
}
}
}
26 changes: 23 additions & 3 deletions ConsoleGame/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

}
}

Expand All @@ -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);
}
}
}
}
}
2 changes: 1 addition & 1 deletion ConsoleGame/obj/Debug/net8.0/ConsoleGame.AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit bfc2c27

Please sign in to comment.