diff --git a/lab16/lab16/lab16.cpp b/lab16/lab16/lab16.cpp
index 0498409..624baee 100644
--- a/lab16/lab16/lab16.cpp
+++ b/lab16/lab16/lab16.cpp
@@ -154,7 +154,7 @@ int map[M][N] = {
int player_x = 1;
int player_y = 1;
-enum obj_enum {empty = 0, wall = 2, gold = 3};
+enum obj_enum { empty = 0, wall = 2, gold = 3 };
// TODO: do something with "empty" object
#define INVENTORY_SIZE 4
int inventory[INVENTORY_SIZE] = { 0, 0, 15, 0 };
@@ -164,16 +164,16 @@ enum enum_ways { left, right, up, down };
void movePlayer(enum_ways move) {
switch (move) {
case left:
- if ((player_x > 0) and map[player_y][player_x - 1] != 2) player_x -= 1;
+ if ((player_x > 0) and map[player_y][player_x - 1] != wall) player_x -= 1;
break;
case right:
- if ((player_x < N - 1) and map[player_y][player_x + 1] != 2) player_x += 1;
+ if ((player_x < N - 1) and map[player_y][player_x + 1] != wall) player_x += 1;
break;
case up:
- if ((player_y > 0) and map[player_y - 1][player_x] != 2) player_y -= 1;
+ if ((player_y > 0) and map[player_y - 1][player_x] != wall) player_y -= 1;
break;
case down:
- if ((player_y < M - 1) and map[player_y + 1][player_x] != 2) player_y += 1;
+ if ((player_y < M - 1) and map[player_y + 1][player_x] != wall) player_y += 1;
break;
}
if (map[player_y][player_x] == gold) {
@@ -397,8 +397,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
(player_x + 2) * WIDTH, (player_y + 2) * HEIGHT
};*/
- RECT textrect = { 0, 0, 100, 50 };
-
drawMap(hdc);
drawPlayer(hdc);
if (netToggle) drawNet(hdc);
@@ -407,10 +405,17 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
else if (selected_element == wall) sprintf(count_string, "wall = %d", inventory[wall]);
else sprintf(count_string, "not selected");
+ RECT textrect = { 0, 0, 150, 50 };
+ HFONT hFont = CreateFontW(23, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_OUTLINE_PRECIS,
+ CLIP_DEFAULT_PRECIS, PROOF_QUALITY, VARIABLE_PITCH, TEXT("SegoeUI"));
+ SelectObject(hdc, hFont);
+
//SetBkColor(hdc, RGB(255, 0, 0));
//SetBkMode(hdc, TRANSPARENT);
DrawTextA(hdc, count_string, -1, &textrect, (DT_SINGLELINE | DT_TOP | DT_CENTER));
+ DeleteObject(hFont);
+
EndPaint(hWnd, &ps);
}
break;
diff --git a/lab17/lab17.sln b/lab17/lab17.sln
new file mode 100644
index 0000000..48d6b0e
--- /dev/null
+++ b/lab17/lab17.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.11.35222.181
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lab17", "lab17\lab17.vcxproj", "{2B99CB20-E56D-415E-A18B-BC59994DE409}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2B99CB20-E56D-415E-A18B-BC59994DE409}.Debug|x64.ActiveCfg = Debug|x64
+ {2B99CB20-E56D-415E-A18B-BC59994DE409}.Debug|x64.Build.0 = Debug|x64
+ {2B99CB20-E56D-415E-A18B-BC59994DE409}.Debug|x86.ActiveCfg = Debug|Win32
+ {2B99CB20-E56D-415E-A18B-BC59994DE409}.Debug|x86.Build.0 = Debug|Win32
+ {2B99CB20-E56D-415E-A18B-BC59994DE409}.Release|x64.ActiveCfg = Release|x64
+ {2B99CB20-E56D-415E-A18B-BC59994DE409}.Release|x64.Build.0 = Release|x64
+ {2B99CB20-E56D-415E-A18B-BC59994DE409}.Release|x86.ActiveCfg = Release|Win32
+ {2B99CB20-E56D-415E-A18B-BC59994DE409}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {10542F7B-5667-42D1-99B8-B3B0186CF58D}
+ EndGlobalSection
+EndGlobal
diff --git a/lab17/lab17/lab17.vcxproj b/lab17/lab17/lab17.vcxproj
new file mode 100644
index 0000000..fc6cb9b
--- /dev/null
+++ b/lab17/lab17/lab17.vcxproj
@@ -0,0 +1,138 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 17.0
+ Win32Proj
+ {2b99cb20-e56d-415e-a18b-bc59994de409}
+ lab17
+ 10.0
+
+
+
+ Application
+ true
+ v143
+ Unicode
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+
+
+ Application
+ true
+ v143
+ Unicode
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab17/lab17/lab17.vcxproj.filters b/lab17/lab17/lab17.vcxproj.filters
new file mode 100644
index 0000000..5c7b397
--- /dev/null
+++ b/lab17/lab17/lab17.vcxproj.filters
@@ -0,0 +1,27 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Исходные файлы
+
+
+
+
+ Файлы ресурсов
+
+
+
\ No newline at end of file
diff --git a/lab17/lab17/main.c b/lab17/lab17/main.c
new file mode 100644
index 0000000..7c89f97
--- /dev/null
+++ b/lab17/lab17/main.c
@@ -0,0 +1,107 @@
+#include
+
+long long fact(int n) {
+ if (n == 0) {
+ return 1;
+ }
+ printf_s("n=%d\n", n);
+ long long res = fact(n - 1) * n;
+ printf_s("n=%d fact(%d)=%lld res=%lld\n", n, n - 1, res / n, res);
+ return res;
+}
+
+void f1(int n, FILE* f) {
+ printf_s("%d ", n);
+ fprintf(f, "f1(%d) -> print(%d) \n", n, n);
+ if (n > 1) {
+ f1(n - 2, f);
+ fprintf(f, "f1(%d) returned \n", n - 2);
+ }
+}
+
+void f2(int n, FILE* f) {
+ if (n > 1) {
+ f2(n - 2, f);
+ fprintf(f, "f2(%d) returned \n", n - 2);
+ }
+ printf_s("%d ", n);
+ fprintf(f, "f2(%d) -> print(%d) \n", n, n);
+}
+
+void f3(int n, FILE* f) {
+ printf_s("%d ", n);
+ fprintf(f, "f3(%d) -> print(%d) \n", n, n);
+ if (n > 3) {
+ f3(n - 2, f);
+ fprintf(f, "f3(%d) returned \n", n - 2);
+ }
+ if (n == 3) {
+ printf_s("1 ");
+ fprintf(f, "f3(%d) && n == 3 -> print(%d) \n", n, 1);
+ }
+ printf_s("%d ", n);
+ fprintf(f, "f3(%d) -> print(%d) \n", n, n);
+}
+
+void recEGE1(int n, FILE* f) {
+ if (n >= 1) {
+ printf(" %d", n);
+ fprintf(f, "recEGE1(%d) && (n >= 1) == true -> print( %d) \n", n, n);
+ recEGE1(n - 1, f);
+ fprintf(f, "1)recEGE1(%d) returned\n", n - 1);
+ recEGE1(n - 1, f);
+ fprintf(f, "2)recEGE1(%d) returned \n", n - 1);
+ }
+}
+
+void F1(int n, FILE* f) {
+ if (n > 2) {
+ printf_s("%d\n", n);
+ fprintf(f, "F1(%d) -> print(%d) \n", n, n);
+ F1(n - 3, f);
+ fprintf(f, "1)F1(%d) returned\n", n - 3);
+ F1(n - 4, f);
+ fprintf(f, "2)F1(%d) returned\n", n - 4);
+ }
+}
+
+void F2(int n, FILE* f) {
+ if (n < 5) {
+ printf_s("%d\n", n);
+ fprintf(f, "F2(%d) -> print(%d) \n", n, n);
+ F2(n + 1, f);
+ fprintf(f, "1)F2(%d) returned\n", n + 1);
+ F2(n + 3, f);
+ fprintf(f, "2)F2(%d) returned\n", n + 3);
+ }
+}
+
+int main() {
+ FILE* fout = fopen("trace.txt", "w");
+ if (fout == NULL) {
+ puts(" ");
+ return;
+ }
+
+ //printf("%lld", fact(5)); // 1
+
+ f1(11, fout);
+ fprintf(fout, "\n");
+ printf_s("\n\n");
+ f2(11, fout);
+ fprintf(fout, "\n");
+ printf_s("\n\n");
+ f3(11, fout);
+ fprintf(fout, "\n");
+ printf_s("\n\n");
+ recEGE1(3, fout);
+ fprintf(fout, "\n");
+ printf_s("\n\n");
+ F1(10, fout);
+ fprintf(fout, "\n");
+ printf_s("\n\n");
+ F2(1, fout);
+
+ fclose(fout);
+ return 0;
+}
\ No newline at end of file
diff --git a/lab17/lab17/trace.txt b/lab17/lab17/trace.txt
new file mode 100644
index 0000000..d35e6bc
--- /dev/null
+++ b/lab17/lab17/trace.txt
@@ -0,0 +1,96 @@
+f1(11) -> print(11)
+f1(9) -> print(9)
+f1(7) -> print(7)
+f1(5) -> print(5)
+f1(3) -> print(3)
+f1(1) -> print(1)
+f1(1) returned
+f1(3) returned
+f1(5) returned
+f1(7) returned
+f1(9) returned
+
+f2(1) -> print(1)
+f2(1) returned
+f2(3) -> print(3)
+f2(3) returned
+f2(5) -> print(5)
+f2(5) returned
+f2(7) -> print(7)
+f2(7) returned
+f2(9) -> print(9)
+f2(9) returned
+f2(11) -> print(11)
+
+f3(11) -> print(11)
+f3(9) -> print(9)
+f3(7) -> print(7)
+f3(5) -> print(5)
+f3(3) -> print(3)
+f3(3) && n == 3 -> print(1)
+f3(3) -> print(3)
+f3(3) returned
+f3(5) -> print(5)
+f3(5) returned
+f3(7) -> print(7)
+f3(7) returned
+f3(9) -> print(9)
+f3(9) returned
+f3(11) -> print(11)
+
+recEGE1(3) && (n >= 1) == true -> print( 3)
+recEGE1(2) && (n >= 1) == true -> print( 2)
+recEGE1(1) && (n >= 1) == true -> print( 1)
+1)recEGE1(0) returned
+2)recEGE1(0) returned
+1)recEGE1(1) returned
+recEGE1(1) && (n >= 1) == true -> print( 1)
+1)recEGE1(0) returned
+2)recEGE1(0) returned
+2)recEGE1(1) returned
+1)recEGE1(2) returned
+recEGE1(2) && (n >= 1) == true -> print( 2)
+recEGE1(1) && (n >= 1) == true -> print( 1)
+1)recEGE1(0) returned
+2)recEGE1(0) returned
+1)recEGE1(1) returned
+recEGE1(1) && (n >= 1) == true -> print( 1)
+1)recEGE1(0) returned
+2)recEGE1(0) returned
+2)recEGE1(1) returned
+2)recEGE1(2) returned
+
+F1(10) -> print(10)
+F1(7) -> print(7)
+F1(4) -> print(4)
+1)F1(1) returned
+2)F1(0) returned
+1)F1(4) returned
+F1(3) -> print(3)
+1)F1(0) returned
+2)F1(-1) returned
+2)F1(3) returned
+1)F1(7) returned
+F1(6) -> print(6)
+F1(3) -> print(3)
+1)F1(0) returned
+2)F1(-1) returned
+1)F1(3) returned
+2)F1(2) returned
+2)F1(6) returned
+
+F2(1) -> print(1)
+F2(2) -> print(2)
+F2(3) -> print(3)
+F2(4) -> print(4)
+1)F2(5) returned
+2)F2(7) returned
+1)F2(4) returned
+2)F2(6) returned
+1)F2(3) returned
+2)F2(5) returned
+1)F2(2) returned
+F2(4) -> print(4)
+1)F2(5) returned
+2)F2(7) returned
+2)F2(4) returned
diff --git a/Лекции/FIST2024_OsnProgram_lek_09_Rekursia.pptx b/Лекции/FIST2024_OsnProgram_lek_09_Rekursia.pptx
new file mode 100644
index 0000000..a82937e
Binary files /dev/null and b/Лекции/FIST2024_OsnProgram_lek_09_Rekursia.pptx differ
diff --git a/Лекции/FIST2024_OsnProgram_lek_10_DinamichPamyat_Spisok.pptx b/Лекции/FIST2024_OsnProgram_lek_10_DinamichPamyat_Spisok.pptx
new file mode 100644
index 0000000..c1e7b1a
Binary files /dev/null and b/Лекции/FIST2024_OsnProgram_lek_10_DinamichPamyat_Spisok.pptx differ