Page 91 - C:\Users\Admin\Desktop\Sach mem upweb\
P. 91

100 Problems & Solutions                                                Trang 91


                           'W': If (a[i,j] = 'W') then
                                Begin
                                m:= 1;
                                   repeat
                                   if (a [i+huongi[m],j+huongj[m]] = 'B')
                                    and(i+huongi[m]>0)and(j+huongj[m]>0)
                                    and(i+2*huongi[m]>0)and(j+2*huongj[m]>0)
                                    and(i+huongi[m]<9)and(j+huongj[m]<9)
                                    and(i+2*huongi[m]<9)and(j+2*huongj[m]<9)
                                    and(a[i+2*huongi[m],j+2*huongj[m]] = '-')
                                     then
                                        di[i+2*huongi[m],j+2*huongj[m]] := True;
                                m:=m+1;
                                until m>8;
                                end;
                          End;{of Case}
                      End;
                      {================================================}
                      Procedure lietke;
                      Var
                        i,j,m: Integer;
                        t: Boolean;
                      Begin
                        t:= false;
                      for i:=1 to 8 do
                       for j:= 1 to 8 do
                           di[i,j]:=false;
                      for i:=1 to 8 do
                       for j:= 1 to 8 do kiemtra(i,j);
                          for i:= 1 to 8 do
                            for j:= 1 to 8 do
                            If di[i,j] then
                                        Begin
                                         t:= True;
                                         Write (f,'(',i,',',j,')');
                                         End;
                      If t=false then  Write (f, 'No legal move.');
                      Writeln(f);
                      End;
                      {======================================}
                      Procedure latco(x0,y0:integer);
                      Var m:integer;
                      Begin
                       Case c of
                        'B': if a[x0,y0] ='-'then
                             begin
                                m:= 1;
                                repeat
                                     If (a[x0-2*huongi[m],y0-2*huongj[m]] = 'B')
                                     and(a[x0-huongi[m],y0-huongj[m]] = 'W')



                      Tin học & Nhà trường                                       100 Đề Toán - Tin học
   86   87   88   89   90   91   92   93   94   95   96