Page 92 - C:\Users\Admin\Desktop\Sach mem upweb\
P. 92
100 Problems & Solutions Trang 92
then
begin
a[x0,y0]:='B';
a[x0-huongi[m],y0-huongj[m]] := 'B';
end;
m:=m+1;
until m>8;
end;
'W': if a[x0,y0] ='-'then
begin
m:= 1;
repeat
If (a[x0-2*huongi[m],y0-2*huongj[m]] = 'W')
and(a[x0-huongi[m],y0-huongj[m]] = 'B')
then
begin
a[x0,y0]:='W';
a[x0-huongi[m],y0-huongj[m]] := 'W';
end;
m:=m+1;
until m>8;
end;
end;
End;
{=============================================}
Procedure Thuchien(k:integer);
Var
i,j,xx,yy,xx1,yy1: Integer;
code,m: Integer;
Begin
for i:= 1 to 8 do
for j:= 1 to 8 do
begin
if a[i,j]='W'then yy1:=yy1+1;
if a[i,j]='B'then xx1:=xx1+1;
end;
xx:= 0; yy:= 0;
for i:= 1 to 8 do
for j:= 1 to 8 do kiemtra(i,j);
If not di[x0[k],y0[k]] then
begin
Case c Of
'W':c:= 'B';
'B':c:= 'W';
End;
for i:= 1 to 8 do
for j:= 1 to 8 do kiemtra(i,j);
If not di[x0[k],y0[k]] then
Tin học & Nhà trường 100 Đề Toán - Tin học