SHPORA.net :: PDA

Login:
регистрация

Main
FAQ

гуманитарные науки
естественные науки
математические науки
технические науки
Search:
Title: | Body:

Проверка выйгрыша


if r<8 then begin

for e:=1 to 3 do

for i:=1 to 3 do begin

if (stringgrid1.Cells[i-1,e-1]='o') and (stringgrid1.Cells[i,e]='o') and (stringgrid1.Cells[i+1,e+1]='o') then ShowMessage('Победа о');

if (stringgrid1.Cells[i-1,e-1]='x') and (stringgrid1.Cells[i,e]='x') and (stringgrid1.Cells[i+1,e+1]='x') then ShowMessage('Победа x');

//слево на право по диагонали

if (stringgrid1.Cells[i+1,e-1]='o') and (stringgrid1.Cells[i,e]='o') and (stringgrid1.Cells[i-1,e+1]='o') then ShowMessage('Победа о');

if (stringgrid1.Cells[i+1,e-1]='x') and (stringgrid1.Cells[i,e]='x') and (stringgrid1.Cells[i-1,e+1]='x') then ShowMessage('Победа x');

//справо на лево по диагонали

if (stringgrid1.Cells[e-1,i-1]='o') and (stringgrid1.Cells[e-1,i]='o') and (stringgrid1.Cells[e-1,i+1]='o') then ShowMessage('Победа о');

if (stringgrid1.Cells[e-1,i-1]='x') and (stringgrid1.Cells[e-1,i]='x') and (stringgrid1.Cells[e-1,i+1]='x') then ShowMessage('Победа x');

//по вертикали

if (stringgrid1.Cells[i-1,e-1]='o') and (stringgrid1.Cells[i,e-1]='o') and (stringgrid1.Cells[i+1,e-1]='o') then ShowMessage('Победа о');

if (stringgrid1.Cells[i-1,e-1]='x') and (stringgrid1.Cells[i,e-1]='x') and (stringgrid1.Cells[i+1,e-1]='x') then ShowMessage('Победа x');

//по горизонтали

end

end

else

ShowMessage('Ничья!');

r:=r+1;

end;



end.