Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _WIN32_WINNT 0x0600
- #include <vector>
- #include <fstream>
- #include <conio.h>
- #include <fcntl.h>
- #include <windows.h>
- #define _O_U8TEXT 0x40000
- #define SVETLO 0
- #define TAMNO 1
- #define SIVO 2
- #define BELO 0
- #define CRNO 1
- #define ISKLJUCENO 0
- #define UKLJUCENO 1
- #define ZELENO 2
- #define NEUTRALNO 0
- #define IZABRANO 1
- #define NAPADNUTO 2
- #define TOP L"♜ "
- #define KONJ L"♞ "
- #define LOVAC L"♝ "
- #define KRALJICA L"♛ "
- #define KRALJ L"♚ "
- #define PIJUN L"♟ "
- #define PRAZNO L" "
- #define TACKA L""
- using namespace std;
- typedef struct _CONSOLE_SCREEN_BUFFER_INFOEX
- {
- ULONG cbSize;
- COORD dwSize;
- COORD dwCursorPosition;
- WORD wAttributes;
- SMALL_RECT srWindow;
- COORD dwMaximumWindowSize;
- WORD wPopupAttributes;
- BOOL bFullscreenSupported;
- COLORREF ColorTable[16];
- } CONSOLE_SCREEN_BUFFER_INFOEX, *PCONSOLE_SCREEN_BUFFER_INFOEX;
- typedef struct _CONSOLE_FONT_INFOEX
- {
- ULONG cbSize;
- DWORD nFont;
- COORD dwFontSize;
- UINT FontFamily;
- UINT FontWeight;
- WCHAR FaceName[LF_FACESIZE];
- } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;
- #ifdef __cplusplus
- extern "C" {
- #endif
- BOOL WINAPI SetCurrentConsoleFontEx(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
- #ifdef __cplusplus
- }
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- BOOL WINAPI GetConsoleScreenBufferInfoEx(HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx);
- #ifdef __cplusplus
- }
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- BOOL WINAPI SetConsoleScreenBufferInfoEx(HANDLE hConsoleOutput, PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx);
- #ifdef __cplusplus
- }
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- BOOL WINAPI GetCurrentConsoleFontEx(HANDLE hConsoleOutput, BOOL bMaximumWindow, PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx);
- #ifdef __cplusplus
- }
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif
- BOOL WINAPI GetConsoleCursorInfo(HANDLE hConsoleOutput, PCONSOLE_CURSOR_INFO lpConsoleCursorInfo);
- #ifdef __cplusplus
- }
- #endif
- void SakriKursor();
- void ObrisiEkran();
- void gotoxy(int x, int y);
- int UcitajKlik(int &x, int &y);
- void CentrirajKonzolu();
- void CentrirajKonzolu2();
- short prviput1 = 1;
- short prviput2 = 1;
- short prviput3 = 1;
- short boja = SVETLO;
- short rotacija = ISKLJUCENO;
- short sacekaj;
- short velicina = 29;
- long long int brPoteza = 0;
- long winlog;
- _CONSOLE_SCREEN_BUFFER_INFOEX screenbuffer;
- CONSOLE_CURSOR_INFO kursor;
- typedef struct
- {
- short bojaPolja;
- short stanjePolja;
- wchar_t figura[4];
- short bojaFigure;
- short anpasan;
- } Polje;
- typedef struct
- {
- Polje polje[8][8];
- Polje levo[8][2];
- Polje desno[8][2];
- short brlevo;
- short brdesno;
- short malarbeli;
- short velikarbeli;
- short malarcrni;
- short velikarcrni;
- short krajigre;
- } Tabla;
- void OsveziTablu(Tabla tabla);
- void PodesiKonzolu();
- void PodesiKonzolu2();
- void NapraviTablu(Tabla &tabla);
- void OdstampajTablu(Tabla tabla);
- void OdstampajKonzolu();
- void PozicijaNaTabli(int &x, int &y);
- void NoviPotez(Tabla &tabla);
- void PozicijaIzabranog(int &xizb, int &yizb, Tabla tabla);
- short JelUnutarTable(int x, int y);
- void OdstampajLevoDesno(Tabla tabla);
- void ObrnutoOdstampajTablu(Tabla tabla);
- void ObrnutaPozicijaNaTabli(int &x, int &y);
- void ObrisiAnpasan(Tabla &tabla);
- void PodesiVelicinu(int i);
- BOOL RegDelnodeRecurse (HKEY hKeyRoot, LPTSTR lpSubKey);
- BOOL RegDelnode(HKEY hKeyRoot, LPCTSTR lpSubKey);
- void ObrisiTerminal();
- Tabla StaviFiguruNaXY(Tabla tabla, int x, int y);
- short JelSahBeli(Tabla tabla, int xpomeraj, int ypomeraj);
- short JelSahCrni(Tabla tabla, int xpomeraj, int ypomeraj);
- short PostaviKralja(Tabla &tabla, int x, int y);
- short PostaviPijuna(Tabla &tabla, int x, int y);
- short PostaviKonja(Tabla &tabla, int x, int y);
- short PostaviTopa(Tabla &tabla, int x, int y);
- short PostaviLovca(Tabla &tabla, int x, int y);
- short PostaviKraljicu(Tabla &tabla, int x, int y);
- short JelMozeIgratiBeli(Tabla tabla);
- short JelMozeIgratiCrni(Tabla tabla);
- short ZameniPijuna();
- int FiguraUBroj(wchar_t figura[]);
- wchar_t* BrojUFiguru(int broj);
- vector<short> NapraviSacuvaj(vector<Tabla> istorija);
- void SacuvajIgru(vector<Tabla> istorija);
- void OdaberiVelicinu();
- void AnimacijaUcitaj();
- int main()
- {
- SetConsoleOutputCP(852);
- Tabla tabla;
- NapraviTablu(tabla);
- vector<Tabla> istorija(0);
- istorija.push_back(tabla);
- AnimacijaUcitaj();
- PodesiKonzolu();
- CentrirajKonzolu();
- PodesiKonzolu2();
- OdstampajKonzolu();
- OdstampajTablu(tabla);
- int x, y, xizb, yizb, cek = 1;
- HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
- _setmode(_fileno(stdout), _O_U8TEXT);
- while(1)
- {
- sacekaj = ISKLJUCENO;
- SetConsoleTextAttribute(console, 82);
- UcitajKlik(x, y);
- ObrisiTerminal();
- cek = 1;
- if(y == 0 && (x == 4 || x == 5))
- {
- NapraviTablu(tabla);
- istorija.clear();
- istorija.push_back(tabla);
- brPoteza = 0;
- NoviPotez(tabla);
- ObrisiTerminal();
- OsveziTablu(tabla);
- }
- else if(y == 0 && (x == 0 || x == 1))
- {
- SacuvajIgru(istorija);
- }
- else if(y == 0 && (x == 2 || x == 3))
- {
- char ime[18], zn;
- short pom;
- ObrisiTerminal();
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleCursorInfo(hConsole, &kursor);
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 152);
- _setmode(_fileno(stdout), _O_TEXT);
- gotoxy(4, 14);
- printf("Ime igre: ");
- for(int i = 0; i < 18; i++)
- {
- zn = getch();
- if((zn == 13 && i != 0) || i == 14)
- {
- Sleep(100);
- SakriKursor();
- ime[i] = '\0';
- break;
- }
- else if(zn == 8)
- {
- gotoxy(14 + i, 14);
- putch(' ');
- gotoxy(14 + i, 14);
- i -= 2;
- }
- else
- {
- gotoxy(15 + i, 14);
- putch(zn);
- ime[i] = zn;
- }
- }
- ObrisiTerminal();
- ifstream ulaz (strcat(ime, ".igra"));
- if(ulaz.is_open())
- {
- ulaz >> brPoteza;
- istorija.clear();
- for(int a = 0; a <= brPoteza; a++)
- {
- ulaz >> tabla.brlevo;
- ulaz >> tabla.brdesno;
- ulaz >> tabla.krajigre;
- ulaz >> tabla.malarbeli;
- ulaz >> tabla.malarcrni;
- ulaz >> tabla.velikarbeli;
- ulaz >> tabla.velikarcrni;
- for(int i = 0; i < 16; i++)
- {
- ulaz >> pom;
- wcscpy(tabla.levo[i / 2][i % 2].figura, BrojUFiguru(pom));
- ulaz >> pom;
- wcscpy(tabla.desno[i / 2][i % 2].figura, BrojUFiguru(pom));
- }
- for(int i = 0; i < 8; i++)
- for(int j = 0; j < 8; j++)
- {
- ulaz >> tabla.polje[i][j].anpasan;
- ulaz >> tabla.polje[i][j].bojaFigure;
- ulaz >> pom;
- wcscpy(tabla.polje[i][j].figura, BrojUFiguru(pom));
- ulaz >> tabla.polje[i][j].stanjePolja;
- }
- istorija.push_back(tabla);
- }
- ulaz.close();
- }
- else
- {
- ObrisiTerminal();
- gotoxy(4, 14);
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 152);
- _setmode(_fileno(stdout), _O_U8TEXT);
- wprintf(L"Ne postoji igra sa tim imenom");
- cek = 0;
- }
- OsveziTablu(tabla);
- }
- else if(y == 0 && (x == 6 || x == 7))
- {
- boja++;
- if(boja == 3)
- boja = 0;
- OdstampajKonzolu();
- NoviPotez(tabla);
- OsveziTablu(tabla);
- }
- else if(y == 0 && (x == 8 || x == 9))
- {
- short pom = velicina;
- OdaberiVelicinu();
- if(pom != velicina)
- {
- PodesiVelicinu(velicina);
- OdstampajKonzolu();
- OsveziTablu(tabla);
- }
- }
- else if(y == 0 && (x == 10 || x == 11) && brPoteza > 0)
- {
- tabla = istorija[brPoteza - 1];
- istorija.erase(istorija.begin() + brPoteza);
- brPoteza--;
- ObrisiTerminal();
- OsveziTablu(tabla);
- }
- else if(y == 0 && (x == 30 || x == 31))
- {
- if(rotacija == UKLJUCENO)
- {
- rotacija = ISKLJUCENO;
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 36);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 87);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 138);
- gotoxy(30, 0);
- wprintf(L"");
- }
- else
- {
- rotacija = UKLJUCENO;
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 36);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 87);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 138);
- gotoxy(30, 0);
- wprintf(L"");
- }
- NoviPotez(tabla);
- OsveziTablu(tabla);
- }
- else if(y == 0 && (x == 32 || x == 33))
- {
- int a, b;
- SetConsoleTextAttribute(console, 255);
- for(int i = 0; i < 20; i++)
- wprintf(L"\t\t\t\t\t\t");
- SetConsoleTextAttribute(console, 241);
- gotoxy(0, 1);
- wprintf(L"\t\tŠAH");
- wprintf(L"\n\n\n Autor:");
- wprintf(L"\n\n Momir Stanišić,");
- wprintf(L"\n CMD Game Developer");
- wprintf(L"\n\n\n\n Verzija: 1.0.2");
- UcitajKlik(a, b);
- OdstampajKonzolu();
- OdstampajTablu(tabla);
- }
- else if(y == 0 && (x == 35 || x == 34))
- {
- RegDelnode(HKEY_CURRENT_USER, TEXT("Console"));
- char str[20];
- istorija.clear();
- SetConsoleTextAttribute(console, 34);
- for(int i = 0; i < 20; i++)
- wprintf(L"\t\t\t\t\t\t");
- SetConsoleTextAttribute(console, 35);
- gotoxy(13, 6);
- wprintf(L"DOVIĐENJA!");
- Sleep(1000);
- for(int i = 0; i < 18; i++)
- {
- sprintf(str, "MODE 36, %d", 18 - i);
- system(str);
- }
- HWND consoleWindow = GetConsoleWindow();
- ShowWindow(consoleWindow, SW_HIDE);
- return 0;
- }
- else if(y > 2 && y < 11 && x > 9 && x < 26 && tabla.krajigre == 0)
- {
- if(brPoteza % 2 && rotacija == UKLJUCENO && JelMozeIgratiCrni(tabla))
- ObrnutaPozicijaNaTabli(x, y);
- else
- PozicijaNaTabli(x, y);
- if(tabla.polje[y][x].stanjePolja == NAPADNUTO && wcscmp(tabla.polje[y][x].figura, KRALJ))
- {
- PozicijaIzabranog(xizb, yizb, tabla);
- if(tabla.polje[yizb][xizb].bojaFigure == BELO && tabla.brlevo < 8)
- {
- if(tabla.polje[y + 1][x].anpasan == UKLJUCENO)
- {
- wcscpy(tabla.levo[tabla.brlevo / 2][tabla.brlevo % 2].figura, PIJUN);
- wcscpy(tabla.polje[y + 1][x].figura, PRAZNO);
- }
- else
- wcscpy(tabla.levo[tabla.brlevo / 2][tabla.brlevo % 2].figura, tabla.polje[y][x].figura);
- tabla.brlevo++;
- }
- else if(tabla.brdesno < 8)
- {
- if(tabla.polje[y - 1][x].anpasan == UKLJUCENO)
- {
- wcscpy(tabla.desno[tabla.brdesno / 2][tabla.brdesno % 2].figura, PIJUN);
- wcscpy(tabla.polje[y - 1][x].figura, PRAZNO);
- }
- else
- wcscpy(tabla.desno[tabla.brdesno / 2][tabla.brdesno % 2].figura, tabla.polje[y][x].figura);
- tabla.brdesno++;
- }
- if((xizb == 7 && yizb == 7) || (x == 7 && y == 7))
- tabla.malarbeli = ISKLJUCENO;
- else if((xizb == 0 && yizb == 7) || (x == 0 && y == 7))
- tabla.velikarbeli = ISKLJUCENO;
- else if((xizb == 0 && yizb == 0) || (x == 0 && y == 0))
- tabla.velikarcrni = ISKLJUCENO;
- else if((xizb == 7 && yizb == 0) || (x == 7 && y == 0))
- tabla.malarcrni = ISKLJUCENO;
- else if(xizb == 4 && yizb == 7)
- {
- tabla.malarbeli = ISKLJUCENO;
- tabla.velikarbeli = ISKLJUCENO;
- }
- else if(xizb == 4 && yizb == 0)
- {
- tabla.malarcrni = ISKLJUCENO;
- tabla.velikarcrni = ISKLJUCENO;
- }
- wcscpy(tabla.polje[y][x].figura, tabla.polje[yizb][xizb].figura);
- wcscpy(tabla.polje[yizb][xizb].figura, PRAZNO);
- tabla.polje[y][x].bojaFigure = tabla.polje[yizb][xizb].bojaFigure;
- NoviPotez(tabla);
- ObrisiAnpasan(tabla);
- if(!wcscmp(tabla.polje[y][x].figura, PIJUN) && ((tabla.polje[y][x].bojaFigure == BELO && y == 0) || (tabla.polje[y][x].bojaFigure == CRNO && y == 7)))
- {
- OdstampajTablu(tabla);
- short zamena = ZameniPijuna();
- switch(zamena)
- {
- case 0:
- wcscpy(tabla.polje[y][x].figura, KRALJICA);
- break;
- case 1:
- wcscpy(tabla.polje[y][x].figura, TOP);
- break;
- case 2:
- wcscpy(tabla.polje[y][x].figura, LOVAC);
- break;
- case 3:
- wcscpy(tabla.polje[y][x].figura, KONJ);
- }
- }
- if(JelSahBeli(tabla, 0, 0))
- for(int i = 0; i < 64; i++)
- if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == BELO)
- tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
- if(JelSahCrni(tabla, 0, 0))
- for(int i = 0; i < 64; i++)
- if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == CRNO)
- tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
- Sleep(260);
- OsveziTablu(tabla);
- NoviPotez(tabla);
- if(JelSahBeli(tabla, 0, 0))
- for(int i = 0; i < 64; i++)
- if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == BELO)
- {
- tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
- OsveziTablu(tabla);
- break;
- }
- if(JelSahCrni(tabla, 0, 0))
- for(int i = 0; i < 64; i++)
- if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == CRNO)
- {
- tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
- OsveziTablu(tabla);
- break;
- }
- istorija.push_back(tabla);
- brPoteza++;
- sacekaj = UKLJUCENO;
- }
- else if(!wcscmp(tabla.polje[y][x].figura, KRALJ))
- {
- if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
- {
- NoviPotez(tabla);
- PostaviKralja(tabla, x, y);
- }
- else
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, PIJUN))
- {
- if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
- {
- NoviPotez(tabla);
- PostaviPijuna(tabla, x, y);
- }
- else
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, KONJ))
- {
- if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
- {
- NoviPotez(tabla);
- PostaviKonja(tabla, x, y);
- }
- else
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, TOP))
- {
- if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
- {
- NoviPotez(tabla);
- PostaviTopa(tabla, x, y);
- }
- else
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, LOVAC))
- {
- if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
- {
- NoviPotez(tabla);
- PostaviLovca(tabla, x, y);
- }
- else
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, KRALJICA))
- {
- if((tabla.polje[y][x].bojaFigure == BELO && brPoteza % 2 == 0) || (tabla.polje[y][x].bojaFigure == CRNO && brPoteza % 2 == 1))
- {
- NoviPotez(tabla);
- PostaviKraljicu(tabla, x, y);
- }
- else
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, PRAZNO))
- NoviPotez(tabla);
- else if(!wcscmp(tabla.polje[y][x].figura, TACKA))
- {
- PozicijaIzabranog(xizb, yizb, tabla);
- wcscpy(tabla.polje[y][x].figura, tabla.polje[yizb][xizb].figura);
- wcscpy(tabla.polje[yizb][xizb].figura, PRAZNO);
- tabla.polje[y][x].bojaFigure = tabla.polje[yizb][xizb].bojaFigure;
- ObrisiAnpasan(tabla);
- if(tabla.malarbeli == UKLJUCENO && xizb == 4 && yizb == 7 && x == 6 && y == 7)
- {
- wcscpy(tabla.polje[7][7].figura, PRAZNO);
- wcscpy(tabla.polje[7][5].figura, TOP);
- tabla.polje[7][5].bojaFigure = BELO;
- }
- if(tabla.velikarbeli == UKLJUCENO && xizb == 4 && yizb == 7 && x == 1 && y == 7)
- {
- wcscpy(tabla.polje[7][0].figura, PRAZNO);
- wcscpy(tabla.polje[7][2].figura, TOP);
- tabla.polje[7][2].bojaFigure = BELO;
- }
- if(tabla.malarcrni == UKLJUCENO && xizb == 4 && yizb == 0 && x == 6 && y == 0)
- {
- wcscpy(tabla.polje[0][7].figura, PRAZNO);
- wcscpy(tabla.polje[0][5].figura, TOP);
- tabla.polje[0][5].bojaFigure = CRNO;
- }
- if(tabla.velikarcrni == UKLJUCENO && xizb == 4 && yizb == 0 && x == 1 && y == 0)
- {
- wcscpy(tabla.polje[0][0].figura, PRAZNO);
- wcscpy(tabla.polje[0][2].figura, TOP);
- tabla.polje[0][2].bojaFigure = CRNO;
- }
- 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)))
- tabla.polje[y][x].anpasan = UKLJUCENO;
- if(xizb == 7 && yizb == 7)
- tabla.malarbeli = ISKLJUCENO;
- else if(xizb == 0 && yizb == 7)
- tabla.velikarbeli = ISKLJUCENO;
- else if(xizb == 0 && yizb == 0)
- tabla.velikarcrni = ISKLJUCENO;
- else if(xizb == 7 && yizb == 0)
- tabla.malarcrni = ISKLJUCENO;
- else if(xizb == 4 && yizb == 7)
- {
- tabla.malarbeli = ISKLJUCENO;
- tabla.velikarbeli = ISKLJUCENO;
- }
- else if(xizb == 4 && yizb == 0)
- {
- tabla.malarcrni = ISKLJUCENO;
- tabla.velikarcrni = ISKLJUCENO;
- }
- NoviPotez(tabla);
- if(JelSahBeli(tabla, 0, 0))
- for(int i = 0; i < 64; i++)
- if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == BELO)
- {
- tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
- OsveziTablu(tabla);
- break;
- }
- if(JelSahCrni(tabla, 0, 0))
- for(int i = 0; i < 64; i++)
- if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == CRNO)
- {
- tabla.polje[i / 8][i % 8].stanjePolja = NAPADNUTO;
- OsveziTablu(tabla);
- break;
- }
- istorija.push_back(tabla);
- brPoteza++;
- sacekaj = UKLJUCENO;
- }
- OsveziTablu(tabla);
- }
- if(brPoteza % 2 == 1 && !JelMozeIgratiCrni(tabla) && JelSahCrni(tabla, 0, 0) && cek)
- {
- ObrisiTerminal();
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 152);
- tabla.krajigre = 1;
- gotoxy(10, 14);
- wprintf(L"Beli je pobednik");
- }
- else if (brPoteza % 2 == 0 && !JelMozeIgratiBeli(tabla) && JelSahBeli(tabla, 0, 0) && cek)
- {
- ObrisiTerminal();
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 152);
- tabla.krajigre = 1;
- gotoxy(10, 14);
- wprintf(L"Crni je pobednik");
- }
- else if(brPoteza % 2 == 1 && !JelMozeIgratiCrni(tabla) && cek)
- {
- ObrisiTerminal();
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 152);
- tabla.krajigre = 1;
- gotoxy(8, 14);
- wprintf(L"Beli je napravio pat");
- }
- else if (brPoteza % 2 == 0 && !JelMozeIgratiBeli(tabla) && cek)
- {
- ObrisiTerminal();
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 152);
- tabla.krajigre = 1;
- gotoxy(8, 14);
- wprintf(L"Crni je napravio pat");
- }
- }
- }
- void NapraviTablu(Tabla &tabla)
- {
- tabla.brlevo = 0;
- tabla.brdesno = 0;
- tabla.krajigre = 0;
- tabla.malarbeli = UKLJUCENO;
- tabla.malarcrni = UKLJUCENO;
- tabla.velikarbeli = UKLJUCENO;
- tabla.velikarcrni = UKLJUCENO;
- for(int i = 0; i < 8; i++)
- for(int j = 0; j < 8; j++)
- {
- tabla.polje[i][j].stanjePolja = NEUTRALNO;
- tabla.polje[i][j].anpasan = ISKLJUCENO;
- if((i + j) % 2 == 0)
- tabla.polje[i][j].bojaPolja = BELO;
- else
- tabla.polje[i][j].bojaPolja = CRNO;
- }
- for(int i = 0; i < 2; i++)
- for(int j = 0; j < 8; j++)
- {
- tabla.polje[i][j].bojaFigure = CRNO;
- tabla.polje[i + 6][j].bojaFigure = BELO;
- }
- for(int j = 0; j < 8; j++)
- {
- wcscpy(tabla.polje[1][j].figura, PIJUN);
- wcscpy(tabla.polje[6][j].figura, PIJUN);
- }
- wcscpy(tabla.polje[0][0].figura, TOP);
- wcscpy(tabla.polje[0][7].figura, TOP);
- wcscpy(tabla.polje[7][0].figura, TOP);
- wcscpy(tabla.polje[7][7].figura, TOP);
- wcscpy(tabla.polje[0][1].figura, KONJ);
- wcscpy(tabla.polje[0][6].figura, KONJ);
- wcscpy(tabla.polje[7][1].figura, KONJ);
- wcscpy(tabla.polje[7][6].figura, KONJ);
- wcscpy(tabla.polje[0][2].figura, LOVAC);
- wcscpy(tabla.polje[0][5].figura, LOVAC);
- wcscpy(tabla.polje[7][2].figura, LOVAC);
- wcscpy(tabla.polje[7][5].figura, LOVAC);
- wcscpy(tabla.polje[0][3].figura, KRALJICA);
- wcscpy(tabla.polje[7][3].figura, KRALJICA);
- wcscpy(tabla.polje[0][4].figura, KRALJ);
- wcscpy(tabla.polje[7][4].figura, KRALJ);
- for(int i = 2; i < 6; i++)
- for(int j = 0; j < 8; j++)
- {
- tabla.polje[i][j].bojaFigure = ZELENO;
- wcscpy(tabla.polje[i][j].figura, PRAZNO);
- }
- for(int i = 0; i < 8; i++)
- for(int j = 0; j < 2; j++)
- {
- tabla.levo[i][j].anpasan = ISKLJUCENO;
- tabla.levo[i][j].bojaFigure = CRNO;
- tabla.levo[i][j].stanjePolja = NEUTRALNO;
- tabla.desno[i][j].anpasan = ISKLJUCENO;
- tabla.desno[i][j].bojaFigure = BELO;
- tabla.desno[i][j].stanjePolja = NEUTRALNO;
- wcscpy(tabla.levo[i][j].figura, PRAZNO);
- wcscpy(tabla.desno[i][j].figura, PRAZNO);
- }
- }
- void SakriKursor()
- {
- HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
- if(prviput3)
- {
- GetConsoleCursorInfo(consoleHandle, &kursor);
- prviput3 = 0;
- }
- CONSOLE_CURSOR_INFO info;
- info.dwSize = 100;
- info.bVisible = FALSE;
- SetConsoleCursorInfo(consoleHandle, &info);
- }
- void ObrisiEkran()
- {
- HANDLE hStdOut;
- CONSOLE_SCREEN_BUFFER_INFO csbi;
- DWORD count;
- DWORD cellCount;
- COORD homeCoords = {0, 0};
- hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
- if (hStdOut == INVALID_HANDLE_VALUE)
- return;
- GetConsoleScreenBufferInfo(hStdOut, &csbi);
- cellCount = csbi.dwSize.X * csbi.dwSize.Y;
- FillConsoleOutputCharacter(hStdOut, (TCHAR) ' ', cellCount, homeCoords, &count);
- FillConsoleOutputAttribute(hStdOut, csbi.wAttributes, cellCount, homeCoords, &count);
- SetConsoleCursorPosition(hStdOut, homeCoords);
- }
- void gotoxy(int x, int y)
- {
- COORD koordinate;
- koordinate.X = x;
- koordinate.Y = y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), koordinate);
- }
- int UcitajKlik(int &x, int &y)
- {
- DWORD info;
- INPUT_RECORD input;
- HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
- SetConsoleMode(in, ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT);
- ReadConsoleInput(in, &input, 1, &info);
- if(input.Event.MouseEvent.dwButtonState != 0x0001)
- {
- GOBACK:
- ReadConsoleInput(in, &input, 1, &info);
- if(input.Event.MouseEvent.dwButtonState == 0x0001)
- {
- GOBACK2:
- ReadConsoleInput(in, &input, 1, &info);
- if(input.Event.MouseEvent.dwButtonState != 0x0001)
- {
- x = input.Event.MouseEvent.dwMousePosition.X;
- y = input.Event.MouseEvent.dwMousePosition.Y;
- }
- else
- goto GOBACK2;
- }
- else
- goto GOBACK;
- }
- else
- UcitajKlik(x, y);
- return 0;
- }
- void CentrirajKonzolu2()
- {
- RECT rectClient, rectWindow;
- HWND hWnd = GetConsoleWindow();
- GetClientRect(hWnd, &rectClient);
- GetWindowRect(hWnd, &rectWindow);
- SetWindowPos(GetConsoleWindow(), HWND_TOP, GetSystemMetrics(SM_CXSCREEN) / 2 - (rectWindow.right - rectWindow.left) / 2, rectWindow.top, 0, 0, SWP_NOSIZE);
- }
- void CentrirajKonzolu()
- {
- RECT rectClient, rectWindow;
- HWND hWnd = GetConsoleWindow();
- GetClientRect(hWnd, &rectClient);
- GetWindowRect(hWnd, &rectWindow);
- int posx, posy;
- posx = GetSystemMetrics(SM_CXSCREEN) / 2 - (rectWindow.right - rectWindow.left) / 2;
- posy = GetSystemMetrics(SM_CYSCREEN) / 2 - (rectWindow.bottom - rectWindow.top) / 2;
- SetWindowPos(GetConsoleWindow(), HWND_TOP, posx, posy, 0, 0, SWP_NOSIZE);
- }
- void PodesiKonzolu()
- {
- HWND consoleWindow = GetConsoleWindow();
- HMENU hmenu = GetSystemMenu(consoleWindow, FALSE);
- EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); ////////////////////////////////////////////////////////////////////////////////////////////
- if(prviput1)
- {
- winlog = GetWindowLong(consoleWindow, GWL_STYLE);
- SetWindowLong(consoleWindow, GWL_STYLE, winlog & ~WS_MAXIMIZEBOX & ~WS_SIZEBOX & ~WS_VSCROLL);
- prviput1 = 0;
- }
- else
- SetWindowLong(consoleWindow, GWL_STYLE, GetWindowLong(consoleWindow, GWL_STYLE) & ~WS_MAXIMIZEBOX & ~WS_SIZEBOX & ~WS_VSCROLL);
- SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_EXTENDED_FLAGS);
- _setmode(_fileno(stdout), _O_U8TEXT);
- SetConsoleTitleW(L"ŠAH");
- _setmode(_fileno(stdout), _O_TEXT);
- if(boja == SVETLO)
- system("color 23");
- else if(boja == TAMNO)
- system("color 56");
- else if(boja == SIVO)
- system("color 89");
- _CONSOLE_SCREEN_BUFFER_INFOEX info;
- info.cbSize = sizeof(info);
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- GetConsoleScreenBufferInfoEx(hConsole, &info);
- if(prviput2)
- {
- screenbuffer = info;
- prviput2 = 0;
- }
- info.dwSize = {36, 19};
- info.ColorTable[0] = RGB(242, 242, 242);
- info.ColorTable[1] = RGB(10, 10, 10);
- info.ColorTable[2] = RGB(198, 175, 141);
- info.ColorTable[3] = RGB(114, 71, 56);
- info.ColorTable[4] = RGB(50, 31, 26);
- info.ColorTable[5] = RGB(132, 94, 73);
- info.ColorTable[6] = RGB(73, 47, 37);
- info.ColorTable[7] = RGB(22, 11, 4);
- info.ColorTable[8] = RGB(158, 158, 158);
- info.ColorTable[9] = RGB(102, 102, 102);
- info.ColorTable[10] = RGB(43, 43, 43);
- info.ColorTable[11] = RGB(0, 119, 65);
- info.ColorTable[12] = RGB(126, 33, 35);
- info.ColorTable[13] = RGB(10, 10, 130);
- info.ColorTable[14] = RGB(240, 191, 40);
- info.ColorTable[15] = RGB(255, 255, 255);
- SetConsoleScreenBufferInfoEx(hConsole, &info);
- PodesiVelicinu(velicina);
- OdstampajKonzolu();
- SakriKursor();
- system("MODE 36, 18");
- }
- void PodesiKonzolu2()
- {
- _CONSOLE_SCREEN_BUFFER_INFOEX info;
- info.cbSize = sizeof(info);
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- GetConsoleScreenBufferInfoEx(hConsole, &info);
- info.dwSize = {36, 17};
- SetConsoleScreenBufferInfoEx(hConsole, &info);
- }
- void PodesiVelicinu(int i)
- {
- CONSOLE_FONT_INFOEX cfi;
- cfi.cbSize = sizeof(cfi);
- cfi.nFont = 0;
- cfi.dwFontSize.X = 0;
- cfi.dwFontSize.Y = i;
- cfi.FontFamily = TMPF_TRUETYPE;
- cfi.FontWeight = FW_NORMAL;
- std::wcscpy(cfi.FaceName, L"MS Gothic");
- SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &cfi);
- CentrirajKonzolu();
- CentrirajKonzolu();
- system("MODE 36, 18");
- PodesiKonzolu2();
- }
- void OdstampajTablu(Tabla tabla)
- {
- HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
- _setmode(_fileno(stdout), _O_U8TEXT);
- for(int i = 0; i < 8; i++)
- for(int j = 0; j < 8; j++)
- {
- if(tabla.polje[i][j].stanjePolja == IZABRANO && tabla.polje[i][j].bojaFigure == CRNO)
- SetConsoleTextAttribute(console, 177);
- else if(tabla.polje[i][j].stanjePolja == IZABRANO && tabla.polje[i][j].bojaFigure == BELO)
- SetConsoleTextAttribute(console, 176);
- else if(tabla.polje[i][j].stanjePolja == NAPADNUTO && (tabla.polje[i][j].bojaFigure == CRNO || tabla.polje[i][j].bojaFigure == ZELENO))
- SetConsoleTextAttribute(console, 193);
- else if(tabla.polje[i][j].stanjePolja == NAPADNUTO && tabla.polje[i][j].bojaFigure == BELO)
- SetConsoleTextAttribute(console, 192);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SVETLO && tabla.polje[i][j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 32);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SVETLO && tabla.polje[i][j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 33);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == TAMNO && tabla.polje[i][j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 80);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == TAMNO && tabla.polje[i][j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 81);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SIVO && tabla.polje[i][j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 128);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SIVO && tabla.polje[i][j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 129);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SVETLO && tabla.polje[i][j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 48);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SVETLO && tabla.polje[i][j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 49);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == TAMNO && tabla.polje[i][j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 96);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == TAMNO && tabla.polje[i][j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 97);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == BELO && boja == SIVO && tabla.polje[i][j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 144);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == CRNO && boja == SIVO && tabla.polje[i][j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 145);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SVETLO && tabla.polje[i][j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 43);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == TAMNO && tabla.polje[i][j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 91);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SIVO && tabla.polje[i][j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 139);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SVETLO && tabla.polje[i][j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 59);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == TAMNO && tabla.polje[i][j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 107);
- else if(tabla.polje[i][j].stanjePolja == NEUTRALNO && tabla.polje[i][j].bojaFigure == ZELENO && boja == SIVO && tabla.polje[i][j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 155);
- gotoxy(10 + j * 2, 3 + i);
- wprintf(tabla.polje[i][j].figura);
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 68);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 119);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 170);
- if((j + 1) % 8 == 0)
- {
- gotoxy(26, 3 + i);
- wprintf(L"█");
- }
- }
- OdstampajLevoDesno(tabla);
- }
- void ObrnutoOdstampajTablu(Tabla tabla)
- {
- HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
- _setmode(_fileno(stdout), _O_U8TEXT);
- for(int i = 0; i < 8; i++)
- for(int j = 0; j < 8; j++)
- {
- if(tabla.polje[7 - i][7 - j].stanjePolja == IZABRANO && tabla.polje[7 - i][7 - j].bojaFigure == CRNO)
- SetConsoleTextAttribute(console, 177);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == IZABRANO && tabla.polje[7 - i][7 - j].bojaFigure == BELO)
- SetConsoleTextAttribute(console, 176);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NAPADNUTO && tabla.polje[7 - i][7 - j].bojaFigure == CRNO)
- SetConsoleTextAttribute(console, 193);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NAPADNUTO && tabla.polje[7 - i][7 - j].bojaFigure == BELO)
- SetConsoleTextAttribute(console, 192);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NAPADNUTO && !wcscmp(tabla.polje[7 - i][7 - j].figura, PRAZNO))
- SetConsoleTextAttribute(console, 192);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == BELO && boja == SVETLO && tabla.polje[7 - i][7 - j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 32);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == CRNO && boja == SVETLO && tabla.polje[7 - i][7 - j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 33);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == BELO && boja == TAMNO && tabla.polje[7 - i][7 - j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 80);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == CRNO && boja == TAMNO && tabla.polje[7 - i][7 - j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 81);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == BELO && boja == SIVO && tabla.polje[7 - i][7 - j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 128);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == CRNO && boja == SIVO && tabla.polje[7 - i][7 - j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 129);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == BELO && boja == SVETLO && tabla.polje[7 - i][7 - j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 48);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == CRNO && boja == SVETLO && tabla.polje[7 - i][7 - j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 49);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == BELO && boja == TAMNO && tabla.polje[7 - i][7 - j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 96);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == CRNO && boja == TAMNO && tabla.polje[7 - i][7 - j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 97);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == BELO && boja == SIVO && tabla.polje[7 - i][7 - j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 144);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == CRNO && boja == SIVO && tabla.polje[7 - i][7 - j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 145);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == ZELENO && boja == SVETLO && tabla.polje[7 - i][7 - j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 43);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == ZELENO && boja == TAMNO && tabla.polje[7 - i][7 - j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 91);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == ZELENO && boja == SIVO && tabla.polje[7 - i][7 - j].bojaPolja == BELO)
- SetConsoleTextAttribute(console, 139);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == ZELENO && boja == SVETLO && tabla.polje[7 - i][7 - j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 59);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == ZELENO && boja == TAMNO && tabla.polje[7 - i][7 - j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 107);
- else if(tabla.polje[7 - i][7 - j].stanjePolja == NEUTRALNO && tabla.polje[7 - i][7 - j].bojaFigure == ZELENO && boja == SIVO && tabla.polje[7 - i][7 - j].bojaPolja == CRNO)
- SetConsoleTextAttribute(console, 155);
- gotoxy(10 + j * 2, 3 + i);
- wprintf(tabla.polje[7 - i][7 - j].figura);
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 68);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 119);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 170);
- if((j + 1) % 8 == 0)
- {
- gotoxy(26, 3 + i);
- wprintf(L"█");
- }
- }
- OdstampajLevoDesno(tabla);
- }
- void OdstampajLevoDesno(Tabla tabla)
- {
- HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
- _setmode(_fileno(stdout), _O_U8TEXT);
- for(int i = 0; i < 8; i++)
- for(int j = 0; j < 2; j++)
- {
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 81);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 97);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 145);
- gotoxy(2 + j * 2, 3 + i);
- wprintf(tabla.levo[i][j].figura);
- if((j + 1) % 2 == 0)
- {
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 36);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 87);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 138);
- gotoxy(6, 3 + i);
- wprintf(L"┃");
- }
- }
- for(int i = 0; i < 8; i++)
- for(int j = 0; j < 2; j++)
- {
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 80);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 96);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 144);
- gotoxy(30 + j * 2, 3 + i);
- wprintf(tabla.desno[i][j].figura);
- if((j + 1) % 2 == 0)
- {
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 36);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 87);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 138);
- gotoxy(34, 3 + i);
- wprintf(L"┃");
- }
- }
- }
- void PozicijaNaTabli(int &x, int &y)
- {
- switch(x)
- {
- case 10:
- case 11:
- x = 0;
- break;
- case 12:
- case 13:
- x = 1;
- break;
- case 14:
- case 15:
- x = 2;
- break;
- case 16:
- case 17:
- x = 3;
- break;
- case 18:
- case 19:
- x = 4;
- break;
- case 20:
- case 21:
- x = 5;
- break;
- case 22:
- case 23:
- x = 6;
- break;
- case 24:
- case 25:
- x = 7;
- }
- switch(y)
- {
- case 10:
- y = 7;
- break;
- case 9:
- y = 6;
- break;
- case 8:
- y = 5;
- break;
- case 7:
- y = 4;
- break;
- case 6:
- y = 3;
- break;
- case 5:
- y = 2;
- break;
- case 4:
- y = 1;
- break;
- case 3:
- y = 0;
- }
- }
- void ObrnutaPozicijaNaTabli(int &x, int &y)
- {
- switch(x)
- {
- case 10:
- case 11:
- x = 7;
- break;
- case 12:
- case 13:
- x = 6;
- break;
- case 14:
- case 15:
- x = 5;
- break;
- case 16:
- case 17:
- x = 4;
- break;
- case 18:
- case 19:
- x = 3;
- break;
- case 20:
- case 21:
- x = 2;
- break;
- case 22:
- case 23:
- x = 1;
- break;
- case 24:
- case 25:
- x = 0;
- }
- switch(y)
- {
- case 10:
- y = 0;
- break;
- case 9:
- y = 1;
- break;
- case 8:
- y = 2;
- break;
- case 7:
- y = 3;
- break;
- case 6:
- y = 4;
- break;
- case 5:
- y = 5;
- break;
- case 4:
- y = 6;
- break;
- case 3:
- y = 7;
- }
- }
- void NoviPotez(Tabla &tabla)
- {
- for(int a = 0; a < 8; a++)
- for(int b = 0; b < 8; b++)
- {
- if(tabla.polje[a][b].stanjePolja == IZABRANO)
- tabla.polje[a][b].stanjePolja = NEUTRALNO;
- if(tabla.polje[a][b].stanjePolja == NAPADNUTO)
- tabla.polje[a][b].stanjePolja = NEUTRALNO;
- if(!wcscmp(tabla.polje[a][b].figura, TACKA))
- wcscpy(tabla.polje[a][b].figura, PRAZNO);
- if(!wcscmp(tabla.polje[a][b].figura, PRAZNO))
- tabla.polje[a][b].bojaFigure = ZELENO;
- }
- }
- void ObrisiAnpasan(Tabla &tabla)
- {
- for(int a = 0; a < 8; a++)
- for(int b = 0; b < 8; b++)
- if(tabla.polje[a][b].anpasan == UKLJUCENO)
- tabla.polje[a][b].anpasan = ISKLJUCENO;
- }
- void PozicijaIzabranog(int &xizb, int &yizb, Tabla tabla)
- {
- for(int a = 0; a < 8; a++)
- for(int b = 0; b < 8; b++)
- if(tabla.polje[a][b].stanjePolja == IZABRANO)
- {
- yizb = a;
- xizb = b;
- return;
- }
- }
- short JelUnutarTable(int x, int y)
- {
- if(x >= 0 && x <= 7 && y >= 0 && y <= 7)
- return 1;
- else
- return 0;
- }
- void OdstampajKonzolu()
- {
- HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
- _setmode(_fileno(stdout), _O_U8TEXT);
- gotoxy(0, 0);
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 45);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 93);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 141);
- wprintf(L""); // save
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 46);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 94);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 142);
- wprintf(L""); // open
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 44);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 92);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 140);
- wprintf(L""); // restart
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 36);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 87);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 138);
- // gear
- wprintf(L""); // color
- wprintf(L""); // resize
- wprintf(L""); // back
- wprintf(L" "); // space
- if(rotacija == UKLJUCENO)
- wprintf(L""); // rotation
- else
- wprintf(L""); // rotation
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 47);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 95);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 143);
- wprintf(L""); // info
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 44);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 92);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 140);
- wprintf(L"\n"); // quit
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 36);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 87);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 138);
- wprintf(L"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n");
- wprintf(L"┏━━━━━┓ ┏━━━━━┓ \n");
- wprintf(L"┃ ┃ ┃ ┃ \n");
- wprintf(L"┃ ┃ ┃ ┃ \n");
- wprintf(L"┃ ┃ ┃ ┃ \n");
- wprintf(L"┃ ┃ ┃ ┃ \n");
- wprintf(L"┃ ┃ ┃ ┃ \n");
- wprintf(L"┃ ┃ ┃ ┃ \n");
- wprintf(L"┃ ┃ ┃ ┃ \n");
- wprintf(L"┃ ┃ ┃ ┃ \n");
- wprintf(L"┗━━━━━┛ ┗━━━━━┛ \n");
- wprintf(L"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ \n");
- wprintf(L"┃ ┃ \n");
- wprintf(L"┃ ┃ \n");
- wprintf(L"┃ ┃ \n");
- wprintf(L"┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ");
- ObrisiTerminal();
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 68);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 119);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 170);
- gotoxy(8, 2);
- wprintf(L"████████████████████");
- gotoxy(8, 3);
- wprintf(L"██");
- gotoxy(8, 4);
- wprintf(L"██");
- gotoxy(8, 5);
- wprintf(L"██");
- gotoxy(8, 6);
- wprintf(L"██");
- gotoxy(8, 7);
- wprintf(L"██");
- gotoxy(8, 8);
- wprintf(L"██");
- gotoxy(8, 9);
- wprintf(L"██");
- gotoxy(8, 10);
- wprintf(L"██");
- gotoxy(26, 3);
- wprintf(L"██");
- gotoxy(26, 4);
- wprintf(L"██");
- gotoxy(26, 5);
- wprintf(L"██");
- gotoxy(26, 6);
- wprintf(L"██");
- gotoxy(26, 7);
- wprintf(L"██");
- gotoxy(26, 8);
- wprintf(L"██");
- gotoxy(26, 9);
- wprintf(L"██");
- gotoxy(26, 10);
- wprintf(L"██");
- gotoxy(8, 11);
- wprintf(L"████████████████████");
- }
- void OsveziTablu(Tabla tabla)
- {
- if((brPoteza % 2 && rotacija == UKLJUCENO && JelMozeIgratiCrni(tabla)) || (!JelMozeIgratiBeli(tabla) && rotacija == UKLJUCENO && brPoteza % 2 == 0))
- {
- if(sacekaj == UKLJUCENO && JelMozeIgratiBeli(tabla))
- {
- OdstampajTablu(tabla);
- Sleep(260);
- }
- ObrnutoOdstampajTablu(tabla);
- }
- else
- {
- if(sacekaj == UKLJUCENO && rotacija == UKLJUCENO && JelMozeIgratiCrni(tabla))
- {
- ObrnutoOdstampajTablu(tabla);
- Sleep(260);
- }
- OdstampajTablu(tabla);
- }
- }
- BOOL RegDelnodeRecurse (HKEY hKeyRoot, LPTSTR lpSubKey)
- {
- LPTSTR lpEnd;
- LONG lResult;
- DWORD dwSize;
- TCHAR szName[MAX_PATH];
- HKEY hKey;
- FILETIME ftWrite;
- lResult = RegDeleteKey(hKeyRoot, lpSubKey);
- if(lResult == ERROR_SUCCESS)
- return TRUE;
- lResult = RegOpenKeyEx (hKeyRoot, lpSubKey, 0, KEY_READ, &hKey);
- if(lResult == ERROR_FILE_NOT_FOUND && lResult != ERROR_SUCCESS)
- return TRUE;
- else if(lResult != ERROR_SUCCESS)
- return FALSE;
- lpEnd = lpSubKey + lstrlen(lpSubKey);
- if(*(lpEnd - 1) != TEXT('\\'))
- {
- *lpEnd = TEXT('\\');
- lpEnd++;
- *lpEnd = TEXT('\0');
- }
- dwSize = MAX_PATH;
- lResult = RegEnumKeyEx(hKey, 0, szName, &dwSize, NULL,
- NULL, NULL, &ftWrite);
- if(lResult == ERROR_SUCCESS)
- do
- {
- *lpEnd = TEXT('\0');
- strcat(lpSubKey, szName);
- if(!RegDelnodeRecurse(hKeyRoot, lpSubKey))
- {
- break;
- }
- dwSize = MAX_PATH;
- lResult = RegEnumKeyEx(hKey, 0, szName, &dwSize, NULL,
- NULL, NULL, &ftWrite);
- }
- while (lResult == ERROR_SUCCESS);
- lpEnd--;
- *lpEnd = TEXT('\0');
- RegCloseKey (hKey);
- lResult = RegDeleteKey(hKeyRoot, lpSubKey);
- if(lResult == ERROR_SUCCESS)
- return TRUE;
- return FALSE;
- }
- BOOL RegDelnode(HKEY hKeyRoot, LPCTSTR lpSubKey)
- {
- TCHAR szDelKey[MAX_PATH * 2];
- strcpy(szDelKey, lpSubKey);
- return RegDelnodeRecurse(hKeyRoot, szDelKey);
- }
- void ObrisiTerminal()
- {
- HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
- _setmode(_fileno(stdout), _O_U8TEXT);
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 85);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 102);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 153);
- gotoxy(2, 13);
- wprintf(L"████████████████████████████████");
- gotoxy(2, 14);
- wprintf(L"████████████████████████████████");
- gotoxy(2, 15);
- wprintf(L"████████████████████████████████");
- }
- Tabla StaviFiguruNaXY(Tabla tabla, int x, int y)
- {
- int xizb, yizb;
- PozicijaIzabranog(xizb, yizb, tabla);
- wcscpy(tabla.polje[y][x].figura, tabla.polje[yizb][xizb].figura);
- wcscpy(tabla.polje[yizb][xizb].figura, PRAZNO);
- tabla.polje[y][x].bojaFigure = tabla.polje[yizb][xizb].bojaFigure;
- NoviPotez(tabla);
- return tabla;
- }
- short JelSahBeli(Tabla tabla, int xpomeraj, int ypomeraj)
- {
- int x = 0, y = 0;
- for(int i = 0; i < 64; i++)
- {
- if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == BELO)
- {
- if(JelUnutarTable(i % 8 + xpomeraj, i / 8 + ypomeraj))
- {
- y = i / 8 + ypomeraj;
- x = i % 8 + xpomeraj;
- }
- else
- {
- x = i % 8;
- y = i / 8;
- }
- break;
- }
- }
- if(!wcscmp(tabla.polje[y - 1][x + 1].figura, PIJUN) && tabla.polje[y - 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x - 1].figura, PIJUN) && tabla.polje[y - 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y - 2][x - 1].figura, KONJ) && tabla.polje[y - 2][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y - 2))
- return 1;
- if(!wcscmp(tabla.polje[y - 2][x + 1].figura, KONJ) && tabla.polje[y - 2][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y - 2))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x + 2].figura, KONJ) && tabla.polje[y - 1][x + 2].bojaFigure == CRNO && JelUnutarTable(x + 2, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x + 2].figura, KONJ) && tabla.polje[y + 1][x + 2].bojaFigure == CRNO && JelUnutarTable(x + 2, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 2][x + 1].figura, KONJ) && tabla.polje[y + 2][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y + 2))
- return 1;
- if(!wcscmp(tabla.polje[y + 2][x - 1].figura, KONJ) && tabla.polje[y + 2][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y + 2))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x - 2].figura, KONJ) && tabla.polje[y + 1][x - 2].bojaFigure == CRNO && JelUnutarTable(x - 2, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x - 2].figura, KONJ) && tabla.polje[y - 1][x - 2].bojaFigure == CRNO && JelUnutarTable(x - 2, y - 1))
- return 1;
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- if(!wcscmp(tabla.polje[y][x - 1].figura, KRALJ) && tabla.polje[y][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y))
- return 1;
- if(!wcscmp(tabla.polje[y][x + 1].figura, KRALJ) && tabla.polje[y][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x].figura, KRALJ) && tabla.polje[y - 1][x].bojaFigure == CRNO && JelUnutarTable(x, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x].figura, KRALJ) && tabla.polje[y + 1][x].bojaFigure == CRNO && JelUnutarTable(x, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x - 1].figura, KRALJ) && tabla.polje[y - 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x + 1].figura, KRALJ) && tabla.polje[y - 1][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x - 1].figura, KRALJ) && tabla.polje[y + 1][x - 1].bojaFigure == CRNO && JelUnutarTable(x - 1, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x + 1].figura, KRALJ) && tabla.polje[y + 1][x + 1].bojaFigure == CRNO && JelUnutarTable(x + 1, y + 1))
- return 1;
- return 0;
- }
- short JelSahCrni(Tabla tabla, int xpomeraj, int ypomeraj)
- {
- int x = 0, y = 0;
- for(int i = 0; i < 64; i++)
- {
- if(!wcscmp(tabla.polje[i / 8][i % 8].figura, KRALJ) && tabla.polje[i / 8][i % 8].bojaFigure == CRNO)
- {
- if(JelUnutarTable(i % 8 + xpomeraj, i / 8 + ypomeraj))
- {
- y = i / 8 + ypomeraj;
- x = i % 8 + xpomeraj;
- }
- else
- {
- x = i % 8;
- y = i / 8;
- }
- break;
- }
- }
- if(!wcscmp(tabla.polje[y + 1][x + 1].figura, PIJUN) && tabla.polje[y + 1][x - 1].bojaFigure == BELO && JelUnutarTable(x + 1, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x - 1].figura, PIJUN) && tabla.polje[y + 1][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y - 2][x - 1].figura, KONJ) && tabla.polje[y - 2][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y - 2))
- return 1;
- if(!wcscmp(tabla.polje[y - 2][x + 1].figura, KONJ) && tabla.polje[y - 2][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y - 2))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x + 2].figura, KONJ) && tabla.polje[y - 1][x + 2].bojaFigure == BELO && JelUnutarTable(x + 2, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x + 2].figura, KONJ) && tabla.polje[y + 1][x + 2].bojaFigure == BELO && JelUnutarTable(x + 2, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 2][x + 1].figura, KONJ) && tabla.polje[y + 2][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y + 2))
- return 1;
- if(!wcscmp(tabla.polje[y + 2][x - 1].figura, KONJ) && tabla.polje[y + 2][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y + 2))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x - 2].figura, KONJ) && tabla.polje[y + 1][x - 2].bojaFigure == BELO && JelUnutarTable(x - 2, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x - 2].figura, KONJ) && tabla.polje[y - 1][x - 2].bojaFigure == BELO && JelUnutarTable(x - 2, y - 1))
- return 1;
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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));
- 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))
- return 1;
- else
- break;
- }
- if(!wcscmp(tabla.polje[y][x - 1].figura, KRALJ) && tabla.polje[y][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y))
- return 1;
- if(!wcscmp(tabla.polje[y][x + 1].figura, KRALJ) && tabla.polje[y][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x].figura, KRALJ) && tabla.polje[y - 1][x].bojaFigure == BELO && JelUnutarTable(x, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x].figura, KRALJ) && tabla.polje[y + 1][x].bojaFigure == BELO && JelUnutarTable(x, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x - 1].figura, KRALJ) && tabla.polje[y - 1][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y - 1][x + 1].figura, KRALJ) && tabla.polje[y - 1][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y - 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x - 1].figura, KRALJ) && tabla.polje[y + 1][x - 1].bojaFigure == BELO && JelUnutarTable(x - 1, y + 1))
- return 1;
- if(!wcscmp(tabla.polje[y + 1][x + 1].figura, KRALJ) && tabla.polje[y + 1][x + 1].bojaFigure == BELO && JelUnutarTable(x + 1, y + 1))
- return 1;
- return 0;
- }
- short PostaviKralja(Tabla &tabla, int x, int y)
- {
- short ret = 0;
- tabla.polje[y][x].stanjePolja = IZABRANO;
- if(tabla.polje[y][x].bojaFigure == BELO)
- {
- if(!wcscmp(tabla.polje[y - 1][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y - 1) && !JelSahBeli(tabla, -1, -1))
- {
- wcscpy(tabla.polje[y - 1][x - 1].figura, TACKA);
- tabla.polje[y - 1][x - 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y - 1][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y - 1) && !JelSahBeli(tabla, 1, -1))
- {
- wcscpy(tabla.polje[y - 1][x + 1].figura, TACKA);
- tabla.polje[y - 1][x + 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y + 1][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y + 1) && !JelSahBeli(tabla, -1, 1))
- {
- wcscpy(tabla.polje[y + 1][x - 1].figura, TACKA);
- tabla.polje[y + 1][x - 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y + 1][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y + 1][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y + 1) && !JelSahBeli(tabla, 1, 1))
- {
- wcscpy(tabla.polje[y + 1][x + 1].figura, TACKA);
- tabla.polje[y + 1][x + 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y + 1][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y) && !JelSahBeli(tabla, 1, 0))
- {
- wcscpy(tabla.polje[y][x + 1].figura, TACKA);
- tabla.polje[y][x + 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y + 1][x].figura, PRAZNO) && JelUnutarTable(x, y + 1) && !JelSahBeli(tabla, 0, 1))
- {
- wcscpy(tabla.polje[y + 1][x].figura, TACKA);
- tabla.polje[y + 1][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y + 1][x].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y) && !JelSahBeli(tabla, -1, 0))
- {
- wcscpy(tabla.polje[y][x - 1].figura, TACKA);
- tabla.polje[y][x - 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y - 1][x].figura, PRAZNO) && JelUnutarTable(x, y - 1) && !JelSahBeli(tabla, 0, -1))
- {
- wcscpy(tabla.polje[y - 1][x].figura, TACKA);
- tabla.polje[y - 1][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))
- {
- wcscpy(tabla.polje[7][6].figura, TACKA);
- tabla.polje[7][6].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- wcscpy(tabla.polje[7][1].figura, TACKA);
- tabla.polje[7][1].bojaFigure = ZELENO;
- ret = 1;
- }
- }
- else
- {
- if(!wcscmp(tabla.polje[y - 1][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y - 1) && !JelSahCrni(tabla, -1, -1))
- {
- wcscpy(tabla.polje[y - 1][x - 1].figura, TACKA);
- tabla.polje[y - 1][x - 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y - 1][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y - 1) && !JelSahCrni(tabla, 1, -1))
- {
- wcscpy(tabla.polje[y - 1][x + 1].figura, TACKA);
- tabla.polje[y - 1][x + 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y + 1][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y + 1) && !JelSahCrni(tabla, -1, 1))
- {
- wcscpy(tabla.polje[y + 1][x - 1].figura, TACKA);
- tabla.polje[y + 1][x - 1].bojaFigure = ZELENO;
- }
- 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))
- {
- tabla.polje[y + 1][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y + 1][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y + 1) && !JelSahCrni(tabla, 1, 1))
- {
- wcscpy(tabla.polje[y + 1][x + 1].figura, TACKA);
- tabla.polje[y + 1][x + 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y + 1][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y][x + 1].figura, PRAZNO) && JelUnutarTable(x + 1, y) && !JelSahCrni(tabla, 1, 0))
- {
- wcscpy(tabla.polje[y][x + 1].figura, TACKA);
- tabla.polje[y][x + 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y + 1][x].figura, PRAZNO) && JelUnutarTable(x, y + 1) && !JelSahCrni(tabla, 0, 1))
- {
- wcscpy(tabla.polje[y + 1][x].figura, TACKA);
- tabla.polje[y + 1][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y + 1][x].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y][x - 1].figura, PRAZNO) && JelUnutarTable(x - 1, y) && !JelSahCrni(tabla, -1, 0))
- {
- wcscpy(tabla.polje[y][x - 1].figura, TACKA);
- tabla.polje[y][x - 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- if(!wcscmp(tabla.polje[y - 1][x].figura, PRAZNO) && JelUnutarTable(x, y - 1) && !JelSahCrni(tabla, 0, -1))
- {
- wcscpy(tabla.polje[y - 1][x].figura, TACKA);
- tabla.polje[y - 1][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))
- {
- wcscpy(tabla.polje[0][6].figura, TACKA);
- tabla.polje[0][6].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- wcscpy(tabla.polje[0][1].figura, TACKA);
- tabla.polje[0][1].bojaFigure = ZELENO;
- ret = 1;
- }
- }
- return ret;
- }
- short PostaviPijuna(Tabla &tabla, int x, int y)
- {
- short ret = 0;
- tabla.polje[y][x].stanjePolja = IZABRANO;
- if(tabla.polje[y][x].bojaFigure == BELO)
- {
- if(!wcscmp(tabla.polje[y - 1][x].figura, PRAZNO) && JelUnutarTable(x, y - 1) && !JelSahBeli(StaviFiguruNaXY(tabla, x, y - 1), 0, 0))
- {
- wcscpy(tabla.polje[y - 1][x].figura, TACKA);
- tabla.polje[y - 1][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- wcscpy(tabla.polje[y - 2][x].figura, TACKA);
- tabla.polje[y - 2][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y - 1][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- }
- else
- {
- if(!wcscmp(tabla.polje[y + 1][x].figura, PRAZNO) && JelUnutarTable(x, y + 1) && !JelSahCrni(StaviFiguruNaXY(tabla, x, y + 1), 0, 0))
- {
- wcscpy(tabla.polje[y + 1][x].figura, TACKA);
- tabla.polje[y + 1][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- wcscpy(tabla.polje[y + 2][x].figura, TACKA);
- tabla.polje[y + 2][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y + 1][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y + 1][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y + 1][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))
- {
- tabla.polje[y + 1][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- }
- return ret;
- }
- short PostaviKonja(Tabla &tabla, int x, int y)
- {
- short ret = 0;
- tabla.polje[y][x].stanjePolja = IZABRANO;
- 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))))
- {
- wcscpy(tabla.polje[y - 2][x - 1].figura, TACKA);
- tabla.polje[y - 2][x - 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y - 2][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))))
- {
- wcscpy(tabla.polje[y - 2][x + 1].figura, TACKA);
- tabla.polje[y - 2][x + 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y - 2][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))))
- {
- wcscpy(tabla.polje[y - 1][x + 2].figura, TACKA);
- tabla.polje[y - 1][x + 2].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y - 1][x + 2].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))))
- {
- wcscpy(tabla.polje[y + 1][x + 2].figura, TACKA);
- tabla.polje[y + 1][x + 2].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y + 1][x + 2].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))))
- {
- wcscpy(tabla.polje[y + 2][x + 1].figura, TACKA);
- tabla.polje[y + 2][x + 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y + 2][x + 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))))
- {
- wcscpy(tabla.polje[y + 2][x - 1].figura, TACKA);
- tabla.polje[y + 2][x - 1].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y + 2][x - 1].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))))
- {
- wcscpy(tabla.polje[y + 1][x - 2].figura, TACKA);
- tabla.polje[y + 1][x - 2].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y + 1][x - 2].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- 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))))
- {
- wcscpy(tabla.polje[y - 1][x - 2].figura, TACKA);
- tabla.polje[y - 1][x - 2].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y - 1][x - 2].stanjePolja = NAPADNUTO;
- ret = 1;
- }
- return ret;
- }
- short PostaviTopa(Tabla &tabla, int x, int y)
- {
- short ret = 0;
- tabla.polje[y][x].stanjePolja = IZABRANO;
- for(int i = 1; i < 8; i++)
- {
- 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))))
- {
- wcscpy(tabla.polje[y][x - i].figura, TACKA);
- tabla.polje[y][x - i].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y][x - i].stanjePolja = NAPADNUTO;
- ret = 1;
- break;
- }
- 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))
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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))))
- {
- wcscpy(tabla.polje[y][x + i].figura, TACKA);
- tabla.polje[y][x + i].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y][x + i].stanjePolja = NAPADNUTO;
- ret = 1;
- break;
- }
- 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))
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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))))
- {
- wcscpy(tabla.polje[y - i][x].figura, TACKA);
- tabla.polje[y - i][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y - i][x].stanjePolja = NAPADNUTO;
- ret = 1;
- break;
- }
- 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))
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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))))
- {
- wcscpy(tabla.polje[y + i][x].figura, TACKA);
- tabla.polje[y + i][x].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y + i][x].stanjePolja = NAPADNUTO;
- ret = 1;
- break;
- }
- 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))
- break;
- }
- return ret;
- }
- short PostaviLovca(Tabla &tabla, int x, int y)
- {
- short ret = 0;
- tabla.polje[y][x].stanjePolja = IZABRANO;
- for(int i = 1; i < 8; i++)
- {
- 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))))
- {
- wcscpy(tabla.polje[y - i][x - i].figura, TACKA);
- tabla.polje[y - i][x - i].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y - i][x - i].stanjePolja = NAPADNUTO;
- ret = 1;
- break;
- }
- 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))
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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))))
- {
- wcscpy(tabla.polje[y - i][x + i].figura, TACKA);
- tabla.polje[y - i][x + i].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y - i][x + i].stanjePolja = NAPADNUTO;
- ret = 1;
- break;
- }
- 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))
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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))))
- {
- wcscpy(tabla.polje[y + i][x - i].figura, TACKA);
- tabla.polje[y + i][x - i].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y + i][x - i].stanjePolja = NAPADNUTO;
- ret = 1;
- break;
- }
- 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))
- break;
- }
- for(int i = 1; i < 8; i++)
- {
- 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))))
- {
- wcscpy(tabla.polje[y + i][x + i].figura, TACKA);
- tabla.polje[y + i][x + i].bojaFigure = ZELENO;
- ret = 1;
- }
- 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))))
- {
- tabla.polje[y + i][x + i].stanjePolja = NAPADNUTO;
- ret = 1;
- break;
- }
- 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))
- break;
- }
- return ret;
- }
- short PostaviKraljicu(Tabla &tabla, int x, int y)
- {
- int ret = 0;
- ret += PostaviLovca(tabla, x, y);
- ret += PostaviTopa(tabla, x, y);
- if(ret != 0)
- ret = 1;
- return ret;
- }
- short JelMozeIgratiBeli(Tabla tabla)
- {
- short ret = 0;
- for(int y = 0; y < 8; y++)
- for(int x = 0; x < 8; x++)
- if(tabla.polje[y][x].bojaFigure == BELO)
- {
- if(!wcscmp(tabla.polje[y][x].figura, KRALJ))
- {
- ret += PostaviKralja(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, PIJUN))
- {
- ret += PostaviPijuna(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, KONJ))
- {
- ret += PostaviKonja(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, TOP))
- {
- ret += PostaviTopa(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, LOVAC))
- {
- ret += PostaviLovca(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, KRALJICA))
- {
- ret += PostaviKraljicu(tabla, x, y);
- NoviPotez(tabla);
- }
- }
- if(ret != 0)
- ret = 1;
- return ret;
- }
- short JelMozeIgratiCrni(Tabla tabla)
- {
- short ret = 0;
- for(int y = 0; y < 8; y++)
- for(int x = 0; x < 8; x++)
- if(tabla.polje[y][x].bojaFigure == CRNO)
- {
- if(!wcscmp(tabla.polje[y][x].figura, KRALJ))
- {
- ret += PostaviKralja(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, PIJUN))
- {
- ret += PostaviPijuna(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, KONJ))
- {
- ret += PostaviKonja(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, TOP))
- {
- ret += PostaviTopa(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, LOVAC))
- {
- ret += PostaviLovca(tabla, x, y);
- NoviPotez(tabla);
- }
- else if(!wcscmp(tabla.polje[y][x].figura, KRALJICA))
- {
- ret += PostaviKraljicu(tabla, x, y);
- NoviPotez(tabla);
- }
- }
- if(ret != 0)
- ret = 1;
- return ret;
- }
- short ZameniPijuna()
- {
- int x, y, pom = 1, izb;
- HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
- _setmode(_fileno(stdout), _O_U8TEXT);
- if(boja == SVETLO)
- SetConsoleTextAttribute(console, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(console, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(console, 152);
- gotoxy(8, 14);
- wprintf(KRALJICA);
- wprintf(L" ");
- wprintf(TOP);
- wprintf(L" ");
- wprintf(LOVAC);
- wprintf(L" ");
- wprintf(KONJ);
- while(pom)
- {
- pom = 0;
- UcitajKlik(x, y);
- if((x == 8 || x == 9) && y == 14)
- izb = 0;
- else if((x == 14 || x == 15) && y == 14)
- izb = 1;
- else if((x == 20 || x == 21) && y == 14)
- izb = 2;
- else if((x == 26 || x == 27) && y == 14)
- izb = 3;
- else
- pom = 1;
- }
- ObrisiTerminal();
- return izb;
- }
- int FiguraUBroj(wchar_t figura[])
- {
- _setmode(_fileno(stdout), _O_U8TEXT);
- if(!wcscmp(figura, KRALJ))
- return 0;
- else if(!wcscmp(figura, KRALJICA))
- return 1;
- else if(!wcscmp(figura, TOP))
- return 2;
- else if(!wcscmp(figura, LOVAC))
- return 3;
- else if(!wcscmp(figura, KONJ))
- return 4;
- else if(!wcscmp(figura, PIJUN))
- return 5;
- else if(!wcscmp(figura, PRAZNO))
- return 6;
- }
- wchar_t* BrojUFiguru(int broj)
- {
- _setmode(_fileno(stdout), _O_U8TEXT);
- switch(broj)
- {
- case 0:
- return KRALJ;
- case 1:
- return KRALJICA;
- case 2:
- return TOP;
- case 3:
- return LOVAC;
- case 4:
- return KONJ;
- case 5:
- return PIJUN;
- case 6:
- return PRAZNO;
- }
- }
- vector<short> NapraviSacuvaj(vector<Tabla> istorija)
- {
- vector<short> memo;
- memo.clear();
- for(int a = 0; a <= brPoteza; a++)
- {
- memo.push_back(istorija[a].brdesno);
- memo.push_back(istorija[a].brlevo);
- memo.push_back(istorija[a].krajigre);
- memo.push_back(istorija[a].malarbeli);
- memo.push_back(istorija[a].malarcrni);
- memo.push_back(istorija[a].velikarbeli);
- memo.push_back(istorija[a].velikarcrni);
- for(int i = 0; i < 16; i++)
- {
- memo.push_back(FiguraUBroj(istorija[a].levo[i / 2][i % 2].figura));
- memo.push_back(FiguraUBroj(istorija[a].desno[i / 2][i % 2].figura));
- }
- for(int i = 0; i < 8; i++)
- for(int j = 0; j < 8; j++)
- {
- memo.push_back(istorija[a].polje[i][j].anpasan);
- memo.push_back(istorija[a].polje[i][j].bojaFigure);
- memo.push_back(FiguraUBroj(istorija[a].polje[i][j].figura));
- memo.push_back(istorija[a].polje[i][j].stanjePolja);
- }
- }
- return memo;
- }
- void SacuvajIgru(vector<Tabla> istorija)
- {
- char ime[18], zn;
- vector<short> memo;
- ObrisiTerminal();
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleCursorInfo(hConsole, &kursor);
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 152);
- _setmode(_fileno(stdout), _O_TEXT);
- gotoxy(4, 14);
- printf("Ime igre: ");
- for(int i = 0; i < 18; i++)
- {
- fflush(stdin);
- zn = getch();
- fflush(stdin);
- if((zn == 13 && i != 0) || i == 14)
- {
- Sleep(100);
- SakriKursor();
- ime[i] = '\0';
- break;
- }
- else if(zn == 8)
- {
- gotoxy(14 + i, 14);
- putch(' ');
- gotoxy(14 + i, 14);
- i -= 2;
- }
- else
- {
- gotoxy(15 + i, 14);
- putch(zn);
- ime[i] = zn;
- }
- }
- ObrisiTerminal();
- gotoxy(4, 14);
- memo = NapraviSacuvaj(istorija);
- ofstream izlaz (strcat(ime, ".igra"));
- if(izlaz.is_open())
- {
- izlaz << brPoteza;
- for(int i = 0; i < (brPoteza + 1) * 295; i++)
- {
- if(!(i % 295))
- izlaz << endl;
- izlaz << memo[i] << " ";
- }
- izlaz.close();
- }
- }
- void OdaberiVelicinu()
- {
- velicina = (velicina - 9) / 2;
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- ObrisiTerminal();
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 152);
- _setmode(_fileno(stdout), _O_U8TEXT);
- if(velicina > 9)
- gotoxy(30, 14);
- else
- gotoxy(31, 14);
- wprintf(L"%d", velicina);
- gotoxy(4, 14);
- wprintf(L"Veličina: ");
- for(int i = 1; i < velicina; i++)
- {
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 51);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 68);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 170);
- wprintf(L"█");
- }
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 102);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 119);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 17);
- wprintf(L"█");
- for(int i = 15; i > velicina; i--)
- {
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 34);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 85);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 136);
- wprintf(L"█");
- }
- DWORD info;
- INPUT_RECORD input;
- HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
- SetConsoleMode(in, ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT);
- GOBACK0:
- ReadConsoleInput(in, &input, 1, &info);
- if(input.Event.MouseEvent.dwButtonState != 0x0001)
- {
- GOBACK:
- ReadConsoleInput(in, &input, 1, &info);
- if(input.Event.MouseEvent.dwButtonState == 0x0001 && input.Event.MouseEvent.dwMousePosition.Y == 14 && input.Event.MouseEvent.dwMousePosition.X > 13 && input.Event.MouseEvent.dwMousePosition.X < 29)
- {
- GOBACK2:
- ReadConsoleInput(in, &input, 1, &info);
- velicina = input.Event.MouseEvent.dwMousePosition.X - 13;
- if(velicina < 1)
- velicina = 1;
- if(velicina > 15)
- velicina = 15;
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 82);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 101);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 152);
- gotoxy(30, 14);
- if(velicina < 10)
- wprintf(L" ");
- wprintf(L"%d", velicina);
- gotoxy(14, 14);
- for(int i = 1; i < velicina; i++)
- {
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 51);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 68);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 170);
- wprintf(L"█");
- }
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 102);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 119);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 17);
- wprintf(L"█");
- for(int i = 15; i > velicina; i--)
- {
- if(boja == SVETLO)
- SetConsoleTextAttribute(hConsole, 34);
- else if(boja == TAMNO)
- SetConsoleTextAttribute(hConsole, 85);
- else if(boja == SIVO)
- SetConsoleTextAttribute(hConsole, 136);
- wprintf(L"█");
- }
- if(input.Event.MouseEvent.dwButtonState == 0x0001)
- goto GOBACK2;
- }
- else
- goto GOBACK;
- }
- else
- goto GOBACK0;
- Sleep(300);
- ObrisiTerminal();
- velicina = velicina * 2 + 9;
- }
- void AnimacijaUcitaj()
- {
- system("MODE 36, 18");
- PodesiVelicinu(velicina);
- system("MODE 36, 1");
- HWND consoleWindow = GetConsoleWindow();
- HMENU hmenu = GetSystemMenu(consoleWindow, FALSE);
- EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); ////////////////////////////////////////////////////////////////////////////////////////////
- winlog = GetWindowLong(consoleWindow, GWL_STYLE);
- SetWindowLong(consoleWindow, GWL_STYLE, winlog & ~WS_MAXIMIZEBOX & ~WS_SIZEBOX & ~WS_VSCROLL);
- SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_EXTENDED_FLAGS);
- _setmode(_fileno(stdout), _O_U8TEXT);
- SetConsoleTitleW(L"ŠAH");
- _CONSOLE_SCREEN_BUFFER_INFOEX info;
- info.cbSize = sizeof(info);
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- GetConsoleScreenBufferInfoEx(hConsole, &info);
- info.ColorTable[2] = RGB(198, 175, 141);
- info.ColorTable[3] = RGB(114, 71, 56);
- SetConsoleScreenBufferInfoEx(hConsole, &info);
- SakriKursor();
- system("color 23");
- char str[20];
- for(int i = 1; i < 18; i++)
- {
- sprintf(str, "MODE 36, %d", i);
- system(str);
- if(_kbhit())
- goto KRAJ;
- }
- Sleep(200);
- if(_kbhit())
- goto KRAJ;
- gotoxy(6, 2);
- wprintf(L"Najbolja igrica na svetu");
- gotoxy(12, 4);
- wprintf(L"se učitava...");
- for(int i = 0; i < 2; i++)
- {
- if(_kbhit())
- goto KRAJ;
- gotoxy(17, 8);
- wprintf(L"●");
- Sleep(300);
- if(_kbhit())
- goto KRAJ;
- gotoxy(21, 9);
- wprintf(L"●");
- Sleep(270);
- if(_kbhit())
- goto KRAJ;
- gotoxy(23, 11);
- wprintf(L"●");
- Sleep(200);
- if(_kbhit())
- goto KRAJ;
- gotoxy(21, 13);
- wprintf(L"●");
- Sleep(120);
- if(_kbhit())
- goto KRAJ;
- gotoxy(17, 14);
- wprintf(L"●");
- Sleep(140);
- if(_kbhit())
- goto KRAJ;
- gotoxy(13, 13);
- wprintf(L"●");
- Sleep(155);
- if(_kbhit())
- goto KRAJ;
- gotoxy(11, 11);
- wprintf(L"●");
- Sleep(170);
- if(_kbhit())
- goto KRAJ;
- gotoxy(13, 9);
- wprintf(L"●");
- Sleep(310);
- if(_kbhit())
- goto KRAJ;
- gotoxy(21, 9);
- wprintf(L" ");
- Sleep(300);
- if(_kbhit())
- goto KRAJ;
- gotoxy(23, 11);
- wprintf(L" ");
- Sleep(270);
- if(_kbhit())
- goto KRAJ;
- gotoxy(21, 13);
- wprintf(L" ");
- Sleep(200);
- if(_kbhit())
- goto KRAJ;
- gotoxy(17, 14);
- wprintf(L" ");
- Sleep(120);
- if(_kbhit())
- goto KRAJ;
- gotoxy(13, 13);
- wprintf(L" ");
- Sleep(140);
- if(_kbhit())
- goto KRAJ;
- gotoxy(11, 11);
- wprintf(L" ");
- Sleep(155);
- if(_kbhit())
- goto KRAJ;
- gotoxy(13, 9);
- wprintf(L" ");
- Sleep(310);
- if(_kbhit())
- goto KRAJ;
- if(i)
- {
- if(_kbhit())
- goto KRAJ;
- gotoxy(17, 8);
- wprintf(L"●");
- Sleep(300);
- if(_kbhit())
- goto KRAJ;
- gotoxy(21, 9);
- wprintf(L"●");
- Sleep(270);
- if(_kbhit())
- goto KRAJ;
- gotoxy(23, 11);
- wprintf(L"●");
- Sleep(200);
- if(_kbhit())
- goto KRAJ;
- gotoxy(21, 13);
- wprintf(L"●");
- Sleep(600);
- }
- }
- KRAJ:
- ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement