diff --git a/.vs/Snake/v16/.suo b/.vs/Snake/v16/.suo index d29485e..2361564 100644 Binary files a/.vs/Snake/v16/.suo and b/.vs/Snake/v16/.suo differ diff --git a/.vs/Snake/v16/Server/sqlite3/storage.ide b/.vs/Snake/v16/Server/sqlite3/storage.ide index 8c1bdb8..ac56f07 100644 Binary files a/.vs/Snake/v16/Server/sqlite3/storage.ide and b/.vs/Snake/v16/Server/sqlite3/storage.ide differ diff --git a/.vs/Snake/v16/Server/sqlite3/storage.ide-shm b/.vs/Snake/v16/Server/sqlite3/storage.ide-shm new file mode 100644 index 0000000..fe9ac28 Binary files /dev/null and b/.vs/Snake/v16/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/Snake/v16/Server/sqlite3/storage.ide-wal b/.vs/Snake/v16/Server/sqlite3/storage.ide-wal new file mode 100644 index 0000000..58dd2d1 Binary files /dev/null and b/.vs/Snake/v16/Server/sqlite3/storage.ide-wal differ diff --git a/Snake/Point.cs b/Snake/Point.cs new file mode 100644 index 0000000..1176f55 --- /dev/null +++ b/Snake/Point.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Snake +{ + class Point + { + //private int x; + //private int y; + // Временно делаем поля открытыми + public int x; + public int y; + private char sym; + + public Point() + { + + } + + public Point(int x, int y, char sym) + { + this.x = x; + this.y = y; + this.sym = sym; + } + + public void Draw() + { + Console.SetCursorPosition(x, y); + Console.Write(sym); + } + } + +} diff --git a/Snake/Program.cs b/Snake/Program.cs index 656f420..988b675 100644 --- a/Snake/Program.cs +++ b/Snake/Program.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Snake { @@ -10,8 +6,57 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + + Point p1 = new Point(1, 3, '*'); + p1.Draw(); + + Point p2 = new Point(4, 5, '#'); + p2.Draw(); + + int x = 1; + Func1(x); + Console.WriteLine($"Func1 x={x}"); + + Func2(x); + Console.WriteLine($"Func2 x={x}"); + + Func3(x); + Console.WriteLine($"Func3 x={x}"); + + Move(p1, 10, 10); + Console.WriteLine($"Move(p1, 10, 10) p1.x = {p1.x}, p1.y = {p1.y}"); + + Reset(p2); + Console.WriteLine($"Reset(p2) p2.x = {p2.x}, p2.y = {p2.y}"); + Console.ReadKey(); } + + private static void Reset(Point p) + { + p = new Point(); + // Здесь переменная p2 останется без изменений. + } + + private static void Move(Point p, int dx, int dy) + { + p.x = p.x + dx; + p.y = p.y + dy; + } + + private static void Func3(int x) + { + x++; + } + + private static void Func2(int val) + { + val++; + } + + private static void Func1(int x) + { + + } } } diff --git a/Snake/Snake.csproj b/Snake/Snake.csproj index 58d13d6..e267193 100644 --- a/Snake/Snake.csproj +++ b/Snake/Snake.csproj @@ -43,6 +43,7 @@ + diff --git a/Snake/bin/Debug/Snake.exe b/Snake/bin/Debug/Snake.exe index 94d4f88..d327d92 100644 Binary files a/Snake/bin/Debug/Snake.exe and b/Snake/bin/Debug/Snake.exe differ diff --git a/Snake/bin/Debug/Snake.pdb b/Snake/bin/Debug/Snake.pdb index bf37167..b59efdf 100644 Binary files a/Snake/bin/Debug/Snake.pdb and b/Snake/bin/Debug/Snake.pdb differ diff --git a/Snake/obj/Debug/Snake.csprojAssemblyReference.cache b/Snake/obj/Debug/Snake.csprojAssemblyReference.cache index 89545cb..684a438 100644 Binary files a/Snake/obj/Debug/Snake.csprojAssemblyReference.cache and b/Snake/obj/Debug/Snake.csprojAssemblyReference.cache differ diff --git a/Snake/obj/Debug/Snake.exe b/Snake/obj/Debug/Snake.exe index 94d4f88..d327d92 100644 Binary files a/Snake/obj/Debug/Snake.exe and b/Snake/obj/Debug/Snake.exe differ diff --git a/Snake/obj/Debug/Snake.pdb b/Snake/obj/Debug/Snake.pdb index bf37167..b59efdf 100644 Binary files a/Snake/obj/Debug/Snake.pdb and b/Snake/obj/Debug/Snake.pdb differ