#include <iostream>
using namespace std;
void plansza(char t[][10])
{
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
cout << " " << t[i][j] << " ";
}
cout << endl;
}
}
bool wygrana(char t[][10], char g)
{
bool test;
int i;
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
if ((t[i][j]!='|' && t[i][j]==t[i+1][j]==t[i+2][j]==t[i+3][j]==t[i+4][j]) ||
(t[i][j]!='|' && t[i][j]==t[i][j+1]==t[i][j+2]==t[i][j+3]==t[i][j+4]) ||
(t[i][j]!='|' && t[i][j]==t[i+1][j+1]==t[i+2][j+2]==t[i+3][j+3]==t[i+4][j+4]) ) {
plansza(t);
cout << "nGRACZ " << g << " WYGRYWA!!!nn";
return true;
}
}
}
return false;
}
int komputer(char t[])
{
int ruch, i, m, mmx;
mmx = -10;
for(i = 1; i <= 9; i++)
if(t[i] == ' ')
{
t[i] = 'X';
m = 1;
t[i] = ' ';
if(m > mmx)
{
mmx = m; ruch = i;
}
}
return ruch;
}
void ruch(char t[][10], char &gracz)
{
int x,y;
plansza(t);
if(gracz == 'O')
{
cout << "nCZLOWIEK : współrzędna X: ";
cin >> y;
cout << "nCZLOWIEK : współrzędna Y: ";
cin >> x;
}
else
{
cout << "nKOMPUTER : wybiera ruch : " << x << endl;
}
t[x-1][y-1]='O';
}
main()
{
char t[10][10],gracz,wybor;
for(int i = 0; i < 10; i++) {
for(int j = 0; j < 10; j++) {
t[i][j]='|';
}
}
do
{
cout << "Gra w Kolko i Krzyzyk ";
gracz = 'O';
cout << endl;
plansza(t);
while(!wygrana(t,'X') && !wygrana(t,'O')){
gracz = 'O';
ruch(t,gracz);
gracz = 'X';
}
cout << "Jeszcze raz ? (T = TAK) : ";
cin >> wybor;
cout << "nnn";
} while(true);
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}