Advertisement
Momir

ČAH v1.0.0

Jun 6th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 118.06 KB | None | 0 0
  1. #define _WIN32_WINNT 0x0600
  2. #define STRICT
  3. #include <string>
  4. #include <vector>
  5. #include <dos.h>
  6. #include <dir.h>
  7. #include <iostream>
  8. #include <fstream>
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <conio.h>
  12. #include <io.h>
  13. #include <shlwapi.h>
  14. #include <fcntl.h>
  15. #include <unistd.h>
  16. #include <windows.h>
  17. #include <cwchar>
  18. #include <winreg.h>
  19. #include <Wincon.h>
  20. #define _O_U16TEXT  0x20000
  21. #define _O_U8TEXT   0x40000
  22. #define SVETLO 0
  23. #define TAMNO 1
  24. #define SIVO 2
  25. #define BELO 0
  26. #define CRNO 1
  27. #define ISKLJUCENO 0
  28. #define UKLJUCENO 1
  29. #define ZELENO 2
  30. #define NEUTRALNO 0
  31. #define IZABRANO 1
  32. #define NAPADNUTO 2
  33. #define TOP L"♜ "
  34. #define KONJ L"♞ "
  35. #define LOVAC L"♝ "
  36. #define KRALJICA L"♛ "
  37. #define KRALJ L"♚ "
  38. #define PIJUN L"♟ "
  39. #define PRAZNO L"  "
  40. #define TACKA L""  // ● ꞏ ⚫
  41. using namespace std;
  42. int a, b;
  43. typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX
  44. {
  45.     ULONG      cbSize;
  46.     COORD      dwSize;
  47.     COORD      dwCursorPosition;
  48.     WORD       wAttributes;
  49.     SMALL_RECT srWindow;
  50.     COORD      dwMaximumWindowSize;
  51.     WORD       wPopupAttributes;
  52.     BOOL       bFullscreenSupported;
  53.     COLORREF   ColorTable[16];
  54. } CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX;
  55.  
  56. typedef struct _CONSOLE_FONT_INFOEX
  57. {
  58.     ULONG cbSize;
  59.     DWORD nFont;
  60.     COORD dwFontSize;
  61.     UINT  FontFamily;
  62.     UINT  FontWeight;
  63.     WCHAR FaceName[LF_FACESIZE];
  64. } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;
  65.  
  66. #ifdef __cplusplus
  67. extern "C" {
  68. #endif
  69. BOOL WINAPI SetCurrentConsoleFontEx(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73.  
  74. #ifdef __cplusplus
  75. extern "C" {
  76. #endif
  77. BOOL WINAPI GetConsoleScreenBufferInfoEx(HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx);
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81.  
  82. #ifdef __cplusplus
  83. extern "C" {
  84. #endif
  85. BOOL WINAPI SetConsoleScreenBufferInfoEx(HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx);
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89.  
  90. #ifdef __cplusplus
  91. extern "C" {
  92. #endif
  93. BOOL WINAPI GetCurrentConsoleFontEx(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
  94. #ifdef __cplusplus
  95. }
  96. #endif
  97.  
  98. #ifdef __cplusplus
  99. extern "C" {
  100. #endif
  101. BOOL WINAPI GetConsoleCursorInfo(HANDLE hConsoleOutput, PCONSOLE_CURSOR_INFO lpConsoleCursorInfo);
  102. #ifdef __cplusplus
  103. }
  104. #endif
  105.  
  106.  
  107. void SakriKursor();
  108. void ObrisiEkran();
  109. void gotoxy(int x, int y);
  110. int UcitajKlik(int &x, int &y);
  111. void CentrirajKonzolu();
  112. void CentrirajKonzolu2();
  113.  
  114. short prviput1 = 1;
  115. short prviput2 = 1;
  116. short prviput3 = 1;
  117. short prviput4 = 1;
  118. short boja = SVETLO;
  119. short rotacija = ISKLJUCENO;
  120. short sacekaj;
  121. short velicina = 29;
  122. unsigned long long int brPoteza = 0;
  123. long winlog;
  124. _CONSOLE_SCREEN_BUFFER_INFOEX screenbuffer;
  125. CONSOLE_CURSOR_INFO kursor;
  126.  
  127. typedef struct
  128. {
  129.     short bojaPolja;
  130.     short stanjePolja;
  131.     wchar_t figura[4];
  132.     short bojaFigure;
  133.     short anpasan;
  134. } Polje;
  135.  
  136. typedef struct
  137. {
  138.     Polje polje[8][8];
  139.     Polje levo[8][2];
  140.     Polje desno[8][2];
  141.     short brlevo;
  142.     short brdesno;
  143.     short malarbeli;
  144.     short velikarbeli;
  145.     short malarcrni;
  146.     short velikarcrni;
  147.     short krajigre;
  148.  
  149. } Tabla;
  150.  
  151. void OsveziTablu(Tabla tabla);
  152. void PodesiKonzolu();
  153. void PodesiKonzolu2();
  154. void NapraviTablu(Tabla &tabla);
  155. void OdstampajTablu(Tabla tabla);
  156. void OdstampajKonzolu();
  157. void PozicijaNaTabli(int &x, int &y);
  158. void NoviPotez(Tabla &tabla);
  159. void PozicijaIzabranog(int &xizb, int &yizb, Tabla tabla);
  160. short JelUnutarTable(int x, int y);
  161. void OdstampajKonzolu();
  162. void OdstampajLevoDesno(Tabla tabla);
  163. void ObrnutoOdstampajTablu(Tabla tabla);
  164. void ObrnutaPozicijaNaTabli(int &x, int &y);
  165. void ObrisiAnpasan(Tabla &tabla);
  166. void PodesiVelicinu(int i);
  167.  
  168. BOOL RegDelnodeRecurse (HKEY hKeyRoot, LPTSTR lpSubKey)
  169. {
  170.     if(prviput4)
  171.     {
  172.         HWND consoleWindow = GetConsoleWindow();
  173.         ShowWindow(consoleWindow, SW_HIDE);
  174.         prviput4 = 0;
  175.     }
  176.  
  177.     LPTSTR lpEnd;
  178.     LONG lResult;
  179.     DWORD dwSize;
  180.     TCHAR szName[MAX_PATH];
  181.     HKEY hKey;
  182.     FILETIME ftWrite;
  183.     lResult = RegDeleteKey(hKeyRoot, lpSubKey);
  184.  
  185.     if (lResult == ERROR_SUCCESS)
  186.         return TRUE;
  187.  
  188.     lResult = RegOpenKeyEx (hKeyRoot, lpSubKey, 0, KEY_READ, &hKey);
  189.  
  190.     if (lResult != ERROR_SUCCESS)
  191.         if (lResult == ERROR_FILE_NOT_FOUND)
  192.             return TRUE;
  193.         else
  194.             return FALSE;
  195.  
  196.     lpEnd = lpSubKey + lstrlen(lpSubKey);
  197.  
  198.     if (*(lpEnd - 1) != TEXT('\\'))
  199.     {
  200.         *lpEnd =  TEXT('\\');
  201.         lpEnd++;
  202.         *lpEnd =  TEXT('\0');
  203.     }
  204.  
  205.     dwSize = MAX_PATH;
  206.     lResult = RegEnumKeyEx(hKey, 0, szName, &dwSize, NULL, NULL, NULL, &ftWrite);
  207.  
  208.     if (lResult == ERROR_SUCCESS)
  209.         do
  210.         {
  211.  
  212.             *lpEnd = TEXT('\0');
  213.             strcat(lpSubKey, szName);
  214.  
  215.             if (!RegDelnodeRecurse(hKeyRoot, lpSubKey))
  216.             {
  217.                 break;
  218.             }
  219.  
  220.             dwSize = MAX_PATH;
  221.  
  222.             lResult = RegEnumKeyEx(hKey, 0, szName, &dwSize, NULL, NULL, NULL, &ftWrite);
  223.         }
  224.         while (lResult == ERROR_SUCCESS);
  225.  
  226.     lpEnd--;
  227.     *lpEnd = TEXT('\0');
  228.  
  229.     RegCloseKey (hKey);
  230.  
  231.     lResult = RegDeleteKey(hKeyRoot, lpSubKey);
  232.  
  233.     if (lResult == ERROR_SUCCESS)
  234.         return TRUE;
  235.  
  236.     return FALSE;
  237. }
  238.  
  239. void ObrisiTerminal()
  240. {
  241.     HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
  242.     _setmode(_fileno(stdout), _O_U8TEXT);
  243.  
  244.     if(boja == SVETLO)
  245.         SetConsoleTextAttribute(console, 85);
  246.     else if(boja == TAMNO)
  247.         SetConsoleTextAttribute(console, 102);
  248.     else if(boja == SIVO)
  249.         SetConsoleTextAttribute(console, 153);
  250.  
  251.     gotoxy(2, 13);
  252.     wprintf(L"████████████████████████████████");
  253.     gotoxy(2, 14);
  254.     wprintf(L"████████████████████████████████");
  255.     gotoxy(2, 15);
  256.     wprintf(L"████████████████████████████████");
  257. }
  258.  
  259. Tabla StaviFiguruNaXY(Tabla tabla, int x, int y)
  260. {
  261.     int xizb, yizb;
  262.     PozicijaIzabranog(xizb, yizb, tabla);
  263.     wcscpy(tabla.polje[y][x].figura, tabla.polje[yizb][xizb].figura);
  264.     wcscpy(tabla.polje[yizb][xizb].figura, PRAZNO);
  265.     tabla.polje[y][x].bojaFigure = tabla.polje[yizb][xizb].bojaFigure;
  266.     NoviPotez(tabla);
  267.  
  268.     return tabla;
  269. }
  270.  
  271. short JelSahBeli(Tabla tabla, int xpomeraj, int ypomeraj)
  272. {
  273.     int x = 0, y = 0;
  274.  
  275.     for(int i = 0; i < 64; i++)
  276.     {
  277.         if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == BELO)
  278.         {
  279.             if(JelUnutarTable(i % 8 + xpomeraj, i / 8 + ypomeraj))
  280.             {
  281.                 y = i / 8 + ypomeraj;
  282.                 x = i % 8 + xpomeraj;
  283.             }
  284.             else
  285.             {
  286.                 x = i % 8;
  287.                 y = i / 8;
  288.             }
  289.  
  290.             break;
  291.         }
  292.     }
  293.  
  294.     if(!wcscmp(tabla.polje[y - 1][x + 1].figura, PIJUN) && tabla.polje[y - 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y - 1))
  295.         return 1;
  296.  
  297.     if(!wcscmp(tabla.polje[y - 1][x - 1].figura, PIJUN) && tabla.polje[y - 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y - 1))
  298.         return 1;
  299.  
  300.     if(!wcscmp(tabla.polje[y - 2][x - 1].figura, KONJ) && tabla.polje[y - 2][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y - 2))
  301.         return 1;
  302.  
  303.     if(!wcscmp(tabla.polje[y - 2][x + 1].figura, KONJ) && tabla.polje[y - 2][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y - 2))
  304.         return 1;
  305.  
  306.     if(!wcscmp(tabla.polje[y - 1][x + 2].figura, KONJ) && tabla.polje[y - 1][x + 2].bojaFigure == CRNO && JelUnutarTable(x + 2, y - 1))
  307.         return 1;
  308.  
  309.     if(!wcscmp(tabla.polje[y + 1][x + 2].figura, KONJ) && tabla.polje[y + 1][x + 2].bojaFigure == CRNO && JelUnutarTable(x + 2, y + 1))
  310.         return 1;
  311.  
  312.     if(!wcscmp(tabla.polje[y + 2][x + 1].figura, KONJ) && tabla.polje[y + 2][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y + 2))
  313.         return 1;
  314.  
  315.     if(!wcscmp(tabla.polje[y + 2][x - 1].figura, KONJ) && tabla.polje[y + 2][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y + 2))
  316.         return 1;
  317.  
  318.     if(!wcscmp(tabla.polje[y + 1][x - 2].figura, KONJ) && tabla.polje[y + 1][x - 2].bojaFigure == CRNO && JelUnutarTable(x - 2, y + 1))
  319.         return 1;
  320.  
  321.     if(!wcscmp(tabla.polje[y - 1][x - 2].figura, KONJ) && tabla.polje[y - 1][x - 2].bojaFigure == CRNO && JelUnutarTable(x - 2, y - 1))
  322.         return 1;
  323.  
  324.     for(int i = 1; i < 8; i++)
  325.     {
  326.         if((!wcscmp(tabla.polje[y][x - i].figura, PRAZNO) || (!wcscmp(tabla.polje[y][x - i].figura, KRALJ) && tabla.polje[y][x - i].bojaFigure == BELO)) && JelUnutarTable(x - i, y));
  327.         else if((!wcscmp(tabla.polje[y][x - i].figura, TOP) || !wcscmp(tabla.polje[y][x - i].figura, KRALJICA)) && tabla.polje[y][x - i].bojaFigure == CRNO && JelUnutarTable(x - i, y))
  328.             return 1;
  329.         else
  330.             break;
  331.     }
  332.  
  333.     for(int i = 1; i < 8; i++)
  334.     {
  335.         if((!wcscmp(tabla.polje[y][x + i].figura, PRAZNO) || (!wcscmp(tabla.polje[y][x + i].figura, KRALJ) && tabla.polje[y][x + i].bojaFigure == BELO)) && JelUnutarTable(x + i, y));
  336.         else if((!wcscmp(tabla.polje[y][x + i].figura, TOP) || !wcscmp(tabla.polje[y][x + i].figura, KRALJICA)) && tabla.polje[y][x + i].bojaFigure == CRNO && JelUnutarTable(x + i, y))
  337.             return 1;
  338.         else
  339.             break;
  340.     }
  341.  
  342.     for(int i = 1; i < 8; i++)
  343.     {
  344.         if((!wcscmp(tabla.polje[y - i][x].figura, PRAZNO) || (!wcscmp(tabla.polje[y - i][x].figura, KRALJ) && tabla.polje[y - i][x].bojaFigure == BELO)) && JelUnutarTable(x, y - i));
  345.         else if((!wcscmp(tabla.polje[y - i][x].figura, TOP) || !wcscmp(tabla.polje[y - i][x].figura, KRALJICA)) && tabla.polje[y - i][x].bojaFigure == CRNO && JelUnutarTable(x, y - i))
  346.             return 1;
  347.         else
  348.             break;
  349.     }
  350.  
  351.     for(int i = 1; i < 8; i++)
  352.     {
  353.         if((!wcscmp(tabla.polje[y + i][x].figura, PRAZNO) || (!wcscmp(tabla.polje[y + i][x].figura, KRALJ) && tabla.polje[y + i][x].bojaFigure == BELO)) && JelUnutarTable(x, y + i));
  354.         else if((!wcscmp(tabla.polje[y + i][x].figura, TOP) || !wcscmp(tabla.polje[y + i][x].figura, KRALJICA)) && tabla.polje[y + i][x].bojaFigure == CRNO && JelUnutarTable(x, y + i))
  355.             return 1;
  356.         else
  357.             break;
  358.     }
  359.  
  360.     for(int i = 1; i < 8; i++)
  361.     {
  362.         if((!wcscmp(tabla.polje[y - i][x - i].figura, PRAZNO) || (!wcscmp(tabla.polje[y - i][x - i].figura, KRALJ) && tabla.polje[y - i][x - i].bojaFigure == BELO)) && JelUnutarTable(x - i, y - i));
  363.         else if((!wcscmp(tabla.polje[y - i][x - i].figura, LOVAC) || !wcscmp(tabla.polje[y - i][x - i].figura, KRALJICA)) && tabla.polje[y - i][x - i].bojaFigure == CRNO && JelUnutarTable(x - i, y - i))
  364.             return 1;
  365.         else
  366.             break;
  367.     }
  368.  
  369.     for(int i = 1; i < 8; i++)
  370.     {
  371.         if((!wcscmp(tabla.polje[y - i][x + i].figura, PRAZNO) || (!wcscmp(tabla.polje[y - i][x + i].figura, KRALJ) && tabla.polje[y - i][x + i].bojaFigure == BELO)) && JelUnutarTable(x + i, y - i));
  372.         else if((!wcscmp(tabla.polje[y - i][x + i].figura, LOVAC) || !wcscmp(tabla.polje[y - i][x + i].figura, KRALJICA)) && tabla.polje[y - i][x + i].bojaFigure == CRNO && JelUnutarTable(x + i, y - i))
  373.             return 1;
  374.         else
  375.             break;
  376.     }
  377.  
  378.     for(int i = 1; i < 8; i++)
  379.     {
  380.         if((!wcscmp(tabla.polje[y + i][x - i].figura, PRAZNO) || (!wcscmp(tabla.polje[y + i][x - i].figura, KRALJ) && tabla.polje[y + i][x - i].bojaFigure == BELO)) && JelUnutarTable(x - i, y + i));
  381.         else if((!wcscmp(tabla.polje[y + i][x - i].figura, LOVAC) || !wcscmp(tabla.polje[y + i][x - i].figura, KRALJICA)) && tabla.polje[y + i][x - i].bojaFigure == CRNO && JelUnutarTable(x - i, y + i))
  382.             return 1;
  383.         else
  384.             break;
  385.     }
  386.  
  387.     for(int i = 1; i < 8; i++)
  388.     {
  389.         if((!wcscmp(tabla.polje[y + i][x + i].figura, PRAZNO) || (!wcscmp(tabla.polje[y + i][x + i].figura, KRALJ) && tabla.polje[y + i][x + i].bojaFigure == BELO)) && JelUnutarTable(x + i, y + i));
  390.         else if((!wcscmp(tabla.polje[y + i][x + i].figura, LOVAC) || !wcscmp(tabla.polje[y + i][x + i].figura, KRALJICA)) && tabla.polje[y + i][x + i].bojaFigure == CRNO && JelUnutarTable(x + i, y + i))
  391.             return 1;
  392.         else
  393.             break;
  394.     }
  395.  
  396.     if(!wcscmp(tabla.polje[y][x - 1].figura, KRALJ) && tabla.polje[y][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y))
  397.         return 1;
  398.  
  399.     if(!wcscmp(tabla.polje[y][x + 1].figura, KRALJ) && tabla.polje[y][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y))
  400.         return 1;
  401.  
  402.     if(!wcscmp(tabla.polje[y - 1][x].figura, KRALJ) && tabla.polje[y - 1][x].bojaFigure == CRNO && JelUnutarTable(x, y - 1))
  403.         return 1;
  404.  
  405.     if(!wcscmp(tabla.polje[y + 1][x].figura, KRALJ) && tabla.polje[y + 1][x].bojaFigure == CRNO && JelUnutarTable(x, y + 1))
  406.         return 1;
  407.  
  408.     if(!wcscmp(tabla.polje[y - 1][x - 1].figura, KRALJ) && tabla.polje[y - 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y - 1))
  409.         return 1;
  410.  
  411.     if(!wcscmp(tabla.polje[y - 1][x + 1].figura, KRALJ) && tabla.polje[y - 1][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y - 1))
  412.         return 1;
  413.  
  414.     if(!wcscmp(tabla.polje[y + 1][x - 1].figura, KRALJ) && tabla.polje[y + 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y + 1))
  415.         return 1;
  416.  
  417.     if(!wcscmp(tabla.polje[y + 1][x + 1].figura, KRALJ) && tabla.polje[y + 1][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y + 1))
  418.         return 1;
  419.  
  420.     return 0;
  421. }
  422.  
  423. short JelSahCrni(Tabla tabla, int xpomeraj, int ypomeraj)
  424. {
  425.     int x = 0, y = 0;
  426.  
  427.     for(int i = 0; i < 64; i++)
  428.     {
  429.         if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == CRNO)
  430.         {
  431.             if(JelUnutarTable(i % 8 + xpomeraj, i / 8 + ypomeraj))
  432.             {
  433.                 y = i / 8 + ypomeraj;
  434.                 x = i % 8 + xpomeraj;
  435.             }
  436.             else
  437.             {
  438.                 x = i % 8;
  439.                 y = i / 8;
  440.             }
  441.  
  442.             break;
  443.         }
  444.     }
  445.  
  446.     if(!wcscmp(tabla.polje[y + 1][x + 1].figura, PIJUN) && tabla.polje[y + 1][x - 1].bojaFigure == BELO && JelUnutarTable(x + 1, y + 1))
  447.         return 1;
  448.  
  449.     if(!wcscmp(tabla.polje[y + 1][x - 1].figura, PIJUN) && tabla.polje[y + 1][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y + 1))
  450.         return 1;
  451.  
  452.     if(!wcscmp(tabla.polje[y - 2][x - 1].figura, KONJ) && tabla.polje[y - 2][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y - 2))
  453.         return 1;
  454.  
  455.     if(!wcscmp(tabla.polje[y - 2][x + 1].figura, KONJ) && tabla.polje[y - 2][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y - 2))
  456.         return 1;
  457.  
  458.     if(!wcscmp(tabla.polje[y - 1][x + 2].figura, KONJ) && tabla.polje[y - 1][x + 2].bojaFigure == BELO && JelUnutarTable(x + 2, y - 1))
  459.         return 1;
  460.  
  461.     if(!wcscmp(tabla.polje[y + 1][x + 2].figura, KONJ) && tabla.polje[y + 1][x + 2].bojaFigure == BELO && JelUnutarTable(x + 2, y + 1))
  462.         return 1;
  463.  
  464.     if(!wcscmp(tabla.polje[y + 2][x + 1].figura, KONJ) && tabla.polje[y + 2][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y + 2))
  465.         return 1;
  466.  
  467.     if(!wcscmp(tabla.polje[y + 2][x - 1].figura, KONJ) && tabla.polje[y + 2][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y + 2))
  468.         return 1;
  469.  
  470.     if(!wcscmp(tabla.polje[y + 1][x - 2].figura, KONJ) && tabla.polje[y + 1][x - 2].bojaFigure == BELO && JelUnutarTable(x - 2, y + 1))
  471.         return 1;
  472.  
  473.     if(!wcscmp(tabla.polje[y - 1][x - 2].figura, KONJ) && tabla.polje[y - 1][x - 2].bojaFigure == BELO && JelUnutarTable(x - 2, y - 1))
  474.         return 1;
  475.  
  476.     for(int i = 1; i < 8; i++)
  477.     {
  478.         if((!wcscmp(tabla.polje[y][x - i].figura, PRAZNO) || (!wcscmp(tabla.polje[y][x - i].figura, KRALJ) && tabla.polje[y][x - i].bojaFigure == CRNO)) && JelUnutarTable(x - i, y));
  479.         else if((!wcscmp(tabla.polje[y][x - i].figura, TOP) || !wcscmp(tabla.polje[y][x - i].figura, KRALJICA)) && tabla.polje[y][x - i].bojaFigure == BELO && JelUnutarTable(x - i, y))
  480.             return 1;
  481.         else
  482.             break;
  483.     }
  484.  
  485.     for(int i = 1; i < 8; i++)
  486.     {
  487.         if((!wcscmp(tabla.polje[y][x + i].figura, PRAZNO) || (!wcscmp(tabla.polje[y][x + i].figura, KRALJ) && tabla.polje[y][x + i].bojaFigure == CRNO)) && JelUnutarTable(x + i, y));
  488.         else if((!wcscmp(tabla.polje[y][x + i].figura, TOP) || !wcscmp(tabla.polje[y][x + i].figura, KRALJICA)) && tabla.polje[y][x + i].bojaFigure == BELO && JelUnutarTable(x + i, y))
  489.             return 1;
  490.         else
  491.             break;
  492.     }
  493.  
  494.     for(int i = 1; i < 8; i++)
  495.     {
  496.         if((!wcscmp(tabla.polje[y - i][x].figura, PRAZNO) || (!wcscmp(tabla.polje[y - i][x].figura, KRALJ) && tabla.polje[y - i][x].bojaFigure == CRNO)) && JelUnutarTable(x, y - i));
  497.         else if((!wcscmp(tabla.polje[y - i][x].figura, TOP) || !wcscmp(tabla.polje[y - i][x].figura, KRALJICA)) && tabla.polje[y - i][x].bojaFigure == BELO && JelUnutarTable(x, y - i))
  498.             return 1;
  499.         else
  500.             break;
  501.     }
  502.  
  503.     for(int i = 1; i < 8; i++)
  504.     {
  505.         if((!wcscmp(tabla.polje[y + i][x].figura, PRAZNO) || (!wcscmp(tabla.polje[y + i][x].figura, KRALJ) && tabla.polje[y + i][x].bojaFigure == CRNO)) && JelUnutarTable(x, y + i));
  506.         else if((!wcscmp(tabla.polje[y + i][x].figura, TOP) || !wcscmp(tabla.polje[y + i][x].figura, KRALJICA)) && tabla.polje[y + i][x].bojaFigure == BELO && JelUnutarTable(x, y + i))
  507.             return 1;
  508.         else
  509.             break;
  510.     }
  511.  
  512.     for(int i = 1; i < 8; i++)
  513.     {
  514.         if((!wcscmp(tabla.polje[y - i][x - i].figura, PRAZNO) || (!wcscmp(tabla.polje[y - i][x - i].figura, KRALJ) && tabla.polje[y - i][x - i].bojaFigure == CRNO)) && JelUnutarTable(x - i, y - i));
  515.         else if((!wcscmp(tabla.polje[y - i][x - i].figura, LOVAC) || !wcscmp(tabla.polje[y - i][x - i].figura, KRALJICA)) && tabla.polje[y - i][x - i].bojaFigure == BELO && JelUnutarTable(x - i, y - i))
  516.             return 1;
  517.         else
  518.             break;
  519.     }
  520.  
  521.     for(int i = 1; i < 8; i++)
  522.     {
  523.         if((!wcscmp(tabla.polje[y - i][x + i].figura, PRAZNO) || (!wcscmp(tabla.polje[y - i][x + i].figura, KRALJ) && tabla.polje[y - i][x + i].bojaFigure == CRNO)) && JelUnutarTable(x + i, y - i));
  524.         else if((!wcscmp(tabla.polje[y - i][x + i].figura, LOVAC) || !wcscmp(tabla.polje[y - i][x + i].figura, KRALJICA)) && tabla.polje[y - i][x + i].bojaFigure == BELO && JelUnutarTable(x + i, y - i))
  525.             return 1;
  526.         else
  527.             break;
  528.     }
  529.  
  530.     for(int i = 1; i < 8; i++)
  531.     {
  532.         if((!wcscmp(tabla.polje[y + i][x - i].figura, PRAZNO) || (!wcscmp(tabla.polje[y + i][x - i].figura, KRALJ) && tabla.polje[y + i][x - i].bojaFigure == CRNO)) && JelUnutarTable(x - i, y + i));
  533.         else if((!wcscmp(tabla.polje[y + i][x - i].figura, LOVAC) || !wcscmp(tabla.polje[y + i][x - i].figura, KRALJICA)) && tabla.polje[y + i][x - i].bojaFigure == BELO && JelUnutarTable(x - i, y + i))
  534.             return 1;
  535.         else
  536.             break;
  537.     }
  538.  
  539.     for(int i = 1; i < 8; i++)
  540.     {
  541.         if((!wcscmp(tabla.polje[y + i][x + i].figura, PRAZNO) || (!wcscmp(tabla.polje[y + i][x + i].figura, KRALJ) && tabla.polje[y + i][x + i].bojaFigure == CRNO)) && JelUnutarTable(x + i, y + i));
  542.         else if((!wcscmp(tabla.polje[y + i][x + i].figura, LOVAC) || !wcscmp(tabla.polje[y + i][x + i].figura, KRALJICA)) && tabla.polje[y + i][x + i].bojaFigure == BELO && JelUnutarTable(x + i, y + i))
  543.             return 1;
  544.         else
  545.             break;
  546.     }
  547.  
  548.     if(!wcscmp(tabla.polje[y][x - 1].figura, KRALJ) && tabla.polje[y][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y))
  549.         return 1;
  550.  
  551.     if(!wcscmp(tabla.polje[y][x + 1].figura, KRALJ) && tabla.polje[y][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y))
  552.         return 1;
  553.  
  554.     if(!wcscmp(tabla.polje[y - 1][x].figura, KRALJ) && tabla.polje[y - 1][x].bojaFigure == BELO && JelUnutarTable(x, y - 1))
  555.         return 1;
  556.  
  557.     if(!wcscmp(tabla.polje[y + 1][x].figura, KRALJ) && tabla.polje[y + 1][x].bojaFigure == BELO && JelUnutarTable(x, y + 1))
  558.         return 1;
  559.  
  560.     if(!wcscmp(tabla.polje[y - 1][x - 1].figura, KRALJ) && tabla.polje[y - 1][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y - 1))
  561.         return 1;
  562.  
  563.     if(!wcscmp(tabla.polje[y - 1][x + 1].figura, KRALJ) && tabla.polje[y - 1][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y - 1))
  564.         return 1;
  565.  
  566.     if(!wcscmp(tabla.polje[y + 1][x - 1].figura, KRALJ) && tabla.polje[y + 1][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y + 1))
  567.         return 1;
  568.  
  569.     if(!wcscmp(tabla.polje[y + 1][x + 1].figura, KRALJ) && tabla.polje[y + 1][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y + 1))
  570.         return 1;
  571.  
  572.     return 0;
  573. }
  574.  
  575. short PostaviKralja(Tabla &tabla, int x, int y)
  576. {
  577.     short ret = 0;
  578.  
  579.     tabla.polje[y][x].stanjePolja = IZABRANO;
  580.  
  581.     if(tabla.polje[y][x].bojaFigure == BELO)
  582.     {
  583.         if(!wcscmp(tabla.polje[y - 1][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y - 1) && !JelSahBeli(tabla, -1, -1))
  584.         {
  585.             wcscpy(tabla.polje[y - 1][x - 1].figura, TACKA);
  586.             tabla.polje[y - 1][x - 1].bojaFigure = ZELENO;
  587.             ret = 1;
  588.         }
  589.         else if(wcscmp(tabla.polje[y - 1][x - 1].figura, PRAZNO) && tabla.polje[y - 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y - 1) && !JelSahBeli(tabla, -1, -1))
  590.         {
  591.             tabla.polje[y - 1][x - 1].stanjePolja = NAPADNUTO;
  592.             ret = 1;
  593.         }
  594.  
  595.         if(!wcscmp(tabla.polje[y - 1][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y - 1) && !JelSahBeli(tabla, 1, -1))
  596.         {
  597.             wcscpy(tabla.polje[y - 1][x + 1].figura, TACKA);
  598.             tabla.polje[y - 1][x + 1].bojaFigure = ZELENO;
  599.             ret = 1;
  600.         }
  601.         else if(wcscmp(tabla.polje[y - 1][x + 1].figura, PRAZNO) && tabla.polje[y - 1][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y - 1) && !JelSahBeli(tabla, 1, -1))
  602.         {
  603.             tabla.polje[y - 1][x + 1].stanjePolja = NAPADNUTO;
  604.             ret = 1;
  605.         }
  606.  
  607.         if(!wcscmp(tabla.polje[y + 1][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y + 1) && !JelSahBeli(tabla, -1, 1))
  608.         {
  609.             wcscpy(tabla.polje[y + 1][x - 1].figura, TACKA);
  610.             tabla.polje[y + 1][x - 1].bojaFigure = ZELENO;
  611.             ret = 1;
  612.         }
  613.         else if(wcscmp(tabla.polje[y + 1][x - 1].figura, PRAZNO) && tabla.polje[y + 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y + 1) && !JelSahBeli(tabla, -1, 1))
  614.         {
  615.             tabla.polje[y + 1][x - 1].stanjePolja = NAPADNUTO;
  616.             ret = 1;
  617.         }
  618.  
  619.         if(!wcscmp(tabla.polje[y + 1][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y + 1) && !JelSahBeli(tabla, 1, 1))
  620.         {
  621.             wcscpy(tabla.polje[y + 1][x + 1].figura, TACKA);
  622.             tabla.polje[y + 1][x + 1].bojaFigure = ZELENO;
  623.             ret = 1;
  624.         }
  625.         else if(wcscmp(tabla.polje[y + 1][x + 1].figura, PRAZNO) && tabla.polje[y + 1][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y + 1) && !JelSahBeli(tabla, 1, 1))
  626.         {
  627.             tabla.polje[y + 1][x + 1].stanjePolja = NAPADNUTO;
  628.             ret = 1;
  629.         }
  630.  
  631.         if(!wcscmp(tabla.polje[y][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y) && !JelSahBeli(tabla, 1, 0))
  632.         {
  633.             wcscpy(tabla.polje[y][x + 1].figura, TACKA);
  634.             tabla.polje[y][x + 1].bojaFigure = ZELENO;
  635.             ret = 1;
  636.         }
  637.         else if(wcscmp(tabla.polje[y][x + 1].figura, PRAZNO) && tabla.polje[y][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y) && !JelSahBeli(tabla, 1, 0))
  638.         {
  639.             tabla.polje[y][x + 1].stanjePolja = NAPADNUTO;
  640.             ret = 1;
  641.         }
  642.  
  643.         if(!wcscmp(tabla.polje[y + 1][x].figura, PRAZNO) && JelUnutarTable(x, y + 1) && !JelSahBeli(tabla, 0, 1))
  644.         {
  645.             wcscpy(tabla.polje[y + 1][x].figura, TACKA);
  646.             tabla.polje[y + 1][x].bojaFigure = ZELENO;
  647.             ret = 1;
  648.         }
  649.         else if(wcscmp(tabla.polje[y + 1][x].figura, PRAZNO) && tabla.polje[y + 1][x].bojaFigure == CRNO && JelUnutarTable(x, y + 1) && !JelSahBeli(tabla, 0, 1))
  650.         {
  651.             tabla.polje[y + 1][x].stanjePolja = NAPADNUTO;
  652.             ret = 1;
  653.         }
  654.  
  655.         if(!wcscmp(tabla.polje[y][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y) && !JelSahBeli(tabla, -1, 0))
  656.         {
  657.             wcscpy(tabla.polje[y][x - 1].figura, TACKA);
  658.             tabla.polje[y][x - 1].bojaFigure = ZELENO;
  659.             ret = 1;
  660.         }
  661.         else if(wcscmp(tabla.polje[y][x - 1].figura, PRAZNO) && tabla.polje[y][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y) && !JelSahBeli(tabla, -1, 0))
  662.         {
  663.             tabla.polje[y][x - 1].stanjePolja = NAPADNUTO;
  664.             ret = 1;
  665.         }
  666.  
  667.         if(!wcscmp(tabla.polje[y - 1][x].figura, PRAZNO) && JelUnutarTable(x, y - 1) && !JelSahBeli(tabla, 0, -1))
  668.         {
  669.             wcscpy(tabla.polje[y - 1][x].figura, TACKA);
  670.             tabla.polje[y - 1][x].bojaFigure = ZELENO;
  671.             ret = 1;
  672.         }
  673.         else if(wcscmp(tabla.polje[y - 1][x].figura, PRAZNO) && tabla.polje[y - 1][x].bojaFigure == CRNO && JelUnutarTable(x, y - 1) && !JelSahBeli(tabla, 0, -1))
  674.         {
  675.             tabla.polje[y - 1][x].stanjePolja = NAPADNUTO;
  676.             ret = 1;
  677.         }
  678.  
  679.         if(tabla.malarbeli == UKLJUCENO && !wcscmp(tabla.polje[7][5].figura, TACKA) && !wcscmp(tabla.polje[7][6].figura, PRAZNO) && !JelSahBeli(tabla, 0, 0) && !JelSahBeli(tabla, 1, 0) && !JelSahBeli(tabla, 2, 0))
  680.         {
  681.             wcscpy(tabla.polje[7][6].figura, TACKA);
  682.             tabla.polje[7][6].bojaFigure = ZELENO;
  683.             ret = 1;
  684.         }
  685.  
  686.         if(tabla.velikarbeli == UKLJUCENO && !wcscmp(tabla.polje[7][3].figura, TACKA) && !wcscmp(tabla.polje[7][2].figura, PRAZNO) && !wcscmp(tabla.polje[7][1].figura, PRAZNO) && !JelSahBeli(tabla, 0, 0) && !JelSahBeli(tabla, -1, 0) && !JelSahBeli(tabla, -2, 0) && !JelSahBeli(tabla, -3, 0))
  687.         {
  688.             wcscpy(tabla.polje[7][1].figura, TACKA);
  689.             tabla.polje[7][1].bojaFigure = ZELENO;
  690.             ret = 1;
  691.         }
  692.  
  693.     }
  694.     else
  695.     {
  696.         if(!wcscmp(tabla.polje[y - 1][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y - 1) && !JelSahCrni(tabla, -1, -1))
  697.         {
  698.             wcscpy(tabla.polje[y - 1][x - 1].figura, TACKA);
  699.             tabla.polje[y - 1][x - 1].bojaFigure = ZELENO;
  700.             ret = 1;
  701.         }
  702.         else if(wcscmp(tabla.polje[y - 1][x - 1].figura, PRAZNO) && tabla.polje[y - 1][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y - 1) && !JelSahCrni(tabla, -1, -1))
  703.         {
  704.             tabla.polje[y - 1][x - 1].stanjePolja = NAPADNUTO;
  705.             ret = 1;
  706.         }
  707.  
  708.         if(!wcscmp(tabla.polje[y - 1][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y - 1) && !JelSahCrni(tabla, 1, -1))
  709.         {
  710.             wcscpy(tabla.polje[y - 1][x + 1].figura, TACKA);
  711.             tabla.polje[y - 1][x + 1].bojaFigure = ZELENO;
  712.             ret = 1;
  713.         }
  714.         else if(wcscmp(tabla.polje[y - 1][x + 1].figura, PRAZNO) && tabla.polje[y - 1][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y - 1) && !JelSahCrni(tabla, 1, -1))
  715.         {
  716.             tabla.polje[y - 1][x + 1].stanjePolja = NAPADNUTO;
  717.             ret = 1;
  718.         }
  719.  
  720.         if(!wcscmp(tabla.polje[y + 1][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y + 1) && !JelSahCrni(tabla, -1, 1))
  721.         {
  722.             wcscpy(tabla.polje[y + 1][x - 1].figura, TACKA);
  723.             tabla.polje[y + 1][x - 1].bojaFigure = ZELENO;
  724.         }
  725.         else if(wcscmp(tabla.polje[y + 1][x - 1].figura, PRAZNO) && tabla.polje[y + 1][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y + 1) && !JelSahCrni(tabla, -1, 1))
  726.         {
  727.             tabla.polje[y + 1][x - 1].stanjePolja = NAPADNUTO;
  728.             ret = 1;
  729.         }
  730.  
  731.         if(!wcscmp(tabla.polje[y + 1][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y + 1) && !JelSahCrni(tabla, 1, 1))
  732.         {
  733.             wcscpy(tabla.polje[y + 1][x + 1].figura, TACKA);
  734.             tabla.polje[y + 1][x + 1].bojaFigure = ZELENO;
  735.             ret = 1;
  736.         }
  737.         else if(wcscmp(tabla.polje[y + 1][x + 1].figura, PRAZNO) && tabla.polje[y + 1][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y + 1) && !JelSahCrni(tabla, 1, 1))
  738.         {
  739.             tabla.polje[y + 1][x + 1].stanjePolja = NAPADNUTO;
  740.             ret = 1;
  741.         }
  742.  
  743.         if(!wcscmp(tabla.polje[y][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y) && !JelSahCrni(tabla, 1, 0))
  744.         {
  745.             wcscpy(tabla.polje[y][x + 1].figura, TACKA);
  746.             tabla.polje[y][x + 1].bojaFigure = ZELENO;
  747.             ret = 1;
  748.         }
  749.         else if(wcscmp(tabla.polje[y][x + 1].figura, PRAZNO) && tabla.polje[y][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y) && !JelSahCrni(tabla, 1, 0))
  750.         {
  751.             tabla.polje[y][x + 1].stanjePolja = NAPADNUTO;
  752.             ret = 1;
  753.         }
  754.  
  755.         if(!wcscmp(tabla.polje[y + 1][x].figura, PRAZNO) && JelUnutarTable(x, y + 1) && !JelSahCrni(tabla, 0, 1))
  756.         {
  757.             wcscpy(tabla.polje[y + 1][x].figura, TACKA);
  758.             tabla.polje[y + 1][x].bojaFigure = ZELENO;
  759.             ret = 1;
  760.         }
  761.         else if(wcscmp(tabla.polje[y + 1][x].figura, PRAZNO) && tabla.polje[y + 1][x].bojaFigure == BELO && JelUnutarTable(x, y + 1) && !JelSahCrni(tabla, 0, 1))
  762.         {
  763.             tabla.polje[y + 1][x].stanjePolja = NAPADNUTO;
  764.             ret = 1;
  765.         }
  766.  
  767.         if(!wcscmp(tabla.polje[y][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y) && !JelSahCrni(tabla, -1, 0))
  768.         {
  769.             wcscpy(tabla.polje[y][x - 1].figura, TACKA);
  770.             tabla.polje[y][x - 1].bojaFigure = ZELENO;
  771.             ret = 1;
  772.         }
  773.         else if(wcscmp(tabla.polje[y][x - 1].figura, PRAZNO) && tabla.polje[y][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y) && !JelSahCrni(tabla, -1, 0))
  774.         {
  775.             tabla.polje[y][x - 1].stanjePolja = NAPADNUTO;
  776.             ret = 1;
  777.         }
  778.  
  779.         if(!wcscmp(tabla.polje[y - 1][x].figura, PRAZNO) && JelUnutarTable(x, y - 1) && !JelSahCrni(tabla, 0, -1))
  780.         {
  781.             wcscpy(tabla.polje[y - 1][x].figura, TACKA);
  782.             tabla.polje[y - 1][x].bojaFigure = ZELENO;
  783.             ret = 1;
  784.         }
  785.         else if(wcscmp(tabla.polje[y - 1][x].figura, PRAZNO) && tabla.polje[y - 1][x].bojaFigure == BELO && JelUnutarTable(x, y - 1) && !JelSahCrni(tabla, 0, -1))
  786.         {
  787.             tabla.polje[y - 1][x].stanjePolja = NAPADNUTO;
  788.             ret = 1;
  789.         }
  790.  
  791.         if(tabla.malarcrni == UKLJUCENO && !wcscmp(tabla.polje[0][5].figura, TACKA) && !wcscmp(tabla.polje[0][6].figura, PRAZNO) && !JelSahCrni(tabla, 0, 0) && !JelSahCrni(tabla, 1, 0) && !JelSahCrni(tabla, 2, 0))
  792.         {
  793.             wcscpy(tabla.polje[0][6].figura, TACKA);
  794.             tabla.polje[0][6].bojaFigure = ZELENO;
  795.             ret = 1;
  796.         }
  797.  
  798.         if(tabla.velikarcrni == UKLJUCENO && !wcscmp(tabla.polje[0][3].figura, TACKA) && !wcscmp(tabla.polje[0][2].figura, PRAZNO) && !wcscmp(tabla.polje[0][1].figura, PRAZNO) && !JelSahCrni(tabla, 0, 0) && !JelSahCrni(tabla, -1, 0) && !JelSahCrni(tabla, -2, 0) && !JelSahCrni(tabla, -3, 0))
  799.         {
  800.             wcscpy(tabla.polje[0][1].figura, TACKA);
  801.             tabla.polje[0][1].bojaFigure = ZELENO;
  802.             ret = 1;
  803.         }
  804.     }
  805.  
  806.     return ret;
  807. }
  808.  
  809.  
  810. short PostaviPijuna(Tabla &tabla, int x, int y)
  811. {
  812.     short ret = 0;
  813.  
  814.     tabla.polje[y][x].stanjePolja = IZABRANO;
  815.  
  816.     if(tabla.polje[y][x].bojaFigure == BELO)
  817.     {
  818.         if(!wcscmp(tabla.polje[y - 1][x].figura, PRAZNO) && JelUnutarTable(x, y - 1) && !JelSahBeli(StaviFiguruNaXY(tabla, x, y - 1), 0, 0))
  819.         {
  820.             wcscpy(tabla.polje[y - 1][x].figura, TACKA);
  821.             tabla.polje[y - 1][x].bojaFigure = ZELENO;
  822.             ret = 1;
  823.         }
  824.  
  825.         if(y == 6 && !wcscmp(tabla.polje[y - 2][x].figura, PRAZNO) && !wcscmp(tabla.polje[y - 1][x].figura, TACKA) && JelUnutarTable(x, y - 2) && !JelSahBeli(StaviFiguruNaXY(tabla, x, y - 2), 0, 0))
  826.         {
  827.             wcscpy(tabla.polje[y - 2][x].figura, TACKA);
  828.             tabla.polje[y - 2][x].bojaFigure = ZELENO;
  829.             ret = 1;
  830.         }
  831.  
  832.         if(wcscmp(tabla.polje[y - 1][x + 1].figura, PRAZNO) && tabla.polje[y - 1][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y - 1) && !JelSahBeli(StaviFiguruNaXY(tabla, x + 1, y - 1), 0, 0))
  833.         {
  834.             tabla.polje[y - 1][x + 1].stanjePolja = NAPADNUTO;
  835.             ret = 1;
  836.         }
  837.  
  838.         if(wcscmp(tabla.polje[y - 1][x - 1].figura, PRAZNO) && tabla.polje[y - 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y - 1) && !JelSahBeli(StaviFiguruNaXY(tabla, x - 1, y - 1), 0, 0))
  839.         {
  840.             tabla.polje[y - 1][x - 1].stanjePolja = NAPADNUTO;
  841.             ret = 1;
  842.         }
  843.  
  844.         if(!wcscmp(tabla.polje[y][x + 1].figura, PIJUN) && tabla.polje[y][x + 1].bojaFigure == CRNO && tabla.polje[y][x + 1].anpasan == UKLJUCENO && JelUnutarTable(x + 1, y - 1) && !JelSahBeli(StaviFiguruNaXY(tabla, x + 1, y - 1), 0, 0))
  845.         {
  846.             tabla.polje[y - 1][x + 1].stanjePolja = NAPADNUTO;
  847.             ret = 1;
  848.         }
  849.  
  850.         if(!wcscmp(tabla.polje[y][x - 1].figura, PIJUN) && tabla.polje[y][x - 1].bojaFigure == CRNO && tabla.polje[y][x - 1].anpasan == UKLJUCENO && JelUnutarTable(x - 1, y - 1) && !JelSahBeli(StaviFiguruNaXY(tabla, x - 1, y - 1), 0, 0))
  851.         {
  852.             tabla.polje[y - 1][x - 1].stanjePolja = NAPADNUTO;
  853.             ret = 1;
  854.         }
  855.     }
  856.     else
  857.     {
  858.         if(!wcscmp(tabla.polje[y + 1][x].figura, PRAZNO) && JelUnutarTable(x, y + 1) && !JelSahCrni(StaviFiguruNaXY(tabla, x, y + 1), 0, 0))
  859.         {
  860.             wcscpy(tabla.polje[y + 1][x].figura, TACKA);
  861.             tabla.polje[y + 1][x].bojaFigure = ZELENO;
  862.             ret = 1;
  863.         }
  864.  
  865.         if(y == 1 && !wcscmp(tabla.polje[y + 2][x].figura, PRAZNO) && !wcscmp(tabla.polje[y + 1][x].figura, TACKA) && JelUnutarTable(x, y + 2) && !JelSahCrni(StaviFiguruNaXY(tabla, x, y + 2), 0, 0))
  866.         {
  867.             wcscpy(tabla.polje[y + 2][x].figura, TACKA);
  868.             tabla.polje[y + 2][x].bojaFigure = ZELENO;
  869.             ret = 1;
  870.         }
  871.  
  872.         if(wcscmp(tabla.polje[y + 1][x + 1].figura, PRAZNO) && tabla.polje[y + 1][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y + 1) && !JelSahCrni(StaviFiguruNaXY(tabla, x + 1, y + 1), 0, 0))
  873.         {
  874.             tabla.polje[y + 1][x + 1].stanjePolja = NAPADNUTO;
  875.             ret = 1;
  876.         }
  877.  
  878.         if(wcscmp(tabla.polje[y + 1][x - 1].figura, PRAZNO) && tabla.polje[y + 1][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y + 1) && !JelSahCrni(StaviFiguruNaXY(tabla, x - 1, y + 1), 0, 0))
  879.         {
  880.             tabla.polje[y + 1][x - 1].stanjePolja = NAPADNUTO;
  881.             ret = 1;
  882.         }
  883.  
  884.         if(!wcscmp(tabla.polje[y][x - 1].figura, PIJUN) && tabla.polje[y][x - 1].bojaFigure == BELO && tabla.polje[y][x - 1].anpasan == UKLJUCENO && JelUnutarTable(x - 1, y + 1) && !JelSahCrni(StaviFiguruNaXY(tabla, x - 1, y + 1), 0, 0))
  885.         {
  886.             tabla.polje[y + 1][x - 1].stanjePolja = NAPADNUTO;
  887.             ret = 1;
  888.         }
  889.  
  890.         if(!wcscmp(tabla.polje[y][x + 1].figura, PIJUN) && tabla.polje[y][x + 1].bojaFigure == BELO && tabla.polje[y][x + 1].anpasan == UKLJUCENO && JelUnutarTable(x + 1, y + 1) && !JelSahCrni(StaviFiguruNaXY(tabla, x + 1, y + 1), 0, 0))
  891.         {
  892.             tabla.polje[y + 1][x + 1].stanjePolja = NAPADNUTO;
  893.             ret = 1;
  894.         }
  895.     }
  896.  
  897.     return ret;
  898. }
  899.  
  900. short PostaviKonja(Tabla &tabla, int x, int y)
  901. {
  902.     short ret = 0;
  903.     tabla.polje[y][x].stanjePolja = IZABRANO;
  904.  
  905.     if(!wcscmp(tabla.polje[y - 2][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y - 2) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - 1, y - 2), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - 1, y - 2), 0, 0))))
  906.     {
  907.         wcscpy(tabla.polje[y - 2][x - 1].figura, TACKA);
  908.         tabla.polje[y - 2][x - 1].bojaFigure = ZELENO;
  909.         ret = 1;
  910.     }
  911.     else if(wcscmp(tabla.polje[y - 2][x - 1].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - 2][x - 1].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - 2][x - 1].bojaFigure == BELO)) && JelUnutarTable(x - 1, y - 2)  && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - 1, y - 2), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - 1, y - 2), 0, 0))))
  912.     {
  913.         tabla.polje[y - 2][x - 1].stanjePolja = NAPADNUTO;
  914.         ret = 1;
  915.     }
  916.  
  917.     if(!wcscmp(tabla.polje[y - 2][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y - 2) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + 1, y - 2), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + 1, y - 2), 0, 0))))
  918.     {
  919.         wcscpy(tabla.polje[y - 2][x + 1].figura, TACKA);
  920.         tabla.polje[y - 2][x + 1].bojaFigure = ZELENO;
  921.         ret = 1;
  922.     }
  923.     else if(wcscmp(tabla.polje[y - 2][x + 1].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - 2][x + 1].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - 2][x + 1].bojaFigure == BELO)) && JelUnutarTable(x + 1, y - 2)  && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + 1, y - 2), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + 1, y - 2), 0, 0))))
  924.     {
  925.         tabla.polje[y - 2][x + 1].stanjePolja = NAPADNUTO;
  926.         ret = 1;
  927.     }
  928.  
  929.     if(!wcscmp(tabla.polje[y - 1][x + 2].figura, PRAZNO) && JelUnutarTable(x + 2, y - 1) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + 2, y - 1), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + 2, y - 1), 0, 0))))
  930.     {
  931.         wcscpy(tabla.polje[y - 1][x + 2].figura, TACKA);
  932.         tabla.polje[y - 1][x + 2].bojaFigure = ZELENO;
  933.         ret = 1;
  934.     }
  935.     else if(wcscmp(tabla.polje[y - 1][x + 2].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - 1][x + 2].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - 1][x + 2].bojaFigure == BELO)) && JelUnutarTable(x + 2, y - 1)  && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + 2, y - 1), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + 2, y - 1), 0, 0))))
  936.     {
  937.         tabla.polje[y - 1][x + 2].stanjePolja = NAPADNUTO;
  938.         ret = 1;
  939.     }
  940.  
  941.     if(!wcscmp(tabla.polje[y + 1][x + 2].figura, PRAZNO) && JelUnutarTable(x + 2, y + 1) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + 2, y + 1), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + 2, y + 1), 0, 0))))
  942.     {
  943.         wcscpy(tabla.polje[y + 1][x + 2].figura, TACKA);
  944.         tabla.polje[y + 1][x + 2].bojaFigure = ZELENO;
  945.         ret = 1;
  946.     }
  947.     else if(wcscmp(tabla.polje[y + 1][x + 2].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + 1][x + 2].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + 1][x + 2].bojaFigure == BELO)) && JelUnutarTable(x + 2, y + 1) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + 2, y + 1), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + 2, y + 1), 0, 0))))
  948.     {
  949.         tabla.polje[y + 1][x + 2].stanjePolja = NAPADNUTO;
  950.         ret = 1;
  951.     }
  952.  
  953.     if(!wcscmp(tabla.polje[y + 2][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y + 2) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + 1, y + 2), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + 1, y + 2), 0, 0))))
  954.     {
  955.         wcscpy(tabla.polje[y + 2][x + 1].figura, TACKA);
  956.         tabla.polje[y + 2][x + 1].bojaFigure = ZELENO;
  957.         ret = 1;
  958.     }
  959.     else if(wcscmp(tabla.polje[y + 2][x + 1].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + 2][x + 1].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + 2][x + 1].bojaFigure == BELO)) && JelUnutarTable(x + 1, y + 2) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + 1, y + 2), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + 1, y + 2), 0, 0))))
  960.     {
  961.         tabla.polje[y + 2][x + 1].stanjePolja = NAPADNUTO;
  962.         ret = 1;
  963.     }
  964.  
  965.     if(!wcscmp(tabla.polje[y + 2][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y + 2) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - 1, y + 2), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - 1, y + 2), 0, 0))))
  966.     {
  967.         wcscpy(tabla.polje[y + 2][x - 1].figura, TACKA);
  968.         tabla.polje[y + 2][x - 1].bojaFigure = ZELENO;
  969.         ret = 1;
  970.     }
  971.     else if(wcscmp(tabla.polje[y + 2][x - 1].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + 2][x - 1].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + 2][x - 1].bojaFigure == BELO)) && JelUnutarTable(x - 1, y + 2) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - 1, y + 2), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - 1, y + 2), 0, 0))))
  972.     {
  973.         tabla.polje[y + 2][x - 1].stanjePolja = NAPADNUTO;
  974.         ret = 1;
  975.     }
  976.  
  977.     if(!wcscmp(tabla.polje[y + 1][x - 2].figura, PRAZNO) && JelUnutarTable(x - 2, y + 1) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - 2, y + 1), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - 2, y + 1), 0, 0))))
  978.     {
  979.         wcscpy(tabla.polje[y + 1][x - 2].figura, TACKA);
  980.         tabla.polje[y + 1][x - 2].bojaFigure = ZELENO;
  981.         ret = 1;
  982.     }
  983.     else if(wcscmp(tabla.polje[y + 1][x - 2].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + 1][x - 2].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + 1][x - 2].bojaFigure == BELO)) && JelUnutarTable(x - 2, y + 1) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - 2, y + 1), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - 2, y + 1), 0, 0))))
  984.     {
  985.         tabla.polje[y + 1][x - 2].stanjePolja = NAPADNUTO;
  986.         ret = 1;
  987.     }
  988.  
  989.     if(!wcscmp(tabla.polje[y - 1][x - 2].figura, PRAZNO) && JelUnutarTable(x - 2, y - 1) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - 2, y - 1), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - 2, y - 1), 0, 0))))
  990.     {
  991.         wcscpy(tabla.polje[y - 1][x - 2].figura, TACKA);
  992.         tabla.polje[y - 1][x - 2].bojaFigure = ZELENO;
  993.         ret = 1;
  994.     }
  995.     else if(wcscmp(tabla.polje[y - 1][x - 2].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - 1][x - 2].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - 1][x - 2].bojaFigure == BELO)) && JelUnutarTable(x - 2, y - 1)  && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - 2, y - 1), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - 2, y - 1), 0, 0))))
  996.     {
  997.         tabla.polje[y - 1][x - 2].stanjePolja = NAPADNUTO;
  998.         ret = 1;
  999.     }
  1000.  
  1001.     return ret;
  1002. }
  1003.  
  1004. short PostaviTopa(Tabla &tabla, int x, int y)
  1005. {
  1006.     short ret = 0;
  1007.  
  1008.     tabla.polje[y][x].stanjePolja = IZABRANO;
  1009.  
  1010.     for(int i = 1; i < 8; i++)
  1011.     {
  1012.         if(!wcscmp(tabla.polje[y][x - i].figura, PRAZNO) && JelUnutarTable(x - i, y) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - i, y), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - i, y), 0, 0))))
  1013.         {
  1014.             wcscpy(tabla.polje[y][x - i].figura, TACKA);
  1015.             tabla.polje[y][x - i].bojaFigure = ZELENO;
  1016.             ret = 1;
  1017.         }
  1018.         else if(wcscmp(tabla.polje[y][x - i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y][x - i].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y][x - i].bojaFigure == BELO)) && JelUnutarTable(x - i, y) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - i, y), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - i, y), 0, 0))))
  1019.         {
  1020.             tabla.polje[y][x - i].stanjePolja = NAPADNUTO;
  1021.             ret = 1;
  1022.             break;
  1023.         }
  1024.         else if(wcscmp(tabla.polje[y][x - i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y][x - i].bojaFigure == BELO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y][x - i].bojaFigure == CRNO)) && JelUnutarTable(x - i, y))
  1025.             break;
  1026.     }
  1027.  
  1028.     for(int i = 1; i < 8; i++)
  1029.     {
  1030.         if(!wcscmp(tabla.polje[y][x + i].figura, PRAZNO) && JelUnutarTable(x + i, y) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + i, y), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + i, y), 0, 0))))
  1031.         {
  1032.             wcscpy(tabla.polje[y][x + i].figura, TACKA);
  1033.             tabla.polje[y][x + i].bojaFigure = ZELENO;
  1034.             ret = 1;
  1035.         }
  1036.         else if(wcscmp(tabla.polje[y][x + i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y][x + i].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y][x + i].bojaFigure == BELO)) && JelUnutarTable(x + i, y) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + i, y), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + i, y), 0, 0))))
  1037.         {
  1038.             tabla.polje[y][x + i].stanjePolja = NAPADNUTO;
  1039.             ret = 1;
  1040.             break;
  1041.         }
  1042.         else if(wcscmp(tabla.polje[y][x + i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y][x + i].bojaFigure == BELO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y][x + i].bojaFigure == CRNO)) && JelUnutarTable(x + i, y))
  1043.             break;
  1044.     }
  1045.  
  1046.     for(int i = 1; i < 8; i++)
  1047.     {
  1048.         if(!wcscmp(tabla.polje[y - i][x].figura, PRAZNO) && JelUnutarTable(x, y - i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x, y - i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x, y - i), 0, 0))))
  1049.         {
  1050.             wcscpy(tabla.polje[y - i][x].figura, TACKA);
  1051.             tabla.polje[y - i][x].bojaFigure = ZELENO;
  1052.             ret = 1;
  1053.         }
  1054.         else if(wcscmp(tabla.polje[y - i][x].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - i][x].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - i][x].bojaFigure == BELO)) && JelUnutarTable(x, y - i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x, y - i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x, y - i), 0, 0))))
  1055.         {
  1056.             tabla.polje[y - i][x].stanjePolja = NAPADNUTO;
  1057.             ret = 1;
  1058.             break;
  1059.         }
  1060.         else if(wcscmp(tabla.polje[y - i][x].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - i][x].bojaFigure == BELO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - i][x].bojaFigure == CRNO)) && JelUnutarTable(x, y - i))
  1061.             break;
  1062.     }
  1063.  
  1064.     for(int i = 1; i < 8; i++)
  1065.     {
  1066.         if(!wcscmp(tabla.polje[y + i][x].figura, PRAZNO) && JelUnutarTable(x, y + i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x, y + i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x, y + i), 0, 0))))
  1067.         {
  1068.             wcscpy(tabla.polje[y + i][x].figura, TACKA);
  1069.             tabla.polje[y + i][x].bojaFigure = ZELENO;
  1070.             ret = 1;
  1071.         }
  1072.         else if(wcscmp(tabla.polje[y + i][x].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + i][x].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + i][x].bojaFigure == BELO)) && JelUnutarTable(x, y + i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x, y + i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x, y + i), 0, 0))))
  1073.         {
  1074.             tabla.polje[y + i][x].stanjePolja = NAPADNUTO;
  1075.             ret = 1;
  1076.             break;
  1077.         }
  1078.         else if(wcscmp(tabla.polje[y + i][x].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + i][x].bojaFigure == BELO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + i][x].bojaFigure == CRNO)) && JelUnutarTable(x, y + i))
  1079.             break;
  1080.     }
  1081.  
  1082.     return ret;
  1083. }
  1084.  
  1085. short PostaviLovca(Tabla &tabla, int x, int y)
  1086. {
  1087.     short ret = 0;
  1088.  
  1089.     tabla.polje[y][x].stanjePolja = IZABRANO;
  1090.  
  1091.     for(int i = 1; i < 8; i++)
  1092.     {
  1093.         if(!wcscmp(tabla.polje[y - i][x - i].figura, PRAZNO) && JelUnutarTable(x - i, y - i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - i, y - i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - i, y - i), 0, 0))))
  1094.         {
  1095.             wcscpy(tabla.polje[y - i][x - i].figura, TACKA);
  1096.             tabla.polje[y - i][x - i].bojaFigure = ZELENO;
  1097.             ret = 1;
  1098.         }
  1099.         else if(wcscmp(tabla.polje[y - i][x - i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - i][x - i].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - i][x - i].bojaFigure == BELO)) && JelUnutarTable(x - i, y - i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - i, y - i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - i, y - i), 0, 0))))
  1100.         {
  1101.             tabla.polje[y - i][x - i].stanjePolja = NAPADNUTO;
  1102.             ret = 1;
  1103.             break;
  1104.         }
  1105.         else if(wcscmp(tabla.polje[y - i][x - i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - i][x - i].bojaFigure == BELO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - i][x - i].bojaFigure == CRNO)) && JelUnutarTable(x - i, y - i))
  1106.             break;
  1107.     }
  1108.  
  1109.     for(int i = 1; i < 8; i++)
  1110.     {
  1111.         if(!wcscmp(tabla.polje[y - i][x + i].figura, PRAZNO) && JelUnutarTable(x + i, y - i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + i, y - i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + i, y - i), 0, 0))))
  1112.         {
  1113.             wcscpy(tabla.polje[y - i][x + i].figura, TACKA);
  1114.             tabla.polje[y - i][x + i].bojaFigure = ZELENO;
  1115.             ret = 1;
  1116.         }
  1117.         else if(wcscmp(tabla.polje[y - i][x + i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - i][x + i].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - i][x + i].bojaFigure == BELO)) && JelUnutarTable(x + i, y - i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + i, y - i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + i, y - i), 0, 0))))
  1118.         {
  1119.             tabla.polje[y - i][x + i].stanjePolja = NAPADNUTO;
  1120.             ret = 1;
  1121.             break;
  1122.         }
  1123.         else if(wcscmp(tabla.polje[y - i][x + i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y - i][x + i].bojaFigure == BELO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y - i][x + i].bojaFigure == CRNO)) && JelUnutarTable(x + i, y - i))
  1124.             break;
  1125.     }
  1126.  
  1127.     for(int i = 1; i < 8; i++)
  1128.     {
  1129.         if(!wcscmp(tabla.polje[y + i][x - i].figura, PRAZNO) && JelUnutarTable(x - i, y + i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - i, y + i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - i, y + i), 0, 0))))
  1130.         {
  1131.             wcscpy(tabla.polje[y + i][x - i].figura, TACKA);
  1132.             tabla.polje[y + i][x - i].bojaFigure = ZELENO;
  1133.             ret = 1;
  1134.         }
  1135.         else if(wcscmp(tabla.polje[y + i][x - i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + i][x - i].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + i][x - i].bojaFigure == BELO)) && JelUnutarTable(x - i, y + i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x - i, y + i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x - i, y + i), 0, 0))))
  1136.         {
  1137.             tabla.polje[y + i][x - i].stanjePolja = NAPADNUTO;
  1138.             ret = 1;
  1139.             break;
  1140.         }
  1141.         else if(wcscmp(tabla.polje[y + i][x - i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + i][x - i].bojaFigure == BELO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + i][x - i].bojaFigure == CRNO)) && JelUnutarTable(x - i, y + i))
  1142.             break;
  1143.     }
  1144.  
  1145.     for(int i = 1; i < 8; i++)
  1146.     {
  1147.         if(!wcscmp(tabla.polje[y + i][x +  i].figura, PRAZNO) && JelUnutarTable(x + i, y + i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + i, y + i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + i, y + i), 0, 0))))
  1148.         {
  1149.             wcscpy(tabla.polje[y + i][x + i].figura, TACKA);
  1150.             tabla.polje[y + i][x + i].bojaFigure = ZELENO;
  1151.             ret = 1;
  1152.         }
  1153.         else if(wcscmp(tabla.polje[y + i][x + i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + i][x + i].bojaFigure == CRNO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + i][x + i].bojaFigure == BELO)) && JelUnutarTable(x + i, y + i) && ((tabla.polje[y][x].bojaFigure == BELO && !JelSahBeli(StaviFiguruNaXY(tabla, x + i, y + i), 0, 0)) || (tabla.polje[y][x].bojaFigure == CRNO && !JelSahCrni(StaviFiguruNaXY(tabla, x + i, y + i), 0, 0))))
  1154.         {
  1155.             tabla.polje[y + i][x + i].stanjePolja = NAPADNUTO;
  1156.             ret = 1;
  1157.             break;
  1158.         }
  1159.         else if(wcscmp(tabla.polje[y + i][x + i].figura, PRAZNO) && ((tabla.polje[y][x].bojaFigure == BELO && tabla.polje[y + i][x + i].bojaFigure == BELO) || (tabla.polje[y][x].bojaFigure == CRNO && tabla.polje[y + i][x + i].bojaFigure == CRNO)) && JelUnutarTable(x + i, y + i))
  1160.             break;
  1161.     }
  1162.  
  1163.     return ret;
  1164. }
  1165.  
  1166. short PostaviKraljicu(Tabla &tabla, int x, int y)
  1167. {
  1168.     int ret = 0;
  1169.     ret += PostaviLovca(tabla, x, y);
  1170.     ret += PostaviTopa(tabla, x, y);
  1171.  
  1172.     if(ret != 0)
  1173.         ret = 1;
  1174.  
  1175.     return ret;
  1176. }
  1177.  
  1178. short JelMozeIgratiBeli(Tabla tabla)
  1179. {
  1180.     short ret = 0;
  1181.  
  1182.     for(int y = 0; y < 8; y++)
  1183.         for(int x = 0; x < 8; x++)
  1184.             if(tabla.polje[y][x].bojaFigure == BELO)
  1185.             {
  1186.                 if(!wcscmp(tabla.polje[y][x].figura, KRALJ))
  1187.                 {
  1188.                     ret += PostaviKralja(tabla, x, y);
  1189.  
  1190.                     NoviPotez(tabla);
  1191.                 }
  1192.                 else if(!wcscmp(tabla.polje[y][x].figura, PIJUN))
  1193.                 {
  1194.                     ret += PostaviPijuna(tabla, x, y);
  1195.  
  1196.                     NoviPotez(tabla);
  1197.                 }
  1198.                 else if(!wcscmp(tabla.polje[y][x].figura, KONJ))
  1199.                 {
  1200.                     ret += PostaviKonja(tabla, x, y);
  1201.  
  1202.                     NoviPotez(tabla);
  1203.                 }
  1204.                 else if(!wcscmp(tabla.polje[y][x].figura, TOP))
  1205.                 {
  1206.                     ret += PostaviTopa(tabla, x, y);
  1207.  
  1208.                     NoviPotez(tabla);
  1209.                 }
  1210.                 else if(!wcscmp(tabla.polje[y][x].figura, LOVAC))
  1211.                 {
  1212.                     ret += PostaviLovca(tabla, x, y);
  1213.  
  1214.                     NoviPotez(tabla);
  1215.                 }
  1216.                 else if(!wcscmp(tabla.polje[y][x].figura, KRALJICA))
  1217.                 {
  1218.                     ret += PostaviKraljicu(tabla, x, y);
  1219.  
  1220.                     NoviPotez(tabla);
  1221.                 }
  1222.             }
  1223.  
  1224.     if(ret != 0)
  1225.         ret = 1;
  1226.  
  1227.     return ret;
  1228. }
  1229.  
  1230. short JelMozeIgratiCrni(Tabla tabla)
  1231. {
  1232.     short ret = 0;
  1233.  
  1234.     for(int y = 0; y < 8; y++)
  1235.         for(int x = 0; x < 8; x++)
  1236.             if(tabla.polje[y][x].bojaFigure == CRNO)
  1237.             {
  1238.                 if(!wcscmp(tabla.polje[y][x].figura, KRALJ))
  1239.                 {
  1240.                     ret += PostaviKralja(tabla, x, y);
  1241.  
  1242.                     NoviPotez(tabla);
  1243.                 }
  1244.                 else if(!wcscmp(tabla.polje[y][x].figura, PIJUN))
  1245.                 {
  1246.                     ret += PostaviPijuna(tabla, x, y);
  1247.  
  1248.                     NoviPotez(tabla);
  1249.                 }
  1250.                 else if(!wcscmp(tabla.polje[y][x].figura, KONJ))
  1251.                 {
  1252.                     ret += PostaviKonja(tabla, x, y);
  1253.  
  1254.                     NoviPotez(tabla);
  1255.                 }
  1256.                 else if(!wcscmp(tabla.polje[y][x].figura, TOP))
  1257.                 {
  1258.                     ret += PostaviTopa(tabla, x, y);
  1259.  
  1260.                     NoviPotez(tabla);
  1261.                 }
  1262.                 else if(!wcscmp(tabla.polje[y][x].figura, LOVAC))
  1263.                 {
  1264.                     ret += PostaviLovca(tabla, x, y);
  1265.  
  1266.                     NoviPotez(tabla);
  1267.                 }
  1268.                 else if(!wcscmp(tabla.polje[y][x].figura, KRALJICA))
  1269.                 {
  1270.                     ret += PostaviKraljicu(tabla, x, y);
  1271.  
  1272.                     NoviPotez(tabla);
  1273.                 }
  1274.             }
  1275.  
  1276.     if(ret != 0)
  1277.         ret = 1;
  1278.  
  1279.     return ret;
  1280. }
  1281.  
  1282. short ZameniPijuna()
  1283. {
  1284.     int x, y, pom = 1, izb;
  1285.  
  1286.     HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
  1287.     _setmode(_fileno(stdout), _O_U8TEXT);
  1288.  
  1289.     if(boja == SVETLO)
  1290.         SetConsoleTextAttribute(console, 82);
  1291.     else if(boja == TAMNO)
  1292.         SetConsoleTextAttribute(console, 101);
  1293.     else if(boja == SIVO)
  1294.         SetConsoleTextAttribute(console, 152);
  1295.  
  1296.     gotoxy(8, 14);
  1297.     wprintf(KRALJICA);
  1298.     wprintf(L"    ");
  1299.     wprintf(TOP);
  1300.     wprintf(L"    ");
  1301.     wprintf(LOVAC);
  1302.     wprintf(L"    ");
  1303.     wprintf(KONJ);
  1304.  
  1305.     while(pom)
  1306.     {
  1307.         pom = 0;
  1308.         UcitajKlik(x, y);
  1309.  
  1310.         if((x == 8 || x == 9) && y == 14)
  1311.             izb = 0;
  1312.         else if((x == 14 || x == 15) && y == 14)
  1313.             izb = 1;
  1314.         else if((x == 20 || x == 21) && y == 14)
  1315.             izb = 2;
  1316.         else if((x == 26 || x == 27) && y == 14)
  1317.             izb = 3;
  1318.         else
  1319.             pom = 1;
  1320.     }
  1321.  
  1322.     ObrisiTerminal();
  1323.  
  1324.     return izb;
  1325. }
  1326.  
  1327. int FiguraUBroj(wchar_t figura[])
  1328. {
  1329.     _setmode(_fileno(stdout), _O_U8TEXT);
  1330.  
  1331.     if(!wcscmp(figura, KRALJ))
  1332.         return 0;
  1333.     else if(!wcscmp(figura, KRALJICA))
  1334.         return 1;
  1335.     else if(!wcscmp(figura, TOP))
  1336.         return 2;
  1337.     else if(!wcscmp(figura, LOVAC))
  1338.         return 3;
  1339.     else if(!wcscmp(figura, KONJ))
  1340.         return 4;
  1341.     else if(!wcscmp(figura, PIJUN))
  1342.         return 5;
  1343.     else if(!wcscmp(figura, PRAZNO))
  1344.         return 6;
  1345.     else if(!wcscmp(figura, TACKA))
  1346.         return 7;
  1347. }
  1348.  
  1349. wchar_t* BrojUFiguru(int broj)
  1350. {
  1351.     _setmode(_fileno(stdout), _O_U8TEXT);
  1352.  
  1353.     switch(broj)
  1354.     {
  1355.         case 0:
  1356.             return KRALJ;
  1357.  
  1358.         case 1:
  1359.             return KRALJICA;
  1360.  
  1361.         case 2:
  1362.             return TOP;
  1363.  
  1364.         case 3:
  1365.             return LOVAC;
  1366.  
  1367.         case 4:
  1368.             return KONJ;
  1369.  
  1370.         case 5:
  1371.             return PIJUN;
  1372.  
  1373.         case 6:
  1374.             return PRAZNO;
  1375.  
  1376.         case 7:
  1377.             return TACKA;
  1378.     }
  1379. }
  1380.  
  1381. vector<short> NapraviSacuvaj(vector<Tabla> istorija)
  1382. {
  1383.     vector<short> memo;
  1384.     memo.clear();
  1385.  
  1386.     for(int a = 0; a <= brPoteza; a++)
  1387.     {
  1388.         memo.push_back(istorija[a].brdesno);
  1389.         memo.push_back(istorija[a].brlevo);
  1390.         memo.push_back(istorija[a].krajigre);
  1391.         memo.push_back(istorija[a].malarbeli);
  1392.         memo.push_back(istorija[a].malarcrni);
  1393.         memo.push_back(istorija[a].velikarbeli);
  1394.         memo.push_back(istorija[a].velikarcrni);
  1395.  
  1396.         for(int i = 0; i < 16; i++)
  1397.         {
  1398.             memo.push_back(FiguraUBroj(istorija[a].levo[i / 2][i % 2].figura));
  1399.             memo.push_back(FiguraUBroj(istorija[a].desno[i / 2][i % 2].figura));
  1400.         }
  1401.  
  1402.         for(int i = 0; i < 8; i++)
  1403.             for(int j = 0; j < 8; j++)
  1404.             {
  1405.                 memo.push_back(istorija[a].polje[i][j].anpasan);
  1406.                 memo.push_back(istorija[a].polje[i][j].bojaFigure);
  1407.                 memo.push_back(FiguraUBroj(istorija[a].polje[i][j].figura));
  1408.                 memo.push_back(istorija[a].polje[i][j].stanjePolja);
  1409.             }
  1410.     }
  1411.  
  1412.     return memo;
  1413. }
  1414.  
  1415. void SacuvajIgru(vector<Tabla> istorija)
  1416. {
  1417.     char ime[18], zn;
  1418.     int pom;
  1419.     vector<short> memo;
  1420.     ObrisiTerminal();
  1421.     HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  1422.     SetConsoleCursorInfo(hConsole, &kursor);
  1423.  
  1424.     if(boja == SVETLO)
  1425.         SetConsoleTextAttribute(hConsole, 82);
  1426.     else if(boja == TAMNO)
  1427.         SetConsoleTextAttribute(hConsole, 101);
  1428.     else if(boja == SIVO)
  1429.         SetConsoleTextAttribute(hConsole, 152);
  1430.  
  1431.     _setmode(_fileno(stdout), _O_TEXT);
  1432.  
  1433.     gotoxy(4, 14);
  1434.     printf("Ime igre:  ");
  1435.  
  1436.     for(int i = 0; i < 18; i++)
  1437.     {
  1438.         fflush(stdin);
  1439.         zn = getch();
  1440.         fflush(stdin);
  1441.  
  1442.         if((zn == 13 && i != 0) || i == 14)
  1443.         {
  1444.             Sleep(100);
  1445.             SakriKursor();
  1446.             ime[i] = '\0';
  1447.             break;
  1448.         }
  1449.         else if(zn == 8)
  1450.         {
  1451.             gotoxy(14 + i, 14);
  1452.             putch(' ');
  1453.             gotoxy(14 + i, 14);
  1454.             i -= 2;
  1455.         }
  1456.         else
  1457.         {
  1458.             gotoxy(15 + i, 14);
  1459.             putch(zn);
  1460.             ime[i] = zn;
  1461.         }
  1462.     }
  1463.  
  1464.     ObrisiTerminal();
  1465.     gotoxy(4, 14);
  1466.  
  1467.     memo = NapraviSacuvaj(istorija);
  1468.  
  1469.     ofstream izlaz (strcat(ime, ".igra"));
  1470.  
  1471.     if(izlaz.is_open())
  1472.     {
  1473.         izlaz << brPoteza;
  1474.  
  1475.         for(int i = 0; i < (brPoteza + 1) * 295; i++)
  1476.         {
  1477.             if(!(i % 295))
  1478.                 izlaz << endl;
  1479.  
  1480.             izlaz << memo[i] << " ";
  1481.         }
  1482.  
  1483.         izlaz.close();
  1484.     }
  1485.  
  1486. }
  1487.  
  1488. void OdaberiVelicinu()
  1489. {
  1490.     velicina = (velicina - 5) / 2;
  1491.     HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  1492.     ObrisiTerminal();
  1493.  
  1494.     if(boja == SVETLO)
  1495.         SetConsoleTextAttribute(hConsole, 82);
  1496.     else if(boja == TAMNO)
  1497.         SetConsoleTextAttribute(hConsole, 101);
  1498.     else if(boja == SIVO)
  1499.         SetConsoleTextAttribute(hConsole, 152);
  1500.  
  1501.     _setmode(_fileno(stdout), _O_U8TEXT);
  1502.  
  1503.     if(velicina > 9)
  1504.         gotoxy(30, 14);
  1505.     else
  1506.         gotoxy(31, 14);
  1507.  
  1508.     wprintf(L"%d", velicina);
  1509.  
  1510.     gotoxy(4, 14);
  1511.     wprintf(L"Veličina: ");
  1512.  
  1513.     for(int i = 1; i < velicina; i++)
  1514.     {
  1515.         if(boja == SVETLO)
  1516.             SetConsoleTextAttribute(hConsole, 51);
  1517.         else if(boja == TAMNO)
  1518.             SetConsoleTextAttribute(hConsole, 68);
  1519.         else if(boja == SIVO)
  1520.             SetConsoleTextAttribute(hConsole, 170);
  1521.  
  1522.         wprintf(L"█");
  1523.     }
  1524.  
  1525.     if(boja == SVETLO)
  1526.         SetConsoleTextAttribute(hConsole, 102);
  1527.     else if(boja == TAMNO)
  1528.         SetConsoleTextAttribute(hConsole, 119);
  1529.     else if(boja == SIVO)
  1530.         SetConsoleTextAttribute(hConsole, 17);
  1531.  
  1532.     wprintf(L"█");
  1533.  
  1534.     for(int i = 15; i > velicina; i--)
  1535.     {
  1536.         if(boja == SVETLO)
  1537.             SetConsoleTextAttribute(hConsole, 34);
  1538.         else if(boja == TAMNO)
  1539.             SetConsoleTextAttribute(hConsole, 85);
  1540.         else if(boja == SIVO)
  1541.             SetConsoleTextAttribute(hConsole, 136);
  1542.  
  1543.         wprintf(L"█");
  1544.     }
  1545.  
  1546.     DWORD info;
  1547.     INPUT_RECORD input;
  1548.     HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
  1549.     SetConsoleMode(in, ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT);
  1550.  
  1551. GOBACK0:
  1552.     ReadConsoleInput(in, &input, 1, &info);
  1553.  
  1554.     if(input.Event.MouseEvent.dwButtonState != 0x0001)
  1555.     {
  1556. GOBACK:
  1557.         ReadConsoleInput(in, &input, 1, &info);
  1558.  
  1559.         if(input.Event.MouseEvent.dwButtonState == 0x0001 && input.Event.MouseEvent.dwMousePosition.Y == 14 && input.Event.MouseEvent.dwMousePosition.X > 13 && input.Event.MouseEvent.dwMousePosition.X < 29)
  1560.         {
  1561. GOBACK2:
  1562.             ReadConsoleInput(in, &input, 1, &info);
  1563.  
  1564.             velicina = input.Event.MouseEvent.dwMousePosition.X - 13;
  1565.  
  1566.             if(velicina < 1)
  1567.                 velicina = 1;
  1568.  
  1569.             if(velicina > 15)
  1570.                 velicina = 15;
  1571.  
  1572.             if(boja == SVETLO)
  1573.                 SetConsoleTextAttribute(hConsole, 82);
  1574.             else if(boja == TAMNO)
  1575.                 SetConsoleTextAttribute(hConsole, 101);
  1576.             else if(boja == SIVO)
  1577.                 SetConsoleTextAttribute(hConsole, 152);
  1578.  
  1579.             gotoxy(30, 14);
  1580.  
  1581.             if(velicina < 10)
  1582.                 wprintf(L" ");
  1583.  
  1584.             wprintf(L"%d", velicina);
  1585.  
  1586.             gotoxy(14, 14);
  1587.  
  1588.             for(int i = 1; i < velicina; i++)
  1589.             {
  1590.                 if(boja == SVETLO)
  1591.                     SetConsoleTextAttribute(hConsole, 51);
  1592.                 else if(boja == TAMNO)
  1593.                     SetConsoleTextAttribute(hConsole, 68);
  1594.                 else if(boja == SIVO)
  1595.                     SetConsoleTextAttribute(hConsole, 170);
  1596.  
  1597.                 wprintf(L"█");
  1598.             }
  1599.  
  1600.             if(boja == SVETLO)
  1601.                 SetConsoleTextAttribute(hConsole, 102);
  1602.             else if(boja == TAMNO)
  1603.                 SetConsoleTextAttribute(hConsole, 119);
  1604.             else if(boja == SIVO)
  1605.                 SetConsoleTextAttribute(hConsole, 17);
  1606.  
  1607.             wprintf(L"█");
  1608.  
  1609.             for(int i = 15; i > velicina; i--)
  1610.             {
  1611.                 if(boja == SVETLO)
  1612.                     SetConsoleTextAttribute(hConsole, 34);
  1613.                 else if(boja == TAMNO)
  1614.                     SetConsoleTextAttribute(hConsole, 85);
  1615.                 else if(boja == SIVO)
  1616.                     SetConsoleTextAttribute(hConsole, 136);
  1617.  
  1618.                 wprintf(L"█");
  1619.             }
  1620.  
  1621.             if(input.Event.MouseEvent.dwButtonState == 0x0001)
  1622.                 goto GOBACK2;
  1623.         }
  1624.         else
  1625.             goto GOBACK;
  1626.     }
  1627.     else
  1628.         goto GOBACK0;
  1629.  
  1630.     Sleep(300);
  1631.     ObrisiTerminal();
  1632.     velicina = velicina * 2 + 5;
  1633. }
  1634.  
  1635. void AnimacijaUcitaj()
  1636. {
  1637.     system("MODE 36, 18");
  1638.     PodesiVelicinu(velicina);
  1639.     system("MODE 36, 1");
  1640.  
  1641.     HWND consoleWindow = GetConsoleWindow();
  1642.     HMENU hmenu = GetSystemMenu(consoleWindow, FALSE);
  1643.     EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); ////////////////////////////////////////////////////////////////////////////////////////////
  1644.  
  1645.     winlog = GetWindowLong(consoleWindow, GWL_STYLE);
  1646.     SetWindowLong(consoleWindow, GWL_STYLE, winlog & ~WS_MAXIMIZEBOX & ~WS_SIZEBOX & ~WS_VSCROLL);
  1647.     SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),  ENABLE_EXTENDED_FLAGS);
  1648.     _setmode(_fileno(stdout), _O_U8TEXT);
  1649.     SetConsoleTitleW(L"ŠAH");
  1650.     _CONSOLE_SCREEN_BUFFER_INFOEX info;
  1651.     info.cbSize = sizeof(info);
  1652.     HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  1653.     GetConsoleScreenBufferInfoEx(hConsole, &info);
  1654.  
  1655.     info.ColorTable[2] = RGB(198, 175, 141);
  1656.     info.ColorTable[3] = RGB(114, 71, 56);
  1657.  
  1658.     SetConsoleScreenBufferInfoEx(hConsole, &info);
  1659.     SakriKursor();
  1660.  
  1661.     system("color 23");
  1662.  
  1663.     char str[20];
  1664.  
  1665.     for(int i = 1; i < 18; i++)
  1666.     {
  1667.         sprintf(str, "MODE 36, %d", i);
  1668.         system(str);
  1669.     }
  1670.  
  1671.     Sleep(200);
  1672.  
  1673.     gotoxy(6, 2);
  1674.     wprintf(L"Najbolja igrica na svetu");
  1675.     gotoxy(12, 4);
  1676.     wprintf(L"se učitava...");
  1677.  
  1678.     for(int i = 0; i < 1; i++)
  1679.     {
  1680.         gotoxy(17, 8);
  1681.         wprintf(L"●");
  1682.         Sleep(270);
  1683.         gotoxy(21, 9);
  1684.         wprintf(L"●");
  1685.         Sleep(250);
  1686.         gotoxy(23, 11);
  1687.         wprintf(L"●");
  1688.         Sleep(200);
  1689.         gotoxy(21, 13);
  1690.         wprintf(L"●");
  1691.         Sleep(150);
  1692.         gotoxy(17, 14);
  1693.         wprintf(L"●");
  1694.         Sleep(140);
  1695.         gotoxy(13, 13);
  1696.         wprintf(L"●");
  1697.         Sleep(150);
  1698.         gotoxy(11, 11);
  1699.         wprintf(L"●");
  1700.         Sleep(160);
  1701.         gotoxy(13, 9);
  1702.         wprintf(L"●");
  1703.         Sleep(310);
  1704.         gotoxy(17, 8);
  1705.         wprintf(L" ");
  1706.         Sleep(280);
  1707.         gotoxy(21, 9);
  1708.         wprintf(L" ");
  1709.         Sleep(250);
  1710.         gotoxy(23, 11);
  1711.         wprintf(L" ");
  1712.         Sleep(200);
  1713.         gotoxy(21, 13);
  1714.         wprintf(L" ");
  1715.         Sleep(150);
  1716.         gotoxy(17, 14);
  1717.         wprintf(L" ");
  1718.         Sleep(140);
  1719.         gotoxy(13, 13);
  1720.         wprintf(L" ");
  1721.         Sleep(150);
  1722.         gotoxy(11, 11);
  1723.         wprintf(L" ");
  1724.         Sleep(160);
  1725.         gotoxy(13, 9);
  1726.         wprintf(L" ");
  1727.         Sleep(310);
  1728.  
  1729.         if(!i)
  1730.         {
  1731.             gotoxy(17, 8);
  1732.             wprintf(L"●");
  1733.             Sleep(280);
  1734.             gotoxy(21, 9);
  1735.             wprintf(L"●");
  1736.             Sleep(250);
  1737.             gotoxy(23, 11);
  1738.             wprintf(L"●");
  1739.             Sleep(200);
  1740.             gotoxy(21, 13);
  1741.             wprintf(L"●");
  1742.  
  1743.             Sleep(600);
  1744.         }
  1745.  
  1746.     }
  1747. }
  1748.  
  1749. int main()
  1750. {
  1751.     Tabla tabla;
  1752.     NapraviTablu(tabla);
  1753.     vector<Tabla> istorija(0);
  1754.     istorija.push_back(tabla);
  1755.  
  1756.     AnimacijaUcitaj();
  1757.  
  1758.     PodesiKonzolu();
  1759.     CentrirajKonzolu();
  1760.     PodesiKonzolu2();
  1761.     OdstampajKonzolu();
  1762.     OdstampajTablu(tabla);
  1763.  
  1764.     int x, y, xizb, yizb, i = 35;
  1765.     HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
  1766.     _setmode(_fileno(stdout), _O_U8TEXT);
  1767.  
  1768.     while(1)
  1769.     {
  1770.         if(brPoteza % 2 == 1 && !JelMozeIgratiCrni(tabla) && JelSahCrni(tabla, 0, 0))
  1771.         {
  1772.             if(boja == SVETLO)
  1773.                 SetConsoleTextAttribute(console, 82);
  1774.             else if(boja == TAMNO)
  1775.                 SetConsoleTextAttribute(console, 101);
  1776.             else if(boja == SIVO)
  1777.                 SetConsoleTextAttribute(console, 152);
  1778.  
  1779.             tabla.krajigre = 1;
  1780.             gotoxy(10, 14);
  1781.             wprintf(L"Beli je pobednik");
  1782.         }
  1783.         else if (brPoteza % 2 == 0 && !JelMozeIgratiBeli(tabla) && JelSahBeli(tabla, 0, 0))
  1784.         {
  1785.             if(boja == SVETLO)
  1786.                 SetConsoleTextAttribute(console, 82);
  1787.             else if(boja == TAMNO)
  1788.                 SetConsoleTextAttribute(console, 101);
  1789.             else if(boja == SIVO)
  1790.                 SetConsoleTextAttribute(console, 152);
  1791.  
  1792.             tabla.krajigre = 1;
  1793.             gotoxy(10, 14);
  1794.             wprintf(L"Crni je pobednik");
  1795.         }
  1796.         else if(brPoteza % 2 == 1 && !JelMozeIgratiCrni(tabla))
  1797.         {
  1798.             if(boja == SVETLO)
  1799.                 SetConsoleTextAttribute(console, 82);
  1800.             else if(boja == TAMNO)
  1801.                 SetConsoleTextAttribute(console, 101);
  1802.             else if(boja == SIVO)
  1803.                 SetConsoleTextAttribute(console, 152);
  1804.  
  1805.             tabla.krajigre = 1;
  1806.             gotoxy(8, 14);
  1807.             wprintf(L"Beli je napravio pat");
  1808.         }
  1809.         else if (brPoteza % 2 == 0 && !JelMozeIgratiBeli(tabla))
  1810.         {
  1811.             if(boja == SVETLO)
  1812.                 SetConsoleTextAttribute(console, 82);
  1813.             else if(boja == TAMNO)
  1814.                 SetConsoleTextAttribute(console, 101);
  1815.             else if(boja == SIVO)
  1816.                 SetConsoleTextAttribute(console, 152);
  1817.  
  1818.             tabla.krajigre = 1;
  1819.             gotoxy(8, 14);
  1820.             wprintf(L"Crni je napravio pat");
  1821.         }
  1822.  
  1823.         sacekaj = ISKLJUCENO;
  1824.         SetConsoleTextAttribute(console, 82);
  1825.  
  1826.         UcitajKlik(x, y);
  1827.         ObrisiTerminal();
  1828.  
  1829.         if(y == 0 && (x == 4 || x == 5))
  1830.         {
  1831.             NapraviTablu(tabla);
  1832.             istorija.clear();
  1833.             istorija.push_back(tabla);
  1834.             brPoteza = 0;
  1835.             NoviPotez(tabla);
  1836.             ObrisiTerminal();
  1837.  
  1838.             OsveziTablu(tabla);
  1839.         }
  1840.         else if(y == 0 && (x == 0 || x == 1))
  1841.         {
  1842.             SacuvajIgru(istorija);
  1843.         }
  1844.         else if(y == 0 && (x == 2 || x == 3))
  1845.         {
  1846.             char ime[18], zn;
  1847.             short pom;
  1848.             ObrisiTerminal();
  1849.             HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  1850.             SetConsoleCursorInfo(hConsole, &kursor);
  1851.  
  1852.             if(boja == SVETLO)
  1853.                 SetConsoleTextAttribute(hConsole, 82);
  1854.             else if(boja == TAMNO)
  1855.                 SetConsoleTextAttribute(hConsole, 101);
  1856.             else if(boja == SIVO)
  1857.                 SetConsoleTextAttribute(hConsole, 152);
  1858.  
  1859.             _setmode(_fileno(stdout), _O_TEXT);
  1860.  
  1861.             gotoxy(4, 14);
  1862.             printf("Ime igre:  ");
  1863.  
  1864.             for(int i = 0; i < 18; i++)
  1865.             {
  1866.                 zn = getch();
  1867.  
  1868.                 if((zn == 13 && i != 0) || i == 14)
  1869.                 {
  1870.                     Sleep(100);
  1871.                     SakriKursor();
  1872.                     ime[i] = '\0';
  1873.                     break;
  1874.                 }
  1875.                 else if(zn == 8)
  1876.                 {
  1877.                     gotoxy(14 + i, 14);
  1878.                     putch(' ');
  1879.                     gotoxy(14 + i, 14);
  1880.                     i -= 2;
  1881.                 }
  1882.                 else
  1883.                 {
  1884.                     gotoxy(15 + i, 14);
  1885.                     putch(zn);
  1886.                     ime[i] = zn;
  1887.                 }
  1888.             }
  1889.  
  1890.             ObrisiTerminal();
  1891.  
  1892.             ifstream ulaz (strcat(ime, ".igra"));
  1893.  
  1894.             if(ulaz.is_open())
  1895.             {
  1896.                 ulaz >> brPoteza;
  1897.  
  1898.                 istorija.clear();
  1899.  
  1900.                 for(int a = 0; a <= brPoteza; a++)
  1901.                 {
  1902.                     ulaz >> tabla.brlevo;
  1903.                     ulaz >> tabla.brdesno;
  1904.                     ulaz >> tabla.krajigre;
  1905.                     ulaz >> tabla.malarbeli;
  1906.                     ulaz >> tabla.malarcrni;
  1907.                     ulaz >> tabla.velikarbeli;
  1908.                     ulaz >> tabla.velikarcrni;
  1909.  
  1910.                     for(int i = 0; i < 16; i++)
  1911.                     {
  1912.                         ulaz >> pom;
  1913.                         wcscpy(tabla.levo[i / 2][i % 2].figura, BrojUFiguru(pom));
  1914.                         ulaz >> pom;
  1915.                         wcscpy(tabla.desno[i / 2][i % 2].figura, BrojUFiguru(pom));
  1916.                     }
  1917.  
  1918.                     for(int i = 0; i < 8; i++)
  1919.                         for(int j = 0; j < 8; j++)
  1920.                         {
  1921.                             ulaz >> tabla.polje[i][j].anpasan;
  1922.                             ulaz >> tabla.polje[i][j].bojaFigure;
  1923.                             ulaz >> pom;
  1924.                             wcscpy(tabla.polje[i][j].figura, BrojUFiguru(pom));
  1925.                             ulaz >> tabla.polje[i][j].stanjePolja;
  1926.                         }
  1927.  
  1928.                     istorija.push_back(tabla);
  1929.                 }
  1930.  
  1931.                 ulaz.close();
  1932.             }
  1933.             else
  1934.             {
  1935.                 gotoxy(4, 14);
  1936.  
  1937.                 if(boja == SVETLO)
  1938.                     SetConsoleTextAttribute(hConsole, 82);
  1939.                 else if(boja == TAMNO)
  1940.                     SetConsoleTextAttribute(hConsole, 101);
  1941.                 else if(boja == SIVO)
  1942.                     SetConsoleTextAttribute(hConsole, 152);
  1943.  
  1944.                 _setmode(_fileno(stdout), _O_U8TEXT);
  1945.  
  1946.                 wprintf(L"Ne postoji igra sa tim imenom");
  1947.             }
  1948.  
  1949.             OsveziTablu(tabla);
  1950.         }
  1951.         else if(y == 0 && (x == 6 || x == 7))
  1952.         {
  1953.             boja++;
  1954.  
  1955.             if(boja == 3)
  1956.                 boja = 0;
  1957.  
  1958.             OdstampajKonzolu();
  1959.             NoviPotez(tabla);
  1960.  
  1961.             OsveziTablu(tabla);
  1962.         }
  1963.         else if(y == 0 && (x == 8 || x == 9))
  1964.         {
  1965.             short pom = velicina;
  1966.             OdaberiVelicinu();
  1967.  
  1968.             if(pom != velicina)
  1969.             {
  1970.                 PodesiVelicinu(velicina);
  1971.                 OdstampajKonzolu();
  1972.                 OsveziTablu(tabla);
  1973.             }
  1974.         }
  1975.         else if(y == 0 && (x == 10 || x == 11) && brPoteza > 0)
  1976.         {
  1977.             tabla = istorija[brPoteza - 1];
  1978.             istorija.erase(istorija.begin() + brPoteza);
  1979.             brPoteza--;
  1980.             ObrisiTerminal();
  1981.  
  1982.             OsveziTablu(tabla);
  1983.         }
  1984.         else if(y == 0 && (x == 30 || x == 31))
  1985.         {
  1986.             if(rotacija == UKLJUCENO)
  1987.             {
  1988.                 rotacija = ISKLJUCENO;
  1989.  
  1990.                 if(boja == SVETLO)
  1991.                     SetConsoleTextAttribute(console, 36);
  1992.                 else if(boja == TAMNO)
  1993.                     SetConsoleTextAttribute(console, 87);
  1994.                 else if(boja == SIVO)
  1995.                     SetConsoleTextAttribute(console, 138);
  1996.  
  1997.                 gotoxy(30, 0);
  1998.                 wprintf(L"");
  1999.             }
  2000.             else
  2001.             {
  2002.                 rotacija = UKLJUCENO;
  2003.  
  2004.                 if(boja == SVETLO)
  2005.                     SetConsoleTextAttribute(console, 36);
  2006.                 else if(boja == TAMNO)
  2007.                     SetConsoleTextAttribute(console, 87);
  2008.                 else if(boja == SIVO)
  2009.                     SetConsoleTextAttribute(console, 138);
  2010.  
  2011.                 gotoxy(30, 0);
  2012.                 wprintf(L"");
  2013.             }
  2014.  
  2015.             NoviPotez(tabla);
  2016.  
  2017.             OsveziTablu(tabla);
  2018.         }
  2019.         else if(y == 0 && (x == 32 || x == 33))
  2020.         {
  2021.             int a, b;
  2022.             SetConsoleTextAttribute(console, 255);
  2023.  
  2024.             for(int i = 0; i < 20; i++)
  2025.                 wprintf(L"\t\t\t\t\t\t");
  2026.  
  2027.             SetConsoleTextAttribute(console, 241);
  2028.             gotoxy(0, 1);
  2029.             wprintf(L"\t\tŠAH");
  2030.             wprintf(L"\n\n\n  Autor:");
  2031.             wprintf(L"\n\n  Momir Stanišić,");
  2032.             wprintf(L"\n  CMD Game Developer");
  2033.             wprintf(L"\n\n\n\n  Verzija: 1.0.0");
  2034.  
  2035.             UcitajKlik(a, b);
  2036.  
  2037.             OdstampajKonzolu();
  2038.             OdstampajTablu(tabla);
  2039.         }
  2040.         else if(y == 0 && (x == 35 || x == 34))
  2041.         {
  2042.             char str[20];
  2043.             istorija.clear();
  2044.  
  2045.             SetConsoleTextAttribute(console, 34);
  2046.  
  2047.             for(int i = 0; i < 20; i++)
  2048.                 wprintf(L"\t\t\t\t\t\t");
  2049.  
  2050.             SetConsoleTextAttribute(console, 35);
  2051.             gotoxy(13, 6);
  2052.             wprintf(L"DOVIĐENJA!");
  2053.             Sleep(1000);
  2054.  
  2055.             for(int i = 0; i < 18; i++)
  2056.             {
  2057.                 sprintf(str, "MODE 36, %d", 18 - i);
  2058.                 system(str);
  2059.             }
  2060.  
  2061.             RegDelnodeRecurse(HKEY_CURRENT_USER, TEXT("Console"));
  2062.  
  2063.             return 0;
  2064.         }
  2065.         else if(y > 2 && y < 11 && x > 9 && x < 26 && tabla.krajigre == 0)
  2066.         {
  2067.             if(brPoteza % 2 && rotacija == UKLJUCENO && JelMozeIgratiCrni(tabla))
  2068.                 ObrnutaPozicijaNaTabli(x, y);
  2069.             else
  2070.                 PozicijaNaTabli(x, y);
  2071.  
  2072.             if(tabla.polje[y][x].stanjePolja == NAPADNUTO && wcscmp(tabla.polje[y][x].figura, KRALJ))
  2073.             {
  2074.                 PozicijaIzabranog(xizb, yizb, tabla);
  2075.  
  2076.                 if(tabla.polje[yizb][xizb].bojaFigure == BELO && tabla.brlevo < 8)
  2077.                 {
  2078.                     if(tabla.polje[y + 1][x].anpasan == UKLJUCENO)
  2079.                     {
  2080.                         wcscpy(tabla.levo[tabla.brlevo / 2][tabla.brlevo % 2].figura, PIJUN);
  2081.                         wcscpy(tabla.polje[y + 1][x].figura, PRAZNO);
  2082.                     }
  2083.                     else
  2084.                         wcscpy(tabla.levo[tabla.brlevo / 2][tabla.brlevo % 2].figura, tabla.polje[y][x].figura);
  2085.  
  2086.                     tabla.brlevo++;
  2087.                 }
  2088.                 else if(tabla.brdesno < 8)
  2089.                 {
  2090.                     if(tabla.polje[y - 1][x].anpasan == UKLJUCENO)
  2091.                     {
  2092.                         wcscpy(tabla.desno[tabla.brdesno / 2][tabla.brdesno % 2].figura, PIJUN);
  2093.                         wcscpy(tabla.polje[y - 1][x].figura, PRAZNO);
  2094.                     }
  2095.                     else
  2096.                         wcscpy(tabla.desno[tabla.brdesno / 2][tabla.brdesno % 2].figura, tabla.polje[y][x].figura);
  2097.  
  2098.                     tabla.brdesno++;
  2099.                 }
  2100.  
  2101.                 if((xizb == 7 && yizb == 7) || (x == 7 && y == 7))
  2102.                     tabla.malarbeli = ISKLJUCENO;
  2103.                 else if((xizb == 0 && yizb == 7) || (x == 0 && y == 7))
  2104.                     tabla.velikarbeli = ISKLJUCENO;
  2105.                 else if((xizb == 0 && yizb == 0) || (x == 0 && y == 0))
  2106.                     tabla.velikarcrni = ISKLJUCENO;
  2107.                 else if((xizb == 7 && yizb == 0) || (x == 7 && y == 0))
  2108.                     tabla.malarcrni = ISKLJUCENO;
  2109.                 else if(xizb == 4 && yizb == 7)
  2110.                 {
  2111.                     tabla.malarbeli = ISKLJUCENO;
  2112.                     tabla.velikarbeli = ISKLJUCENO;
  2113.                 }
  2114.                 else if(xizb == 4 && yizb == 0)
  2115.                 {
  2116.                     tabla.malarcrni = ISKLJUCENO;
  2117.                     tabla.velikarcrni = ISKLJUCENO;
  2118.                 }
  2119.  
  2120.                 wcscpy(tabla.polje[y][x].figura, tabla.polje[yizb][xizb].figura);
  2121.                 wcscpy(tabla.polje[yizb][xizb].figura, PRAZNO);
  2122.                 tabla.polje[y][x].bojaFigure = tabla.polje[yizb][xizb].bojaFigure;
  2123.                 NoviPotez(tabla);
  2124.                 ObrisiAnpasan(tabla);
  2125.  
  2126.                 if(!wcscmp(tabla.polje[y][x].figura, PIJUN) && ((tabla.polje[y][x].bojaFigure == BELO && y == 0) || (tabla.polje[y][x].bojaFigure == CRNO && y == 7)))
  2127.                 {
  2128.                     OdstampajTablu(tabla);
  2129.                     short zamena = ZameniPijuna();
  2130.  
  2131.                     switch(zamena)
  2132.                     {
  2133.                         case 0:
  2134.                             wcscpy(tabla.polje[y][x].figura, KRALJICA);
  2135.                             break;
  2136.  
  2137.                         case 1:
  2138.                             wcscpy(tabla.polje[y][x].figura, TOP);
  2139.                             break;
  2140.  
  2141.                         case 2:
  2142.                             wcscpy(tabla.polje[y][x].figura, LOVAC);
  2143.                             break;
  2144.  
  2145.                         case 3:
  2146.                             wcscpy(tabla.polje[y][x].figura, KONJ);
  2147.                     }
  2148.                 }
  2149.  
  2150.                 if(JelSahBeli(tabla, 0, 0))
  2151.                     for(int i = 0; i < 64; i++)
  2152.                         if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == BELO)
  2153.                             tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
  2154.  
  2155.                 if(JelSahCrni(tabla, 0, 0))
  2156.                     for(int i = 0; i < 64; i++)
  2157.                         if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == CRNO)
  2158.                             tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
  2159.  
  2160.                 Sleep(260);
  2161.  
  2162.                 OsveziTablu(tabla);
  2163.  
  2164.                 NoviPotez(tabla);
  2165.  
  2166.                 if(JelSahBeli(tabla, 0, 0))
  2167.                     for(int i = 0; i < 64; i++)
  2168.                         if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == BELO)
  2169.                         {
  2170.                             tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
  2171.                             OsveziTablu(tabla);
  2172.                             break;
  2173.                         }
  2174.  
  2175.                 if(JelSahCrni(tabla, 0, 0))
  2176.                     for(int i = 0; i < 64; i++)
  2177.                         if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == CRNO)
  2178.                         {
  2179.                             tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
  2180.                             OsveziTablu(tabla);
  2181.                             break;
  2182.                         }
  2183.  
  2184.                 istorija.push_back(tabla);
  2185.                 brPoteza++;
  2186.                 sacekaj = UKLJUCENO;
  2187.  
  2188.             }
  2189.             else if(!wcscmp(tabla.polje[y][x].figura, KRALJ))
  2190.             {
  2191.                 if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
  2192.                 {
  2193.                     NoviPotez(tabla);
  2194.  
  2195.                     PostaviKralja(tabla, x, y);
  2196.                 }
  2197.                 else
  2198.                     NoviPotez(tabla);
  2199.             }
  2200.             else if(!wcscmp(tabla.polje[y][x].figura, PIJUN))
  2201.             {
  2202.                 if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
  2203.                 {
  2204.                     NoviPotez(tabla);
  2205.                     PostaviPijuna(tabla, x, y);
  2206.                 }
  2207.                 else
  2208.                     NoviPotez(tabla);
  2209.             }
  2210.             else if(!wcscmp(tabla.polje[y][x].figura, KONJ))
  2211.             {
  2212.                 if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
  2213.                 {
  2214.                     NoviPotez(tabla);
  2215.                     PostaviKonja(tabla, x, y);
  2216.                 }
  2217.                 else
  2218.                     NoviPotez(tabla);
  2219.             }
  2220.             else if(!wcscmp(tabla.polje[y][x].figura, TOP))
  2221.             {
  2222.                 if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
  2223.                 {
  2224.                     NoviPotez(tabla);
  2225.                     PostaviTopa(tabla, x, y);
  2226.                 }
  2227.                 else
  2228.                     NoviPotez(tabla);
  2229.             }
  2230.             else if(!wcscmp(tabla.polje[y][x].figura, LOVAC))
  2231.             {
  2232.                 if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
  2233.                 {
  2234.                     NoviPotez(tabla);
  2235.                     PostaviLovca(tabla, x, y);
  2236.                 }
  2237.                 else
  2238.                     NoviPotez(tabla);
  2239.             }
  2240.             else if(!wcscmp(tabla.polje[y][x].figura, KRALJICA))
  2241.             {
  2242.                 if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
  2243.                 {
  2244.                     NoviPotez(tabla);
  2245.                     PostaviKraljicu(tabla, x, y);
  2246.                 }
  2247.                 else
  2248.                     NoviPotez(tabla);
  2249.             }
  2250.             else if(!wcscmp(tabla.polje[y][x].figura, PRAZNO))
  2251.                 NoviPotez(tabla);
  2252.             else if(!wcscmp(tabla.polje[y][x].figura, TACKA))
  2253.             {
  2254.                 PozicijaIzabranog(xizb, yizb, tabla);
  2255.                 wcscpy(tabla.polje[y][x].figura, tabla.polje[yizb][xizb].figura);
  2256.                 wcscpy(tabla.polje[yizb][xizb].figura, PRAZNO);
  2257.                 tabla.polje[y][x].bojaFigure = tabla.polje[yizb][xizb].bojaFigure;
  2258.  
  2259.                 ObrisiAnpasan(tabla);
  2260.  
  2261.                 if(tabla.malarbeli == UKLJUCENO && xizb == 4 && yizb == 7 && x == 6 && y == 7)
  2262.                 {
  2263.                     wcscpy(tabla.polje[7][7].figura, PRAZNO);
  2264.                     wcscpy(tabla.polje[7][5].figura, TOP);
  2265.                     tabla.polje[7][5].bojaFigure = BELO;
  2266.                 }
  2267.  
  2268.                 if(tabla.velikarbeli == UKLJUCENO && xizb == 4 && yizb == 7 && x == 1 && y == 7)
  2269.                 {
  2270.                     wcscpy(tabla.polje[7][0].figura, PRAZNO);
  2271.                     wcscpy(tabla.polje[7][2].figura, TOP);
  2272.                     tabla.polje[7][2].bojaFigure = BELO;
  2273.                 }
  2274.  
  2275.                 if(tabla.malarcrni == UKLJUCENO && xizb == 4 && yizb == 0 && x == 6 && y == 0)
  2276.                 {
  2277.                     wcscpy(tabla.polje[0][7].figura, PRAZNO);
  2278.                     wcscpy(tabla.polje[0][5].figura, TOP);
  2279.                     tabla.polje[0][5].bojaFigure = CRNO;
  2280.                 }
  2281.  
  2282.                 if(tabla.velikarcrni == UKLJUCENO && xizb == 4 && yizb == 0 && x == 1 && y == 0)
  2283.                 {
  2284.                     wcscpy(tabla.polje[0][0].figura, PRAZNO);
  2285.                     wcscpy(tabla.polje[0][2].figura, TOP);
  2286.                     tabla.polje[0][2].bojaFigure = CRNO;
  2287.                 }
  2288.  
  2289.                 if(!wcscmp(tabla.polje[y][x].figura, PIJUN) && ((tabla.polje[y][x].bojaFigure == BELO && y == yizb - 2) || (tabla.polje[y][x].bojaFigure == CRNO && y == yizb + 2)))
  2290.                     tabla.polje[y][x].anpasan = UKLJUCENO;
  2291.  
  2292.                 if(xizb == 7 && yizb == 7)
  2293.                     tabla.malarbeli = ISKLJUCENO;
  2294.                 else if(xizb == 0 && yizb == 7)
  2295.                     tabla.velikarbeli = ISKLJUCENO;
  2296.                 else if(xizb == 0 && yizb == 0)
  2297.                     tabla.velikarcrni = ISKLJUCENO;
  2298.                 else if(xizb == 7 && yizb == 0)
  2299.                     tabla.malarcrni = ISKLJUCENO;
  2300.                 else if(xizb == 4 && yizb == 7)
  2301.                 {
  2302.                     tabla.malarbeli = ISKLJUCENO;
  2303.                     tabla.velikarbeli = ISKLJUCENO;
  2304.                 }
  2305.                 else if(xizb == 4 && yizb == 0)
  2306.                 {
  2307.                     tabla.malarcrni = ISKLJUCENO;
  2308.                     tabla.velikarcrni = ISKLJUCENO;
  2309.                 }
  2310.  
  2311.                 NoviPotez(tabla);
  2312.  
  2313.                 if(JelSahBeli(tabla, 0, 0))
  2314.                     for(int i = 0; i < 64; i++)
  2315.                         if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == BELO)
  2316.                         {
  2317.                             tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
  2318.                             OsveziTablu(tabla);
  2319.                             break;
  2320.                         }
  2321.  
  2322.                 if(JelSahCrni(tabla, 0, 0))
  2323.                     for(int i = 0; i < 64; i++)
  2324.                         if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == CRNO)
  2325.                         {
  2326.                             tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
  2327.                             OsveziTablu(tabla);
  2328.                             break;
  2329.                         }
  2330.  
  2331.                 istorija.push_back(tabla);
  2332.                 brPoteza++;
  2333.                 sacekaj = UKLJUCENO;
  2334.             }
  2335.  
  2336.             OsveziTablu(tabla);
  2337.         }
  2338.     }
  2339. }
  2340.  
  2341. void NapraviTablu(Tabla &tabla)
  2342. {
  2343.     tabla.brlevo = 0;
  2344.     tabla.brdesno = 0;
  2345.     tabla.krajigre = 0;
  2346.     tabla.malarbeli = UKLJUCENO;
  2347.     tabla.malarcrni = UKLJUCENO;
  2348.     tabla.velikarbeli = UKLJUCENO;
  2349.     tabla.velikarcrni = UKLJUCENO;
  2350.  
  2351.     for(int i = 0; i < 8; i++)
  2352.         for(int j = 0; j < 8; j++)
  2353.         {
  2354.             tabla.polje[i][j].stanjePolja = NEUTRALNO;
  2355.             tabla.polje[i][j].anpasan = ISKLJUCENO;
  2356.  
  2357.             if((i + j) % 2 == 0)
  2358.                 tabla.polje[i][j].bojaPolja = BELO;
  2359.             else
  2360.                 tabla.polje[i][j].bojaPolja = CRNO;
  2361.         }
  2362.  
  2363.     for(int i = 0; i < 2; i++)
  2364.         for(int j = 0; j < 8; j++)
  2365.         {
  2366.             tabla.polje[i][j].bojaFigure = CRNO;
  2367.             tabla.polje[i + 6][j].bojaFigure = BELO;
  2368.         }
  2369.  
  2370.     for(int j = 0; j < 8; j++)
  2371.     {
  2372.         wcscpy(tabla.polje[1][j].figura, PIJUN);
  2373.         wcscpy(tabla.polje[6][j].figura, PIJUN);
  2374.     }
  2375.  
  2376.     wcscpy(tabla.polje[0][0].figura, TOP);
  2377.     wcscpy(tabla.polje[0][7].figura, TOP);
  2378.     wcscpy(tabla.polje[7][0].figura, TOP);
  2379.     wcscpy(tabla.polje[7][7].figura, TOP);
  2380.  
  2381.     wcscpy(tabla.polje[0][1].figura, KONJ);
  2382.     wcscpy(tabla.polje[0][6].figura, KONJ);
  2383.     wcscpy(tabla.polje[7][1].figura, KONJ);
  2384.     wcscpy(tabla.polje[7][6].figura, KONJ);
  2385.  
  2386.     wcscpy(tabla.polje[0][2].figura, LOVAC);
  2387.     wcscpy(tabla.polje[0][5].figura, LOVAC);
  2388.     wcscpy(tabla.polje[7][2].figura, LOVAC);
  2389.     wcscpy(tabla.polje[7][5].figura, LOVAC);
  2390.  
  2391.     wcscpy(tabla.polje[0][3].figura, KRALJICA);
  2392.     wcscpy(tabla.polje[7][3].figura, KRALJICA);
  2393.  
  2394.     wcscpy(tabla.polje[0][4].figura, KRALJ);
  2395.     wcscpy(tabla.polje[7][4].figura, KRALJ);
  2396.  
  2397.     for(int i = 2; i < 6; i++)
  2398.         for(int j = 0; j < 8; j++)
  2399.         {
  2400.             tabla.polje[i][j].bojaFigure = ZELENO;
  2401.             wcscpy(tabla.polje[i][j].figura, PRAZNO);
  2402.         }
  2403.  
  2404.     for(int i = 0; i < 8; i++)
  2405.         for(int j = 0; j < 2; j++)
  2406.         {
  2407.             tabla.levo[i][j].anpasan = ISKLJUCENO;
  2408.             tabla.levo[i][j].bojaFigure = CRNO;
  2409.             tabla.levo[i][j].stanjePolja = NEUTRALNO;
  2410.             tabla.desno[i][j].anpasan = ISKLJUCENO;
  2411.             tabla.desno[i][j].bojaFigure = BELO;
  2412.             tabla.desno[i][j].stanjePolja = NEUTRALNO;
  2413.             wcscpy(tabla.levo[i][j].figura, PRAZNO);
  2414.             wcscpy(tabla.desno[i][j].figura, PRAZNO);
  2415.         }
  2416. }
  2417.  
  2418. void SakriKursor()
  2419. {
  2420.     HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
  2421.  
  2422.     if(prviput3)
  2423.     {
  2424.         GetConsoleCursorInfo(consoleHandle, &kursor);
  2425.         prviput3 = 0;
  2426.     }
  2427.  
  2428.     CONSOLE_CURSOR_INFO info;
  2429.     info.dwSize = 100;
  2430.     info.bVisible = FALSE;
  2431.     SetConsoleCursorInfo(consoleHandle, &info);
  2432. }
  2433.  
  2434. void ObrisiEkran()
  2435. {
  2436.     HANDLE hStdOut;
  2437.     CONSOLE_SCREEN_BUFFER_INFO csbi;
  2438.     DWORD count;
  2439.     DWORD cellCount;
  2440.     COORD homeCoords = {0, 0};
  2441.  
  2442.     hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
  2443.  
  2444.     if (hStdOut == INVALID_HANDLE_VALUE)
  2445.         return;
  2446.  
  2447.     GetConsoleScreenBufferInfo(hStdOut, &csbi);
  2448.     cellCount = csbi.dwSize.X * csbi.dwSize.Y;
  2449.  
  2450.     FillConsoleOutputCharacter(hStdOut, (TCHAR) ' ', cellCount, homeCoords, &count);
  2451.     FillConsoleOutputAttribute(hStdOut, csbi.wAttributes, cellCount, homeCoords, &count);
  2452.     SetConsoleCursorPosition(hStdOut, homeCoords);
  2453. }
  2454.  
  2455. void gotoxy(int x, int y)
  2456. {
  2457.     COORD koordinate;
  2458.     koordinate.X = x;
  2459.     koordinate.Y = y;
  2460.     SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), koordinate);
  2461. }
  2462.  
  2463. int UcitajKlik(int &x, int &y)
  2464. {
  2465.     DWORD info;
  2466.     INPUT_RECORD input;
  2467.     HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
  2468.     SetConsoleMode(in, ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT);
  2469.     ReadConsoleInput(in, &input, 1, &info);
  2470.  
  2471.     if(input.Event.MouseEvent.dwButtonState != 0x0001)
  2472.     {
  2473. GOBACK:
  2474.         ReadConsoleInput(in, &input, 1, &info);
  2475.  
  2476.         if(input.Event.MouseEvent.dwButtonState == 0x0001)
  2477.         {
  2478. GOBACK2:
  2479.             ReadConsoleInput(in, &input, 1, &info);
  2480.  
  2481.             if(input.Event.MouseEvent.dwButtonState != 0x0001)
  2482.             {
  2483.                 x = input.Event.MouseEvent.dwMousePosition.X;
  2484.                 y = input.Event.MouseEvent.dwMousePosition.Y;
  2485.             }
  2486.             else
  2487.                 goto GOBACK2;
  2488.         }
  2489.         else
  2490.             goto GOBACK;
  2491.     }
  2492.     else
  2493.         UcitajKlik(x, y);
  2494.  
  2495.     return 0;
  2496. }
  2497.  
  2498. void CentrirajKonzolu2()
  2499. {
  2500.     RECT rectClient, rectWindow;
  2501.     HWND hWnd = GetConsoleWindow();
  2502.     GetClientRect(hWnd, &rectClient);
  2503.     GetWindowRect(hWnd, &rectWindow);
  2504.     SetWindowPos(GetConsoleWindow(), HWND_TOP, GetSystemMetrics(SM_CXSCREEN) / 2 - (rectWindow.right - rectWindow.left) / 2, rectWindow.top, 0, 0, SWP_NOSIZE);
  2505. }
  2506.  
  2507. void CentrirajKonzolu()
  2508. {
  2509.     RECT rectClient, rectWindow;
  2510.     HWND hWnd = GetConsoleWindow();
  2511.     GetClientRect(hWnd, &rectClient);
  2512.     GetWindowRect(hWnd, &rectWindow);
  2513.     int posx, posy;
  2514.     posx = GetSystemMetrics(SM_CXSCREEN) / 2 - (rectWindow.right - rectWindow.left) / 2;
  2515.     posy = GetSystemMetrics(SM_CYSCREEN) / 2 - (rectWindow.bottom - rectWindow.top) / 2;
  2516.  
  2517.     SetWindowPos(GetConsoleWindow(), HWND_TOP, posx, posy, 0, 0, SWP_NOSIZE);
  2518. }
  2519.  
  2520. void PodesiKonzolu()
  2521. {
  2522.     HWND consoleWindow = GetConsoleWindow();
  2523.  
  2524.     HMENU hmenu = GetSystemMenu(consoleWindow, FALSE);
  2525. //    EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); ////////////////////////////////////////////////////////////////////////////////////////////
  2526.  
  2527.     if(prviput1)
  2528.     {
  2529.         winlog = GetWindowLong(consoleWindow, GWL_STYLE);
  2530.         SetWindowLong(consoleWindow, GWL_STYLE, winlog & ~WS_MAXIMIZEBOX & ~WS_SIZEBOX & ~WS_VSCROLL);
  2531.         prviput1 = 0;
  2532.     }
  2533.     else
  2534.         SetWindowLong(consoleWindow, GWL_STYLE, GetWindowLong(consoleWindow, GWL_STYLE) & ~WS_MAXIMIZEBOX & ~WS_SIZEBOX & ~WS_VSCROLL);
  2535.  
  2536.  
  2537.     SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),  ENABLE_EXTENDED_FLAGS);
  2538.  
  2539.     _setmode(_fileno(stdout), _O_U8TEXT);
  2540.     SetConsoleTitleW(L"ŠAH");
  2541.     _setmode(_fileno(stdout), _O_TEXT);
  2542.  
  2543.     if(boja == SVETLO)
  2544.         system("color 23");
  2545.     else if(boja == TAMNO)
  2546.         system("color 56");
  2547.     else if(boja == SIVO)
  2548.         system("color 89");
  2549.  
  2550.     _CONSOLE_SCREEN_BUFFER_INFOEX info;
  2551.     info.cbSize = sizeof(info);
  2552.     HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  2553.     GetConsoleScreenBufferInfoEx(hConsole, &info);
  2554.  
  2555.     if(prviput2)
  2556.     {
  2557.         screenbuffer = info;
  2558.         prviput2 = 0;
  2559.     }
  2560.  
  2561.     info.dwSize = {36, 19};
  2562.     info.ColorTable[0] = RGB(242, 242, 242);
  2563.     info.ColorTable[1] = RGB(10, 10, 10);
  2564.     info.ColorTable[2] = RGB(198, 175, 141);
  2565.     info.ColorTable[3] = RGB(114, 71, 56);
  2566.     info.ColorTable[4] = RGB(50, 31, 26);
  2567.     info.ColorTable[5] = RGB(132, 94, 73);
  2568.     info.ColorTable[6] = RGB(73, 47, 37);
  2569.     info.ColorTable[7] = RGB(22, 11, 4);
  2570.     info.ColorTable[8] = RGB(158, 158, 158);
  2571.     info.ColorTable[9] = RGB(102, 102, 102);
  2572.     info.ColorTable[10] = RGB(43, 43, 43);
  2573.     info.ColorTable[11] = RGB(0, 119, 65);
  2574.     info.ColorTable[12] = RGB(126, 33, 35);
  2575.     info.ColorTable[13] = RGB(10, 10, 130);
  2576.     info.ColorTable[14] = RGB(240, 191, 40);
  2577.     info.ColorTable[15] = RGB(255, 255, 255);
  2578.  
  2579.     SetConsoleScreenBufferInfoEx(hConsole, &info);
  2580.     PodesiVelicinu(velicina);
  2581.     OdstampajKonzolu();
  2582.     SakriKursor();
  2583.     system("MODE 36, 18");
  2584. }
  2585.  
  2586. void PodesiKonzolu2()
  2587. {
  2588.     _CONSOLE_SCREEN_BUFFER_INFOEX info;
  2589.     info.cbSize = sizeof(info);
  2590.     HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
  2591.     GetConsoleScreenBufferInfoEx(hConsole, &info);
  2592.     info.dwSize = {36, 17};
  2593.     SetConsoleScreenBufferInfoEx(hConsole, &info);
  2594. }
  2595.  
  2596. void PodesiVelicinu(int i)
  2597. {
  2598.     CONSOLE_FONT_INFOEX cfi;
  2599.     cfi.cbSize = sizeof(cfi);
  2600.     cfi.nFont = 0;
  2601.     cfi.dwFontSize.X = 0;
  2602.     cfi.dwFontSize.Y = i;
  2603.     cfi.FontFamily = TMPF_TRUETYPE;
  2604.     cfi.FontWeight = FW_NORMAL;
  2605.     std::wcscpy(cfi.FaceName, L"MS Gothic");
  2606.     SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
  2607.  
  2608.     CentrirajKonzolu();
  2609.     CentrirajKonzolu();
  2610.     system("MODE 36, 18");
  2611.     PodesiKonzolu2();
  2612. }
  2613.  
  2614. void OdstampajTablu(Tabla tabla)
  2615. {
  2616.     HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
  2617.     _setmode(_fileno(stdout), _O_U8TEXT);
  2618.  
  2619.     for(int i = 0; i < 8; i++)
  2620.         for(int j = 0; j < 8; j++)
  2621.         {
  2622.             if(tabla.polje[i][j].stanjePolja == IZABRANO && tabla.polje[i][j].bojaFigure == CRNO)
  2623.                 SetConsoleTextAttribute(console, 177);
  2624.             else if(tabla.polje[i][j].stanjePolja == IZABRANO && tabla.polje[i][j].bojaFigure == BELO)
  2625.                 SetConsoleTextAttribute(console, 176);
  2626.             else if(tabla.polje[i][j].stanjePolja == NAPADNUTO && (tabla.polje[i][j].bojaFigure == CRNO || tabla.polje[i][j].bojaFigure == ZELENO))
  2627.                 SetConsoleTextAttribute(console, 193);
  2628.             else if(tabla.polje[i][j].stanjePolja == NAPADNUTO && tabla.polje[i][j].bojaFigure == BELO)
  2629.                 SetConsoleTextAttribute(console, 192);
  2630.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SVETLO && tabla.polje[i][j].bojaPolja == BELO)
  2631.                 SetConsoleTextAttribute(console, 32);
  2632.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SVETLO && tabla.polje[i][j].bojaPolja == BELO)
  2633.                 SetConsoleTextAttribute(console, 33);
  2634.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == TAMNO && tabla.polje[i][j].bojaPolja == BELO)
  2635.                 SetConsoleTextAttribute(console, 80);
  2636.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == TAMNO && tabla.polje[i][j].bojaPolja == BELO)
  2637.                 SetConsoleTextAttribute(console, 81);
  2638.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SIVO && tabla.polje[i][j].bojaPolja == BELO)
  2639.                 SetConsoleTextAttribute(console, 128);
  2640.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SIVO && tabla.polje[i][j].bojaPolja == BELO)
  2641.                 SetConsoleTextAttribute(console, 129);
  2642.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SVETLO && tabla.polje[i][j].bojaPolja == CRNO)
  2643.                 SetConsoleTextAttribute(console, 48);
  2644.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SVETLO && tabla.polje[i][j].bojaPolja == CRNO)
  2645.                 SetConsoleTextAttribute(console, 49);
  2646.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == TAMNO && tabla.polje[i][j].bojaPolja == CRNO)
  2647.                 SetConsoleTextAttribute(console, 96);
  2648.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == TAMNO && tabla.polje[i][j].bojaPolja == CRNO)
  2649.                 SetConsoleTextAttribute(console, 97);
  2650.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SIVO && tabla.polje[i][j].bojaPolja == CRNO)
  2651.                 SetConsoleTextAttribute(console, 144);
  2652.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SIVO && tabla.polje[i][j].bojaPolja == CRNO)
  2653.                 SetConsoleTextAttribute(console, 145);
  2654.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SVETLO && tabla.polje[i][j].bojaPolja == BELO)
  2655.                 SetConsoleTextAttribute(console, 43);
  2656.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == TAMNO && tabla.polje[i][j].bojaPolja == BELO)
  2657.                 SetConsoleTextAttribute(console, 91);
  2658.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SIVO && tabla.polje[i][j].bojaPolja == BELO)
  2659.                 SetConsoleTextAttribute(console, 139);
  2660.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SVETLO && tabla.polje[i][j].bojaPolja == CRNO)
  2661.                 SetConsoleTextAttribute(console, 59);
  2662.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == TAMNO && tabla.polje[i][j].bojaPolja == CRNO)
  2663.                 SetConsoleTextAttribute(console, 107);
  2664.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SIVO && tabla.polje[i][j].bojaPolja == CRNO)
  2665.                 SetConsoleTextAttribute(console, 155);
  2666.  
  2667.             gotoxy(10 + j * 2, 3 + i);
  2668.             wprintf(tabla.polje[i][j].figura);
  2669.         }
  2670.  
  2671.     OdstampajLevoDesno(tabla);
  2672. }
  2673.  
  2674. void ObrnutoOdstampajTablu(Tabla tabla)
  2675. {
  2676.     HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
  2677.     _setmode(_fileno(stdout), _O_U8TEXT);
  2678.  
  2679.     for(int i = 0; i < 8; i++)
  2680.         for(int j = 0; j < 8; j++)
  2681.         {
  2682.             if(tabla.polje[i][j].stanjePolja == IZABRANO && tabla.polje[i][j].bojaFigure == CRNO)
  2683.                 SetConsoleTextAttribute(console, 177);
  2684.             else if(tabla.polje[i][j].stanjePolja == IZABRANO && tabla.polje[i][j].bojaFigure == BELO)
  2685.                 SetConsoleTextAttribute(console, 176);
  2686.             else if(tabla.polje[i][j].stanjePolja == NAPADNUTO && tabla.polje[i][j].bojaFigure == CRNO)
  2687.                 SetConsoleTextAttribute(console, 193);
  2688.             else if(tabla.polje[i][j].stanjePolja == NAPADNUTO && tabla.polje[i][j].bojaFigure == BELO)
  2689.                 SetConsoleTextAttribute(console, 192);
  2690.             else if(tabla.polje[i][j].stanjePolja == NAPADNUTO && !wcscmp(tabla.polje[i][j].figura, PRAZNO))
  2691.                 SetConsoleTextAttribute(console, 192);
  2692.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SVETLO && tabla.polje[i][j].bojaPolja == BELO)
  2693.                 SetConsoleTextAttribute(console, 32);
  2694.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SVETLO && tabla.polje[i][j].bojaPolja == BELO)
  2695.                 SetConsoleTextAttribute(console, 33);
  2696.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == TAMNO && tabla.polje[i][j].bojaPolja == BELO)
  2697.                 SetConsoleTextAttribute(console, 80);
  2698.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == TAMNO && tabla.polje[i][j].bojaPolja == BELO)
  2699.                 SetConsoleTextAttribute(console, 81);
  2700.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SIVO && tabla.polje[i][j].bojaPolja == BELO)
  2701.                 SetConsoleTextAttribute(console, 128);
  2702.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SIVO && tabla.polje[i][j].bojaPolja == BELO)
  2703.                 SetConsoleTextAttribute(console, 129);
  2704.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SVETLO && tabla.polje[i][j].bojaPolja == CRNO)
  2705.                 SetConsoleTextAttribute(console, 48);
  2706.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SVETLO && tabla.polje[i][j].bojaPolja == CRNO)
  2707.                 SetConsoleTextAttribute(console, 49);
  2708.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == TAMNO && tabla.polje[i][j].bojaPolja == CRNO)
  2709.                 SetConsoleTextAttribute(console, 96);
  2710.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == TAMNO && tabla.polje[i][j].bojaPolja == CRNO)
  2711.                 SetConsoleTextAttribute(console, 97);
  2712.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SIVO && tabla.polje[i][j].bojaPolja == CRNO)
  2713.                 SetConsoleTextAttribute(console, 144);
  2714.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SIVO && tabla.polje[i][j].bojaPolja == CRNO)
  2715.                 SetConsoleTextAttribute(console, 145);
  2716.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SVETLO && tabla.polje[i][j].bojaPolja == BELO)
  2717.                 SetConsoleTextAttribute(console, 43);
  2718.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == TAMNO && tabla.polje[i][j].bojaPolja == BELO)
  2719.                 SetConsoleTextAttribute(console, 91);
  2720.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SIVO && tabla.polje[i][j].bojaPolja == BELO)
  2721.                 SetConsoleTextAttribute(console, 139);
  2722.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SVETLO && tabla.polje[i][j].bojaPolja == CRNO)
  2723.                 SetConsoleTextAttribute(console, 59);
  2724.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == TAMNO && tabla.polje[i][j].bojaPolja == CRNO)
  2725.                 SetConsoleTextAttribute(console, 107);
  2726.             else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SIVO && tabla.polje[i][j].bojaPolja == CRNO)
  2727.                 SetConsoleTextAttribute(console, 155);
  2728.  
  2729.             gotoxy(24 - j * 2, 10 - i);
  2730.             wprintf(tabla.polje[i][j].figura);
  2731.         }
  2732.  
  2733.     OdstampajLevoDesno(tabla);
  2734. }
  2735.  
  2736. void OdstampajLevoDesno(Tabla tabla)
  2737. {
  2738.     HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
  2739.     _setmode(_fileno(stdout), _O_U8TEXT);
  2740.  
  2741.     for(int i = 0; i < 8; i++)
  2742.         for(int j = 0; j < 2; j++)
  2743.         {
  2744.             if(boja == SVETLO)
  2745.                 SetConsoleTextAttribute(console, 81);
  2746.             else if(boja == TAMNO)
  2747.                 SetConsoleTextAttribute(console, 97);
  2748.             else if(boja == SIVO)
  2749.                 SetConsoleTextAttribute(console, 145);
  2750.  
  2751.             gotoxy(2 + j * 2, 3 + i);
  2752.             wprintf(tabla.levo[i][j].figura);
  2753.         }
  2754.  
  2755.     for(int i = 0; i < 8; i++)
  2756.         for(int j = 0; j < 2; j++)
  2757.         {
  2758.             if(boja == SVETLO)
  2759.                 SetConsoleTextAttribute(console, 80);
  2760.             else if(boja == TAMNO)
  2761.                 SetConsoleTextAttribute(console, 96);
  2762.             else if(boja == SIVO)
  2763.                 SetConsoleTextAttribute(console, 144);
  2764.  
  2765.             gotoxy(30 + j * 2, 3 + i);
  2766.             wprintf(tabla.desno[i][j].figura);
  2767.         }
  2768.  
  2769.     if(boja == SVETLO)
  2770.         SetConsoleTextAttribute(console, 68);
  2771.     else if(boja == TAMNO)
  2772.         SetConsoleTextAttribute(console, 119);
  2773.     else if(boja == SIVO)
  2774.         SetConsoleTextAttribute(console, 170);
  2775.  
  2776.  
  2777.     gotoxy(26, 3);
  2778.     wprintf(L"██");
  2779.     gotoxy(26, 4);
  2780.     wprintf(L"██");
  2781.     gotoxy(26, 5);
  2782.     wprintf(L"██");
  2783.     gotoxy(26, 6);
  2784.     wprintf(L"██");
  2785.     gotoxy(26, 7);
  2786.     wprintf(L"██");
  2787.     gotoxy(26, 8);
  2788.     wprintf(L"██");
  2789.     gotoxy(26, 9);
  2790.     wprintf(L"██");
  2791.     gotoxy(26, 10);
  2792.     wprintf(L"██");
  2793. }
  2794.  
  2795. void PozicijaNaTabli(int &x, int &y)
  2796. {
  2797.     switch(x)
  2798.     {
  2799.         case 10:
  2800.         case 11:
  2801.             x = 0;
  2802.             break;
  2803.  
  2804.         case 12:
  2805.         case 13:
  2806.             x = 1;
  2807.             break;
  2808.  
  2809.         case 14:
  2810.         case 15:
  2811.             x = 2;
  2812.             break;
  2813.  
  2814.         case 16:
  2815.         case 17:
  2816.             x = 3;
  2817.             break;
  2818.  
  2819.         case 18:
  2820.         case 19:
  2821.             x = 4;
  2822.             break;
  2823.  
  2824.         case 20:
  2825.         case 21:
  2826.             x = 5;
  2827.             break;
  2828.  
  2829.         case 22:
  2830.         case 23:
  2831.             x = 6;
  2832.             break;
  2833.  
  2834.         case 24:
  2835.         case 25:
  2836.             x = 7;
  2837.     }
  2838.  
  2839.     switch(y)
  2840.     {
  2841.         case 10:
  2842.             y = 7;
  2843.             break;
  2844.  
  2845.         case 9:
  2846.             y = 6;
  2847.             break;
  2848.  
  2849.         case 8:
  2850.             y = 5;
  2851.             break;
  2852.  
  2853.         case 7:
  2854.             y = 4;
  2855.             break;
  2856.  
  2857.         case 6:
  2858.             y = 3;
  2859.             break;
  2860.  
  2861.         case 5:
  2862.             y = 2;
  2863.             break;
  2864.  
  2865.         case 4:
  2866.             y = 1;
  2867.             break;
  2868.  
  2869.         case 3:
  2870.             y = 0;
  2871.     }
  2872. }
  2873.  
  2874. void ObrnutaPozicijaNaTabli(int &x, int &y)
  2875. {
  2876.     switch(x)
  2877.     {
  2878.         case 10:
  2879.         case 11:
  2880.             x = 7;
  2881.             break;
  2882.  
  2883.         case 12:
  2884.         case 13:
  2885.             x = 6;
  2886.             break;
  2887.  
  2888.         case 14:
  2889.         case 15:
  2890.             x = 5;
  2891.             break;
  2892.  
  2893.         case 16:
  2894.         case 17:
  2895.             x = 4;
  2896.             break;
  2897.  
  2898.         case 18:
  2899.         case 19:
  2900.             x = 3;
  2901.             break;
  2902.  
  2903.         case 20:
  2904.         case 21:
  2905.             x = 2;
  2906.             break;
  2907.  
  2908.         case 22:
  2909.         case 23:
  2910.             x = 1;
  2911.             break;
  2912.  
  2913.         case 24:
  2914.         case 25:
  2915.             x = 0;
  2916.     }
  2917.  
  2918.     switch(y)
  2919.     {
  2920.         case 10:
  2921.             y = 0;
  2922.             break;
  2923.  
  2924.         case 9:
  2925.             y = 1;
  2926.             break;
  2927.  
  2928.         case 8:
  2929.             y = 2;
  2930.             break;
  2931.  
  2932.         case 7:
  2933.             y = 3;
  2934.             break;
  2935.  
  2936.         case 6:
  2937.             y = 4;
  2938.             break;
  2939.  
  2940.         case 5:
  2941.             y = 5;
  2942.             break;
  2943.  
  2944.         case 4:
  2945.             y = 6;
  2946.             break;
  2947.  
  2948.         case 3:
  2949.             y = 7;
  2950.     }
  2951. }
  2952.  
  2953. void NoviPotez(Tabla &tabla)
  2954. {
  2955.     for(int a = 0; a < 8; a++)
  2956.         for(int b = 0; b < 8; b++)
  2957.         {
  2958.             if(tabla.polje[a][b].stanjePolja == IZABRANO)
  2959.                 tabla.polje[a][b].stanjePolja = NEUTRALNO;
  2960.  
  2961.             if(tabla.polje[a][b].stanjePolja == NAPADNUTO)
  2962.                 tabla.polje[a][b].stanjePolja = NEUTRALNO;
  2963.  
  2964.             if(!wcscmp(tabla.polje[a][b].figura, TACKA))
  2965.                 wcscpy(tabla.polje[a][b].figura, PRAZNO);
  2966.  
  2967.             if(!wcscmp(tabla.polje[a][b].figura, PRAZNO))
  2968.                 tabla.polje[a][b].bojaFigure = ZELENO;
  2969.         }
  2970. }
  2971.  
  2972. void ObrisiAnpasan(Tabla &tabla)
  2973. {
  2974.     for(int a = 0; a < 8; a++)
  2975.         for(int b = 0; b < 8; b++)
  2976.             if(tabla.polje[a][b].anpasan == UKLJUCENO)
  2977.                 tabla.polje[a][b].anpasan = ISKLJUCENO;
  2978.  
  2979. }
  2980.  
  2981. void PozicijaIzabranog(int &xizb, int &yizb, Tabla tabla)
  2982. {
  2983.     for(int a = 0; a < 8; a++)
  2984.         for(int b = 0; b < 8; b++)
  2985.             if(tabla.polje[a][b].stanjePolja == IZABRANO)
  2986.             {
  2987.                 yizb = a;
  2988.                 xizb = b;
  2989.                 return;
  2990.             }
  2991. }
  2992.  
  2993. short JelUnutarTable(int x, int y)
  2994. {
  2995.     if(x >= 0 && x <= 7 && y >= 0 && y <= 7)
  2996.         return 1;
  2997.     else
  2998.         return 0;
  2999. }
  3000.  
  3001. void OdstampajKonzolu()
  3002. {
  3003.     HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
  3004.     _setmode(_fileno(stdout), _O_U8TEXT);
  3005.  
  3006.     gotoxy(0, 0);
  3007.  
  3008.     if(boja == SVETLO)
  3009.         SetConsoleTextAttribute(console, 45);
  3010.     else if(boja == TAMNO)
  3011.         SetConsoleTextAttribute(console, 93);
  3012.     else if(boja == SIVO)
  3013.         SetConsoleTextAttribute(console, 141);
  3014.  
  3015.     wprintf(L"");  // save
  3016.  
  3017.     if(boja == SVETLO)
  3018.         SetConsoleTextAttribute(console, 46);
  3019.     else if(boja == TAMNO)
  3020.         SetConsoleTextAttribute(console, 94);
  3021.     else if(boja == SIVO)
  3022.         SetConsoleTextAttribute(console, 142);
  3023.  
  3024.     wprintf(L"");  // open
  3025.  
  3026.     if(boja == SVETLO)
  3027.         SetConsoleTextAttribute(console, 44);
  3028.     else if(boja == TAMNO)
  3029.         SetConsoleTextAttribute(console, 92);
  3030.     else if(boja == SIVO)
  3031.         SetConsoleTextAttribute(console, 140);
  3032.  
  3033.     wprintf(L"");  // restart      
  3034.  
  3035.     if(boja == SVETLO)
  3036.         SetConsoleTextAttribute(console, 36);
  3037.     else if(boja == TAMNO)
  3038.         SetConsoleTextAttribute(console, 87);
  3039.     else if(boja == SIVO)
  3040.         SetConsoleTextAttribute(console, 138);
  3041.  
  3042.     // gear 
  3043.     wprintf(L"");  // color
  3044.     wprintf(L"");  // resize
  3045.     wprintf(L"");  // back
  3046.     wprintf(L"                  "); // space
  3047.  
  3048.     if(rotacija == UKLJUCENO)
  3049.         wprintf(L"");  // rotation 
  3050.     else
  3051.         wprintf(L"");  // rotation 
  3052.  
  3053.     if(boja == SVETLO)
  3054.         SetConsoleTextAttribute(console, 47);
  3055.     else if(boja == TAMNO)
  3056.         SetConsoleTextAttribute(console, 95);
  3057.     else if(boja == SIVO)
  3058.         SetConsoleTextAttribute(console, 143);
  3059.  
  3060.     wprintf(L"");  // info
  3061.  
  3062.     if(boja == SVETLO)
  3063.         SetConsoleTextAttribute(console, 44);
  3064.     else if(boja == TAMNO)
  3065.         SetConsoleTextAttribute(console, 92);
  3066.     else if(boja == SIVO)
  3067.         SetConsoleTextAttribute(console, 140);
  3068.  
  3069.     wprintf(L"\n");  // quit
  3070.  
  3071.     if(boja == SVETLO)
  3072.         SetConsoleTextAttribute(console, 36);
  3073.     else if(boja == TAMNO)
  3074.         SetConsoleTextAttribute(console, 87);
  3075.     else if(boja == SIVO)
  3076.         SetConsoleTextAttribute(console, 138);
  3077.  
  3078.     wprintf(L"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n");
  3079.     wprintf(L"┏━━━━━┓                     ┏━━━━━┓ \n");
  3080.     wprintf(L"┃     ┃                     ┃     ┃ \n");
  3081.     wprintf(L"┃     ┃                     ┃     ┃ \n");
  3082.     wprintf(L"┃     ┃                     ┃     ┃ \n");
  3083.     wprintf(L"┃     ┃                     ┃     ┃ \n");
  3084.     wprintf(L"┃     ┃                     ┃     ┃ \n");
  3085.     wprintf(L"┃     ┃                     ┃     ┃ \n");
  3086.     wprintf(L"┃     ┃                     ┃     ┃ \n");
  3087.     wprintf(L"┃     ┃                     ┃     ┃ \n");
  3088.     wprintf(L"┗━━━━━┛                     ┗━━━━━┛ \n");
  3089.     wprintf(L"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ \n");
  3090.     wprintf(L"┃                                 ┃ \n");
  3091.     wprintf(L"┃                                 ┃ \n");
  3092.     wprintf(L"┃                                 ┃ \n");
  3093.     wprintf(L"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ");
  3094.  
  3095.     ObrisiTerminal();
  3096.  
  3097.     if(boja == SVETLO)
  3098.         SetConsoleTextAttribute(console, 68);
  3099.     else if(boja == TAMNO)
  3100.         SetConsoleTextAttribute(console, 119);
  3101.     else if(boja == SIVO)
  3102.         SetConsoleTextAttribute(console, 170);
  3103.  
  3104.     gotoxy(8, 2);
  3105.     wprintf(L"████████████████████");
  3106.     gotoxy(8, 3);
  3107.     wprintf(L"██");
  3108.     gotoxy(8, 4);
  3109.     wprintf(L"██");
  3110.     gotoxy(8, 5);
  3111.     wprintf(L"██");
  3112.     gotoxy(8, 6);
  3113.     wprintf(L"██");
  3114.     gotoxy(8, 7);
  3115.     wprintf(L"██");
  3116.     gotoxy(8, 8);
  3117.     wprintf(L"██");
  3118.     gotoxy(8, 9);
  3119.     wprintf(L"██");
  3120.     gotoxy(8, 10);
  3121.     wprintf(L"██");
  3122.     gotoxy(26, 3);
  3123.     wprintf(L"██");
  3124.     gotoxy(26, 4);
  3125.     wprintf(L"██");
  3126.     gotoxy(26, 5);
  3127.     wprintf(L"██");
  3128.     gotoxy(26, 6);
  3129.     wprintf(L"██");
  3130.     gotoxy(26, 7);
  3131.     wprintf(L"██");
  3132.     gotoxy(26, 8);
  3133.     wprintf(L"██");
  3134.     gotoxy(26, 9);
  3135.     wprintf(L"██");
  3136.     gotoxy(26, 10);
  3137.     wprintf(L"██");
  3138.     gotoxy(8, 11);
  3139.     wprintf(L"████████████████████");
  3140. }
  3141.  
  3142. void OsveziTablu(Tabla tabla)
  3143. {
  3144.     if((brPoteza % 2 && rotacija == UKLJUCENO && JelMozeIgratiCrni(tabla)) || (!JelMozeIgratiBeli(tabla) && rotacija == UKLJUCENO && brPoteza % 2 == 0))
  3145.     {
  3146.         if(sacekaj == UKLJUCENO && JelMozeIgratiBeli(tabla))
  3147.         {
  3148.             OdstampajTablu(tabla);
  3149.             Sleep(260);
  3150.         }
  3151.  
  3152.         ObrnutoOdstampajTablu(tabla);
  3153.     }
  3154.     else
  3155.     {
  3156.         if(sacekaj == UKLJUCENO && rotacija == UKLJUCENO && JelMozeIgratiCrni(tabla))
  3157.         {
  3158.             ObrnutoOdstampajTablu(tabla);
  3159.             Sleep(260);
  3160.         }
  3161.  
  3162.         OdstampajTablu(tabla);
  3163.     }
  3164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement