⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ueval.pas

📁 象棋源码
💻 PAS
📖 第 1 页 / 共 5 页
字号:
//if (bg>6)and(wg>6)then
//begin
//    if vb-vw>=0 then
//    result:=round((sqrt(vb-vw)+temp)*100)/100
//    else result:=-round((sqrt(vw-vb)-temp)*100)/100;
//end
//else
//begin
  temp := sqrt(bg * 100) - sqrt(wg * 100) + addvalue;
  if vb - vw >= 0 then
    result := round((sqrt(vb - vw) * 2 + temp) * 100) / 100
  else result := -round((sqrt(vw - vb) * 2 - temp) * 100) / 100;
//end;
end;

function addvalue: integer;
var
  addition, i: integer;
begin
  addition := 0;
//real freehand
  if ichess[1, 1] = none then
  begin
    if (ichess[1, 2] = mancolor) and (ichess[2, 1] = mancolor) and (ichess[2, 2] = mancolor) then
      inc(addition, 2 * freehand)
    else if (ichess[1, 2] = compcolor) and (ichess[2, 1] = compcolor) and (ichess[2, 2] = compcolor) then
      dec(addition, 2 * freehand);
  end;
  if ichess[8, 8] = none then
  begin
    if (ichess[7, 8] = mancolor) and (ichess[8, 7] = mancolor) and (ichess[7, 7] = mancolor) then
      inc(addition, 2 * freehand)
    else if (ichess[7, 8] = compcolor) and (ichess[8, 7] = compcolor) and (ichess[7, 7] = compcolor) then
      dec(addition, 2 * freehand);
  end;
  if ichess[1, 8] = none then
  begin
    if (ichess[1, 7] = mancolor) and (ichess[2, 8] = mancolor) and (ichess[2, 7] = mancolor) then
      inc(addition, 2 * freehand)
    else if (ichess[1, 7] = compcolor) and (ichess[2, 8] = compcolor) and (ichess[2, 7] = compcolor) then
      dec(addition, 2 * freehand);
  end;
  if ichess[8, 1] = none then
  begin
    if (ichess[8, 2] = mancolor) and (ichess[7, 1] = mancolor) and (ichess[7, 2] = mancolor) then
      inc(addition, 2 * freehand)
    else if (ichess[8, 2] = compcolor) and (ichess[7, 1] = compcolor) and (ichess[7, 2] = compcolor) then
      dec(addition, 2 * freehand);
  end;

  for i := 2 to 7 do
  begin
    if ichess[i, 1] = none then
    begin
      if (ichess[i - 1, 1] = mancolor) and (ichess[i + 1, 1] = mancolor) and (ichess[i, 2] = mancolor) and (ichess[i - 1, 2] = mancolor) and (ichess[i + 1, 2] = mancolor) then
        inc(addition, 2 * freehand)
      else if (ichess[i - 1, 1] = compcolor) and (ichess[i + 1, 1] = compcolor) and (ichess[i, 2] = compcolor) and (ichess[i - 1, 2] = compcolor) and (ichess[i + 1, 2] = compcolor) then
        dec(addition, 2 * freehand);
    end;
  end;
  for i := 2 to 7 do
  begin
    if ichess[i, 8] = none then
    begin
      if (ichess[i - 1, 8] = mancolor) and (ichess[i + 1, 8] = mancolor) and (ichess[i, 7] = mancolor) and (ichess[i - 1, 7] = mancolor) and (ichess[i + 1, 7] = mancolor) then
        inc(addition, 2 * freehand)
      else if (ichess[i - 1, 8] = compcolor) and (ichess[i + 1, 8] = compcolor) and (ichess[i, 7] = compcolor) and (ichess[i - 1, 7] = compcolor) and (ichess[i + 1, 7] = compcolor) then
        dec(addition, 2 * freehand);
    end;
  end;
  for i := 2 to 7 do
  begin
    if ichess[1, i] = none then
    begin
      if (ichess[1, i - 1] = mancolor) and (ichess[1, i + 1] = mancolor) and (ichess[2, i] = mancolor) and (ichess[2, i - 1] = mancolor) and (ichess[2, i + 1] = mancolor) then
        inc(addition, 2 * freehand)
      else if (ichess[1, i - 1] = compcolor) and (ichess[1, i + 1] = compcolor) and (ichess[2, i] = compcolor) and (ichess[2, i - 1] = compcolor) and (ichess[2, i + 1] = compcolor) then
        dec(addition, 2 * freehand);
    end;
  end;
  for i := 2 to 7 do
  begin
    if ichess[8, i] = none then
    begin
      if (ichess[8, i - 1] = mancolor) and (ichess[8, i + 1] = mancolor) and (ichess[7, i] = mancolor) and (ichess[7, i - 1] = mancolor) and (ichess[7, i + 1] = mancolor) then
        inc(addition, 2 * freehand)
      else if (ichess[8, i - 1] = compcolor) and (ichess[8, i + 1] = compcolor) and (ichess[7, i] = compcolor) and (ichess[7, i - 1] = compcolor) and (ichess[7, i + 1] = compcolor) then
        dec(addition, 2 * freehand);
    end;
  end;


