for i:=1 to ChessW do
for j:=1 to ChessW do
if (Value[p,i,j,0].VN=2) and (Value[p,i,j,0].V>=VV[2]) and not(Value[p,i,j,0].LB)
and not(Value[p,i,j,0].RB) and (Value[p,i,j,0].D<=5) then
begin TPut(i,j,p);Exit;end;
if CheckC(p,2)>0 then
begin
SortC(p,2,1);
TPut(ValueC[p,1,2].X,ValueC[p,1,2].Y,p);
Exit;
end;
for i:=1 to ChessW do
for j:=1 to ChessW do
if (Value[p,i,j,0].VN=2) and (Value[p,i,j,0].V>=VV[2]) and not(Value[p,i,j,0].LB)
and not(Value[p,i,j,0].RB) and (Value[p,i,j,0].D<=5) then
begin TPut(i,j,p);Exit;end;
if CheckC(_p,2)>0 then
begin
SortC(_p,2,2);
TPut(ValueC[_p,1,2].X,ValueC[_p,1,2].Y,p);
Exit;
end;
if CheckC(p,1)>0 then
begin
SortC(p,1,2);
TPut(ValueC[p,1,1].X,ValueC[p,1,1].Y,p);
Exit;
end;
if JustBegin then
if CheckC(_p,1)>0 then
begin
SortC(_p,1,2);
t:=ValueC[_p,0,1].V;
if t>3 then t:=Random(8)+1;
TPut(ValueC[_p,t,1].X,ValueC[_p,t,1].Y,p);
JustBegin:=False;
Exit;
end;
begin
x:=(ChessW div 3)+Random(ChessW div 3);
y:=(ChessW div 3)+Random(ChessW div 3);
TPut(x,y,p);
end;
end;
procedure Wait;
var
ch:Char;
begin
repeat
until KeyPressed;
ch:=ReadKey;
end;
procedure Pre;
var
i:integer;
begin
for i:=1 to 6 do
begin
delay(100+random(300));
write('.');
end;
InitChess;
ViewState0(1);
writeln('初始化成功');
writeln('Preset Successfully');
writeln;
writeln('使用方向键和回车键控制');
writeln('Use directiion keys and enter key to control');
writeln;
writeln('单击任何按键开始');
writeln('Click any key to start');
writeln;
for j:=1 to ChessW do
if (Value[p,i,j,0].VN=2) and (Value[p,i,j,0].V>=VV[2]) and not(Value[p,i,j,0].LB)
and not(Value[p,i,j,0].RB) and (Value[p,i,j,0].D<=5) then
begin TPut(i,j,p);Exit;end;
if CheckC(p,2)>0 then
begin
SortC(p,2,1);
TPut(ValueC[p,1,2].X,ValueC[p,1,2].Y,p);
Exit;
end;
for i:=1 to ChessW do
for j:=1 to ChessW do
if (Value[p,i,j,0].VN=2) and (Value[p,i,j,0].V>=VV[2]) and not(Value[p,i,j,0].LB)
and not(Value[p,i,j,0].RB) and (Value[p,i,j,0].D<=5) then
begin TPut(i,j,p);Exit;end;
if CheckC(_p,2)>0 then
begin
SortC(_p,2,2);
TPut(ValueC[_p,1,2].X,ValueC[_p,1,2].Y,p);
Exit;
end;
if CheckC(p,1)>0 then
begin
SortC(p,1,2);
TPut(ValueC[p,1,1].X,ValueC[p,1,1].Y,p);
Exit;
end;
if JustBegin then
if CheckC(_p,1)>0 then
begin
SortC(_p,1,2);
t:=ValueC[_p,0,1].V;
if t>3 then t:=Random(8)+1;
TPut(ValueC[_p,t,1].X,ValueC[_p,t,1].Y,p);
JustBegin:=False;
Exit;
end;
begin
x:=(ChessW div 3)+Random(ChessW div 3);
y:=(ChessW div 3)+Random(ChessW div 3);
TPut(x,y,p);
end;
end;
procedure Wait;
var
ch:Char;
begin
repeat
until KeyPressed;
ch:=ReadKey;
end;
procedure Pre;
var
i:integer;
begin
for i:=1 to 6 do
begin
delay(100+random(300));
write('.');
end;
InitChess;
ViewState0(1);
writeln('初始化成功');
writeln('Preset Successfully');
writeln;
writeln('使用方向键和回车键控制');
writeln('Use directiion keys and enter key to control');
writeln;
writeln('单击任何按键开始');
writeln('Click any key to start');
writeln;