//--oxxo--
  if (ichess[1, 1] = none) and (ichess[2, 1] = none) and (ichess[3, 1] = compcolor) and (ichess[4, 1] = mancolor) and (ichess[5, 1] = mancolor) and (ichess[6, 1] = compcolor) and (ichess[7, 1] = none) and (ichess[8, 1] = none) then
    dec(addition, 2 * freehand);
  if (ichess[1, 8] = none) and (ichess[2, 8] = none) and (ichess[3, 8] = compcolor) and (ichess[4, 8] = mancolor) and (ichess[5, 8] = mancolor) and (ichess[6, 8] = compcolor) and (ichess[7, 8] = none) and (ichess[8, 8] = none) then
    dec(addition, 2 * freehand);
  if (ichess[1, 1] = none) and (ichess[1, 2] = none) and (ichess[1, 3] = compcolor) and (ichess[1, 4] = mancolor) and (ichess[1, 5] = mancolor) and (ichess[1, 6] = compcolor) and (ichess[1, 7] = none) and (ichess[1, 8] = none) then
    dec(addition, 2 * freehand);
  if (ichess[8, 1] = none) and (ichess[8, 2] = none) and (ichess[8, 3] = compcolor) and (ichess[8, 4] = mancolor) and (ichess[8, 5] = mancolor) and (ichess[8, 6] = compcolor) and (ichess[8, 7] = none) and (ichess[8, 8] = none) then
    dec(addition, 2 * freehand);
  if (ichess[1, 1] = none) and (ichess[2, 1] = none) and (ichess[3, 1] = mancolor) and (ichess[4, 1] = compcolor) and (ichess[5, 1] = compcolor) and (ichess[6, 1] = mancolor) and (ichess[7, 1] = none) and (ichess[8, 1] = none) then
    inc(addition, 2 * freehand);
  if (ichess[1, 8] = none) and (ichess[2, 8] = none) and (ichess[3, 8] = mancolor) and (ichess[4, 8] = compcolor) and (ichess[5, 8] = compcolor) and (ichess[6, 8] = mancolor) and (ichess[7, 8] = none) and (ichess[8, 8] = none) then
    inc(addition, 2 * freehand);
  if (ichess[1, 1] = none) and (ichess[1, 2] = none) and (ichess[1, 3] = mancolor) and (ichess[1, 4] = compcolor) and (ichess[1, 5] = compcolor) and (ichess[1, 6] = mancolor) and (ichess[1, 7] = none) and (ichess[1, 8] = none) then
    inc(addition, 2 * freehand);
  if (ichess[8, 1] = none) and (ichess[8, 2] = none) and (ichess[8, 3] = mancolor) and (ichess[8, 4] = compcolor) and (ichess[8, 5] = compcolor) and (ichess[8, 6] = mancolor) and (ichess[8, 7] = none) and (ichess[8, 8] = none) then
    inc(addition, 2 * freehand);

//-oooooo-
  if (ichess[2, 1] = compcolor) and (ichess[3, 1] = compcolor) and (ichess[4, 1] = compcolor) and (ichess[5, 1] = compcolor) and (ichess[6, 1] = compcolor) and (ichess[7, 1] = compcolor) then
    inc(addition, 2 * freehand);
  if (ichess[2, 8] = compcolor) and (ichess[3, 8] = compcolor) and (ichess[4, 8] = compcolor) and (ichess[5, 8] = compcolor) and (ichess[6, 8] = compcolor) and (ichess[7, 8] = compcolor) then
    inc(addition, 2 * freehand);
  if (ichess[1, 2] = compcolor) and (ichess[1, 3] = compcolor) and (ichess[1, 4] = compcolor) and (ichess[1, 5] = compcolor) and (ichess[1, 6] = compcolor) and (ichess[1, 7] = compcolor) then
    inc(addition, 2 * freehand);
  if (ichess[8, 2] = compcolor) and (ichess[8, 3] = compcolor) and (ichess[8, 4] = compcolor) and (ichess[8, 5] = compcolor) and (ichess[8, 6] = compcolor) and (ichess[8, 7] = compcolor) then
    inc(addition, 2 * freehand);
  if (ichess[2, 1] = mancolor) and (ichess[3, 1] = mancolor) and (ichess[4, 1] = mancolor) and (ichess[5, 1] = mancolor) and (ichess[6, 1] = mancolor) and (ichess[7, 1] = mancolor) then
    dec(addition, 2 * freehand);
  if (ichess[2, 8] = mancolor) and (ichess[3, 8] = mancolor) and (ichess[4, 8] = mancolor) and (ichess[5, 8] = mancolor) and (ichess[6, 8] = mancolor) and (ichess[7, 8] = mancolor) then
    dec(addition, 2 * freehand);
  if (ichess[1, 2] = mancolor) and (ichess[1, 3] = mancolor) and (ichess[1, 4] = mancolor) and (ichess[1, 5] = mancolor) and (ichess[1, 6] = mancolor) and (ichess[1, 7] = mancolor) then
    dec(addition, 2 * freehand);
  if (ichess[8, 2] = mancolor) and (ichess[8, 3] = mancolor) and (ichess[8, 4] = mancolor) and (ichess[8, 5] = mancolor) and (ichess[8, 6] = mancolor) and (ichess[8, 7] = mancolor) then
    dec(addition, 2 * freehand);
//o-ooooo-
//????????
  if (ichess[1, 1] = compcolor) and (ichess[2, 1] = none) and (ichess[3, 1] = compcolor) and (ichess[4, 1] = compcolor) and (ichess[5, 1] = compcolor) and (ichess[6, 1] = compcolor) and (ichess[7, 1] = compcolor) and ((ichess[2, 2] <> mancolor) or (ichess[3, 2] <> mancolor)) then
    dec(addition, 3 * freehand);
  if (ichess[8, 1] = compcolor) and (ichess[7, 1] = none) and (ichess[6, 1] = compcolor) and (ichess[5, 1] = compcolor) and (ichess[4, 1] = compcolor) and (ichess[3, 1] = compcolor) and (ichess[2, 1] = compcolor) and ((ichess[7, 2] <> mancolor) or (ichess[6, 2] <> mancolor)) then
    dec(addition, 3 * freehand);
  if (ichess[1, 1] = compcolor) and (ichess[1, 2] = none) and (ichess[1, 3] = compcolor) and (ichess[1, 4] = compcolor) and (ichess[1, 5] = compcolor) and (ichess[1, 6] = compcolor) and (ichess[1, 7] = compcolor) and ((ichess[2, 2] <> mancolor) or (ichess[2, 3] <> mancolor)) then
    dec(addition, 3 * freehand);
  if (ichess[1, 8] = compcolor) and (ichess[1, 7] = none) and (ichess[1, 6] = compcolor) and (ichess[1, 5] = compcolor) and (ichess[1, 4] = compcolor) and (ichess[1, 3] = compcolor) and (ichess[1, 2] = compcolor) and ((ichess[2, 7] <> mancolor) or (ichess[2, 6] <> mancolor)) then
    dec(addition, 3 * freehand);
  if (ichess[1, 8] = compcolor) and (ichess[2, 8] = none) and (ichess[3, 8] = compcolor) and (ichess[4, 8] = compcolor) and (ichess[5, 8] = compcolor) and (ichess[6, 8] = compcolor) and (ichess[7, 8] = compcolor) and ((ichess[2, 7] <> mancolor) or (ichess[3, 7] <> mancolor)) then
    dec(addition, 3 * freehand);
  if (ichess[8, 8] = compcolor) and (ichess[7, 8] = none) and (ichess[6, 8] = compcolor) and (ichess[5, 8] = compcolor) and (ichess[4, 8] = compcolor) and (ichess[3, 8] = compcolor) and (ichess[2, 8] = compcolor) and ((ichess[7, 7] <> mancolor) or (ichess[6, 7] <> mancolor)) then
    dec(addition, 3 * freehand);
  if (ichess[8, 1] = compcolor) and (ichess[8, 2] = none) and (ichess[8, 3] = compcolor) and (ichess[8, 4] = compcolor) and (ichess[8, 5] = compcolor) and (ichess[8, 6] = compcolor) and (ichess[8, 7] = compcolor) and ((ichess[7, 2] <> mancolor) or (ichess[7, 3] <> mancolor)) then
    dec(addition, 3 * freehand);
  if (ichess[8, 8] = compcolor) and (ichess[8, 7] = none) and (ichess[8, 6] = compcolor) and (ichess[8, 5] = compcolor) and (ichess[8, 4] = compcolor) and (ichess[8, 3] = compcolor) and (ichess[8, 2] = compcolor) and ((ichess[7, 7] <> mancolor) or (ichess[7, 6] <> mancolor)) then
    dec(addition, 3 * freehand);

  if (ichess[1, 1] = mancolor) and (ichess[2, 1] = none) and (ichess[3, 1] = mancolor) and (ichess[4, 1] = mancolor) and (ichess[5, 1] = mancolor) and (ichess[6, 1] = mancolor) and (ichess[7, 1] = mancolor) and ((ichess[2, 2] <> mancolor) or (ichess[3, 2] <> mancolor)) then
    inc(addition, 3 * freehand);
  if (ichess[8, 1] = mancolor) and (ichess[7, 1] = none) and (ichess[6, 1] = mancolor) and (ichess[5, 1] = mancolor) and (ichess[4, 1] = mancolor) and (ichess[3, 1] = mancolor) and (ichess[2, 1] = mancolor) and ((ichess[7, 2] <> mancolor) or (ichess[6, 2] <> mancolor)) then
    inc(addition, 3 * freehand);
  if (ichess[1, 1] = mancolor) and (ichess[1, 2] = none) and (ichess[1, 3] = mancolor) and (ichess[1, 4] = mancolor) and (ichess[1, 5] = mancolor) and (ichess[1, 6] = mancolor) and (ichess[1, 7] = mancolor) and ((ichess[2, 2] <> mancolor) or (ichess[2, 3] <> mancolor)) then
    inc(addition, 3 * freehand);
  if (ichess[1, 8] = mancolor) and (ichess[1, 7] = none) and (ichess[1, 6] = mancolor) and (ichess[1, 5] = mancolor) and (ichess[1, 4] = mancolor) and (ichess[1, 3] = mancolor) and (ichess[1, 2] = mancolor) and ((ichess[2, 7] <> mancolor) or (ichess[2, 6] <> mancolor)) then
    inc(addition, 3 * freehand);
  if (ichess[1, 8] = mancolor) and (ichess[2, 8] = none) and (ichess[3, 8] = mancolor) and (ichess[4, 8] = mancolor) and (ichess[5, 8] = mancolor) and (ichess[6, 8] = mancolor) and (ichess[7, 8] = mancolor) and ((ichess[2, 7] <> mancolor) or (ichess[3, 7] <> mancolor)) then
    inc(addition, 3 * freehand);
  if (ichess[8, 8] = mancolor) and (ichess[7, 8] = none) and (ichess[6, 8] = mancolor) and (ichess[5, 8] = mancolor) and (ichess[4, 8] = mancolor) and (ichess[3, 8] = mancolor) and (ichess[2, 8] = mancolor) and ((ichess[7, 7] <> mancolor) or (ichess[6, 7] <> mancolor)) then
    inc(addition, 3 * freehand);
  if (ichess[8, 1] = mancolor) and (ichess[8, 2] = none) and (ichess[8, 3] = mancolor) and (ichess[8, 4] = mancolor) and (ichess[8, 5] = mancolor) and (ichess[8, 6] = mancolor) and (ichess[8, 7] = mancolor) and ((ichess[7, 2] <> mancolor) or (ichess[7, 3] <> mancolor)) then
    inc(addition, 3 * freehand);
  if (ichess[8, 8] = mancolor) and (ichess[8, 7] = none) and (ichess[8, 6] = mancolor) and (ichess[8, 5] = mancolor) and (ichess[8, 4] = mancolor) and (ichess[8, 3] = mancolor) and (ichess[8, 2] = mancolor) and ((ichess[7, 7] <> mancolor) or (ichess[7, 6] <> mancolor)) then
    inc(addition, 3 * freehand);

//-o------
  if (ichess[1, 1] = none) and (ichess[2, 1] = mancolor) and (ichess[3, 1] = none) and ((ichess[4, 1] = none) or (ichess[4, 1] = compcolor)) and (ichess[5, 1] = none) and (ichess[7, 1] = none) and (ichess[8, 1] = none) then
    inc(addition, 5 * freehand);
  if (ichess[1, 1] = none) and (ichess[2, 1] = none) and (ichess[4, 1] = none) and ((ichess[5, 1] = none) or (ichess[5, 1] = compcolor)) and (ichess[6, 1] = none) and (ichess[7, 1] = mancolor) and (ichess[8, 1] = none) then
    inc(addition, 5 * freehand);
  if (ichess[1, 8] = none) and (ichess[2, 8] = mancolor) and (ichess[3, 8] = none) and ((ichess[4, 8] = none) or (ichess[4, 8] = compcolor)) and (ichess[5, 8] = none) and (ichess[7, 8] = none) and (ichess[8, 8] = none) then
    inc(addition, 5 * freehand);
  if (ichess[1, 8] = none) and (ichess[2, 8] = none) and (ichess[4, 8] = none) and ((ichess[5, 8] = none) or (ichess[5, 8] = compcolor)) and (ichess[6, 8] = none) and (ichess[7, 8] = mancolor) and (ichess[8, 8] = none) then
    inc(addition, 5 * freehand);
  if (ichess[1, 1] = none) and (ichess[1, 2] = mancolor) and (ichess[1, 3] = none) and ((ichess[1, 4] = none) or (ichess[1, 4] = compcolor)) and (ichess[1, 5] = none) and (ichess[1, 7] = none) and (ichess[1, 8] = none) then
    inc(addition, 5 * freehand);
  if (ichess[1, 1] = none) and (ichess[1, 2] = none) and (ichess[1, 4] = none) and ((ichess[1, 5] = none) or (ichess[1, 5] = compcolor)) and (ichess[1, 6] = none) and (ichess[1, 7] = mancolor) and (ichess[1, 8] = none) then
    inc(addition, 5 * freehand);
  if (ichess[8, 1] = none) and (ichess[8, 2] = mancolor) and (ichess[8, 3] = none) and ((ichess[8, 4] = none) or (ichess[8, 4] = compcolor)) and (ichess[8, 5] = none) and (ichess[8, 7] = none) and (ichess[8, 8] = none) then
    inc(addition, 5 * freehand);
  if (ichess[8, 1] = none) and (ichess[8, 2] = none) and (ichess[8, 4] = none) and ((ichess[8, 5] = none) or (ichess[8, 5] = compcolor)) and (ichess[8, 6] = none) and (ichess[8, 7] = mancolor) and (ichess[8, 8] = none) then
    inc(addition, 5 * freehand);

  if (ichess[1, 1] = none) and (ichess[2, 1] = compcolor) and (ichess[3, 1] = none) and ((ichess[4, 1] = none) or (ichess[4, 1] = mancolor)) and (ichess[5, 1] = none) and (ichess[7, 1] = none) and (ichess[8, 1] = none) then
    dec(addition, 5 * freehand);
  if (ichess[1, 1] = none) and (ichess[2, 1] = none) and (ichess[4, 1] = none) and ((ichess[5, 1] = none) or (ichess[5, 1] = mancolor)) and (ichess[6, 1] = none) and (ichess[7, 1] = compcolor) and (ichess[8, 1] = none) then
    dec(addition, 5 * freehand);
  if (ichess[1, 8] = none) and (ichess[2, 8] = compcolor) and (ichess[3, 8] = none) and ((ichess[4, 8] = none) or (ichess[4, 8] = mancolor)) and (ichess[5, 8] = none) and (ichess[7, 8] = none) and (ichess[8, 8] = none) then
    dec(addition, 5 * freehand);
  if (ichess[1, 8] = none) and (ichess[2, 8] = none) and (ichess[4, 8] = none) and ((ichess[5, 8] = none) or (ichess[5, 8] = mancolor)) and (ichess[6, 8] = none) and (ichess[7, 8] = compcolor) and (ichess[8, 8] = none) then
    dec(addition, 5 * freehand);
  if (ichess[1, 1] = none) and (ichess[1, 2] = compcolor) and (ichess[1, 3] = none) and ((ichess[1, 4] = none) or (ichess[1, 4] = mancolor)) and (ichess[1, 5] = none) and (ichess[1, 7] = none) and (ichess[1, 8] = none) then
    dec(addition, 5 * freehand);
  if (ichess[1, 1] = none) and (ichess[1, 2] = none) and (ichess[1, 4] = none) and ((ichess[1, 5] = none) or (ichess[1, 5] = mancolor)) and (ichess[1, 6] = none) and (ichess[1, 7] = compcolor) and (ichess[1, 8] = none) then
    dec(addition, 5 * freehand);
  if (ichess[8, 1] = none) and (ichess[8, 2] = compcolor) and (ichess[8, 3] = none) and ((ichess[8, 4] = none) or (ichess[8, 4] = mancolor)) and (ichess[8, 5] = none) and (ichess[8, 7] = none) and (ichess[8, 8] = none) then
    dec(addition, 5 * freehand);
  if (ichess[8, 1] = none) and (ichess[8, 2] = none) and (ichess[8, 4] = none) and ((ichess[8, 5] = none) or (ichess[8, 5] = mancolor)) and (ichess[8, 6] = none) and (ichess[8, 7] = compcolor) and (ichess[8, 8] = none) then
    dec(addition, 5 * freehand);
{
for i:=2 to 7 do
if ichess[1,i]=none then
begin
    changechess(1,i,compcolor,0);
    if chessable=1 then
    begin
        changechess(1,i,mancolor,0);
        if chessable=0 then inc(addition,freehand);
    end
    else
    begin
        changechess(1,i,mancolor,0);
        if chessable=1 then dec(addition,freehand);
    end;
end;
for i:=2 to 7 do
if ichess[8,i]=none then
begin
    changechess(8,i,compcolor,0);
    if chessable=1 then
    begin
        changechess(8,i,mancolor,0);
        if chessable=0 then inc(addition,freehand);
    end
    else
    begin
        changechess(8,i,mancolor,0);
        if chessable=1 then dec(addition,freehand);
    end;
end;
for i:=2 to 7 do
if ichess[i,1]=none then
begin
    changechess(i,1,compcolor,0);
    if chessable=1 then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -