my gobang(0分)

  • 主题发起人 主题发起人 linwei8182
  • 开始时间 开始时间
L

linwei8182

Unregistered / Unconfirmed
GUEST, unregistred user!
[blue][/blue][h1][/h1][purple][/purple]unit main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
OleCtrls, GXC5_TLB, StdCtrls,shellapi;
const Dir_up=1;Dir_upright=2;Dir_right=3;Dir_rightdown=4;Dir_down=5;
Dir_downleft=6;Dir_left=7;dir_leftup=8;
type
where=record
x,y:integer;
end;
TFormMain = class(TForm)
btnClolse: TButton;
ediLo: TEdit;
edtHi: TEdit;
whofirst: TGroupBox;
playerfirst: TRadioButton;
computerfirst: TRadioButton;
gamemode: TGroupBox;
pvsc: TRadioButton;
pvsp: TRadioButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
replay: TButton;
Label4: TLabel;
Button1: TButton;
procedure FormShow(Sender: TObject);
procedure btnClolseClick(Sender: TObject);
procedure pvspClick(Sender: TObject);
procedure pvscClick(Sender: TObject);
procedure playerfirstClick(Sender: TObject);
procedure computerfirstClick(Sender: TObject);
procedure replayClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

TMyGobang = class(TGXC5X)
private
public
procedure OnClickDown(var msg: TMessage);message WM_LBUTTONDOWN;
procedure shifouwin(xpos:integer;ypos:integer);
// procedure shifouwin1(xpos:integer;ypos:integer);
procedure FiveDropChess(Sender: TObject;
XPos, YPos: Integer);
procedure FiveDragDrop(Sender, Source: TObject;
X, Y: Integer);
procedure computerdropchess;
procedure fenxigstyle;
procedure jisuan;
end;

TXY = Record
X: Integer;
Y: Integer;
end;
var
FormMain : TFormMain;
MyGobang : TMyGobang;
i : integer = 0;
qipan : array[0..16,0..16]of integer;
direction : array [1..4] of TXY;
mouseclick1ok:boolean=false;
mouseclick2ok:boolean=false;
whoplay:(player,computer);
gstyle: array[1..2,0..16,0..16,1..8,1..2]of integer;
mark2,mark3: array[0..16,0..16,1..4]of integer;
s2,s3:record
max:integer;
x,y:integer;
end;
radom:array[0..224]of where;
a:integer=0;
b:integer;
implementation
{$R *.DFM}
{ TMyGobang }
procedure Tmygobang.jisuan;
var j1,k,w,t3,t2:integer;
begin
for j1:=1 to 15do
for k:=1 to 15 do
begin
if qipan[j1,k]=0
then
begin
for w:=1 to 4do
begin
if formmain.playerfirst.Checked=true
then
begin
if (gstyle[1,j1,k,w+4,1]=1)and (gstyle[1,j1,k,w+4,2]>=3)and(gstyle[2,j1,k,w+4,1]>=1)then
mark2[j1,k,(w )]:=2;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=1)then
mark2[j1,k,(w )]:=2;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]>=3)then
mark2[j1,k,(w )]:=2;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=4;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=3) then
mark2[j1,k,(w )]:=4;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=3) then
mark2[j1,k,(w )]:=4;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]>=2) then
mark2[j1,k,(w)]:=5;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=5;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=6;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]=1) then
mark2[j1,k,(w)]:=7;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=2) then
mark2[j1,k,(w)]:=7;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=8;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=8;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=8;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,2]=1) then
mark2[j1,k,(w )]:=8;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]=1) then
mark2[j1,k,(w )]:=8;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]=1) then
mark2[j1,k,(w )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]=1) then
mark2[j1,k,(w )]:=9;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=9;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]=1) then
mark2[j1,k,(w )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]=1) then
mark2[j1,k,(w )]:=9;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=1) then
mark2[j1,k,(w)]:=10;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=10;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark2[j1,k,(w)]:=10;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=10;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=10;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=10;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[1,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=10;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=30;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]=1) then
mark2[j1,k,(w )]:=30;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=2) then
mark2[j1,k,(w )]:=30;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=40;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=40;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,2]=1) then
mark2[j1,k,(w )]:=40;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=40;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=500;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=500;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=1200;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=1) then
mark2[j1,k,(w )]:=1200;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=0) then
mark2[j1,k,(w)]:=6000;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=0) then
mark2[j1,k,(w )]:=6000;
if (gstyle[1,j1,k,w,1]=4)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w+4,1]=0) then
mark2[j1,k,(w )]:=6000;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,1]>=2) then
mark2[j1,k,(w )]:=30000;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=0) then
mark2[j1,k,(w )]:=30000;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=0) then
mark2[j1,k,(w )]:=30000;
if (gstyle[2,j1,k,w,1]=4)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,1]=0) then
mark2[j1,k,(w )]:=30000;
end
else
if formmain.computerfirst.Checked=true then
begin
if (gstyle[2,j1,k,w+4,1]=1)and (gstyle[1,j1,k,w+4,2]>=3)and(gstyle[1,j1,k,w+4,1]>=1)
then
mark3[j1,k,(w )]:=2;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=1)then
mark3[j1,k,(w )]:=2;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]>=3)then
mark3[j1,k,(w )]:=2;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=4;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=3) then
mark3[j1,k,(w )]:=4;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=3) then
mark3[j1,k,(w )]:=4;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=5;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=5;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=6;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]=1) then
mark3[j1,k,(w )]:=7;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=7;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=8;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=8;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=8;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,2]=1) then
mark3[j1,k,(w )]:=8;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]=1) then
mark3[j1,k,(w )]:=8;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]=1) then
mark3[j1,k,(w )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]=1) then
mark3[j1,k,(w )]:=9;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=9;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w+4,2]=1) then
mark3[j1,k,(w )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]=1) then
mark3[j1,k,(w )]:=9;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=10;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=10;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=10;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=10;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=10;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=10;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[1,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=10;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=30;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]=1) then
mark3[j1,k,(w )]:=30;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=2) then
mark3[j1,k,(w )]:=30;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=40;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=40;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,2]=1) then
mark3[j1,k,(w )]:=40;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=40;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=500;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=500;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=1200;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w+4,2]>=1) then
mark3[j1,k,(w )]:=1200;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=0) then
mark3[j1,k,(w )]:=6000;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=0) then
mark3[j1,k,(w )]:=6000;
if (gstyle[2,j1,k,w,1]=4)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w+4,1]=0) then
mark3[j1,k,(w )]:=6000;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w+4,1]>=2) then
mark3[j1,k,(w )]:=30000;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w+4,1]=2)and(gstyle[1,j1,k,w+4,2]>=0) then
mark3[j1,k,(w )]:=30000;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w+4,1]=1)and(gstyle[1,j1,k,w+4,2]>=0) then
mark3[j1,k,(w )]:=30000;
if (gstyle[1,j1,k,w,1]=4)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w+4,1]=0) then
mark3[j1,k,(w )]:=30000;
end;
end;
for w:=5 to 8do
begin
if formmain.playerfirst.Checked=true
then
begin
if (gstyle[1,j1,k,w,1]=1)and (gstyle[1,j1,k,w,2]>=3)and(gstyle[2,j1,k,w,1]>=1)then
if (mark2[j1,k,(w-4 )]<2) then
mark2[j1,k,(w-4 )]:=2;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=1)then
if (mark2[j1,k,(w-4 )]<2) then
mark2[j1,k,(w-4 )]:=2;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]>=3)then
if (mark2[j1,k,(w-4 )]<2) then
mark2[j1,k,(w-4 )]:=2;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<4) then
mark2[j1,k,(w-4 )]:=4;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=3) then
if (mark2[j1,k,(w-4 )]<4) then
mark2[j1,k,(w-4 )]:=4;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=3) then
if (mark2[j1,k,(w-4 )]<4) then
mark2[j1,k,(w-4 )]:=4;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<5) then
mark2[j1,k,(w-4)]:=5;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<5) then
mark2[j1,k,(w-4 )]:=5;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<6) then
mark2[j1,k,(w-4 )]:=6;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark2[j1,k,(w-4 )]<7) then
mark2[j1,k,(w-4)]:=7;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<7) then
mark2[j1,k,(w-4)]:=7;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<8) then
mark2[j1,k,(w-4 )]:=8;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<8) then
mark2[j1,k,(w-4 )]:=8;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<8) then
mark2[j1,k,(w-4 )]:=8;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark2[j1,k,(w-4 )]<8) then
mark2[j1,k,(w-4 )]:=8;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]=1) then
if (mark2[j1,k,(w-4 )]<8) then
mark2[j1,k,(w-4 )]:=8;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]=1) then
if (mark2[j1,k,(w-4 )]<9) then
mark2[j1,k,(w-4 )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark2[j1,k,(w-4 )]<9) then
mark2[j1,k,(w-4 )]:=9;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<9) then
mark2[j1,k,(w-4 )]:=9;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark2[j1,k,(w-4 )]<9) then
mark2[j1,k,(w-4 )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<9) then
mark2[j1,k,(w-4 )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<9) then
mark2[j1,k,(w-4 )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark2[j1,k,(w-4 )]<9) then
mark2[j1,k,(w-4 )]:=9;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<9) then
mark2[j1,k,(w-4 )]:=9;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<9) then
mark2[j1,k,(w-4)]:=10;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<10) then
mark2[j1,k,(w-4 )]:=10;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<10) then
mark2[j1,k,(w-4)]:=10;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<10) then
mark2[j1,k,(w-4 )]:=10;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<10) then
mark2[j1,k,(w-4 )]:=10;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<10) then
mark2[j1,k,(w-4 )]:=10;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<10) then
mark2[j1,k,(w-4 )]:=10;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<30) then
mark2[j1,k,(w-4 )]:=30;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark2[j1,k,(w-4 )]<30) then
mark2[j1,k,(w-4 )]:=30;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark2[j1,k,(w-4 )]<30) then
mark2[j1,k,(w-4 )]:=30;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<40) then
mark2[j1,k,(w-4 )]:=40;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<40) then
mark2[j1,k,(w-4 )]:=40;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark2[j1,k,(w-4 )]<40) then
mark2[j1,k,(w-4 )]:=40;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<40) then
mark2[j1,k,(w-4 )]:=40;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<500) then
mark2[j1,k,(w-4 )]:=500;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<500) then
mark2[j1,k,(w-4 )]:=500;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<1200) then
mark2[j1,k,(w-4 )]:=1200;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark2[j1,k,(w-4 )]<1200) then
mark2[j1,k,(w-4 )]:=1200;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=0) then
if (mark2[j1,k,(w-4 )]<6000) then
mark2[j1,k,(w-4)]:=6000;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=0) then
if (mark2[j1,k,(w-4 )]<6000) then
mark2[j1,k,(w-4 )]:=6000;
if (gstyle[1,j1,k,w,1]=4)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w-4,1]=0) then
if (mark2[j1,k,(w-4 )]<6000) then
mark2[j1,k,(w-4 )]:=6000;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,1]>=2) then
if (mark2[j1,k,(w-4 )]<30000) then
mark2[j1,k,(w-4 )]:=30000;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=0) then
if (mark2[j1,k,(w-4 )]<30000) then
mark2[j1,k,(w-4 )]:=30000;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=0) then
if (mark2[j1,k,(w-4 )]<30000) then
mark2[j1,k,(w-4 )]:=30000;
if (gstyle[2,j1,k,w,1]=4)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,1]=0) then
if (mark2[j1,k,(w-4 )]<30000) then
mark2[j1,k,(w-4 )]:=30000;
end
else
if formmain.computerfirst.Checked=true then
begin
if (gstyle[2,j1,k,w-4,1]=1)and (gstyle[1,j1,k,w-4,2]>=3)and(gstyle[1,j1,k,w-4,1]>=1)
then
if (mark3[j1,k,(w-4 )]<2) then
mark3[j1,k,(w-4 )]:=2;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=1)then
if (mark3[j1,k,(w-4 )]<2) then
mark3[j1,k,(w-4 )]:=2;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]>=3)then
if (mark3[j1,k,(w-4 )]<2) then
mark3[j1,k,(w-4 )]:=2;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<4) then
mark3[j1,k,(w-4 )]:=4;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=3) then
if (mark3[j1,k,(w-4 )]<4) then
mark3[j1,k,(w-4 )]:=4;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=3) then
if (mark3[j1,k,(w-4 )]<4) then
mark3[j1,k,(w-4 )]:=4;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<5) then
mark3[j1,k,(w-4 )]:=5;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<5) then
mark3[j1,k,(w-4 )]:=5;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<6) then
mark3[j1,k,(w-4 )]:=6;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark3[j1,k,(w-4 )]<7) then
mark3[j1,k,(w-4 )]:=7;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<7) then
mark3[j1,k,(w-4 )]:=7;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<8) then
mark3[j1,k,(w-4 )]:=8;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<8) then
mark3[j1,k,(w-4 )]:=8;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<8) then
mark3[j1,k,(w-4 )]:=8;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark3[j1,k,(w-4 )]<8) then
mark3[j1,k,(w-4 )]:=8;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]=1) then
if (mark3[j1,k,(w-4 )]<8) then
mark3[j1,k,(w-4 )]:=8;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]=1) then
if (mark3[j1,k,(w-4 )]<9) then
mark3[j1,k,(w-4 )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark3[j1,k,(w-4 )]<9) then
mark3[j1,k,(w-4 )]:=9;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=1)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<9) then
mark3[j1,k,(w-4 )]:=9;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark3[j1,k,(w-4 )]<9) then
mark3[j1,k,(w-4 )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=1)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<9) then
mark3[j1,k,(w-4 )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<9) then
mark3[j1,k,(w-4 )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark3[j1,k,(w-4 )]<9) then
mark3[j1,k,(w-4 )]:=9;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<9) then
mark3[j1,k,(w-4 )]:=9;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<10) then
mark3[j1,k,(w-4 )]:=10;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<10) then
mark3[j1,k,(w-4 )]:=10;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<10) then
mark3[j1,k,(w-4 )]:=10;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<10) then
mark3[j1,k,(w-4 )]:=10;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<10) then
mark3[j1,k,(w-4 )]:=10;
if (gstyle[1,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<10) then
mark3[j1,k,(w-4 )]:=10;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=2)and(gstyle[1,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<10) then
mark3[j1,k,(w-4 )]:=10;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<30) then
mark3[j1,k,(w-4 )]:=30;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark3[j1,k,(w-4 )]<30) then
mark3[j1,k,(w-4 )]:=30;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=2) then
if (mark3[j1,k,(w-4 )]<30) then
mark3[j1,k,(w-4 )]:=30;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<40) then
mark3[j1,k,(w-4 )]:=40;
if (gstyle[2,j1,k,w,1]=1)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<40) then
mark3[j1,k,(w-4 )]:=40;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,2]=1) then
if (mark3[j1,k,(w-4 )]<40) then
mark3[j1,k,(w-4 )]:=40;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]=0)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<40) then
mark3[j1,k,(w-4 )]:=40;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<500) then
mark3[j1,k,(w-4 )]:=500;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<500) then
mark3[j1,k,(w-4 )]:=500;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<1200) then
mark3[j1,k,(w-4 )]:=1200;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=1)and(gstyle[2,j1,k,w-4,2]>=1) then
if (mark3[j1,k,(w-4 )]<1200) then
mark3[j1,k,(w-4 )]:=1200;
if (gstyle[2,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=0) then
if (mark3[j1,k,(w-4 )]<6000) then
mark3[j1,k,(w-4 )]:=6000;
if (gstyle[2,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=0) then
if (mark3[j1,k,(w-4 )]<6000) then
mark3[j1,k,(w-4 )]:=6000;
if (gstyle[2,j1,k,w,1]=4)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[2,j1,k,w-4,1]=0) then
if (mark3[j1,k,(w-4 )]<6000) then
mark3[j1,k,(w-4 )]:=6000;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]=0)and(gstyle[1,j1,k,w-4,1]>=2) then
if (mark3[j1,k,(w-4 )]<30000) then
mark3[j1,k,(w-4 )]:=30000;
if (gstyle[1,j1,k,w,1]=2)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w-4,1]=2)and(gstyle[1,j1,k,w-4,2]>=0) then
if (mark3[j1,k,(w-4 )]<30000) then
mark3[j1,k,(w-4 )]:=30000;
if (gstyle[1,j1,k,w,1]=3)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w-4,1]=1)and(gstyle[1,j1,k,w-4,2]>=0) then
if (mark3[j1,k,(w-4 )]<30000) then
mark3[j1,k,(w-4 )]:=30000;
if (gstyle[1,j1,k,w,1]=4)and(gstyle[1,j1,k,w,2]>=0)and(gstyle[1,j1,k,w-4,1]=0) then
if (mark3[j1,k,(w-4 )]<30000) then
mark3[j1,k,(w-4 )]:=30000;
end;
end;
end;
end;
t3:=0;t2:=0;s2.max:=1;s3.max:=1;s2.x:=8;s2.y:=8;s3.x:=8;s3.y:=8;
if s2.max>=s3.max
then
begin
radom[a].x:=s2.x;radom[a].y:=s2.y;a:=a+1;
end
else
begin
radom[a].x:=s3.x;radom[a].y:=s3.y;a:=a+1;
end;
{ TODO :do
this! }
for j1:=1 to 15do
for k:=1 to 15do
if qipan[j1,k]=0
then
begin
for w:=1 to 4do
begin
t2:=t2+mark2[j1,k,w];
t3:=t3+mark3[j1,k,w];
end;
if t2>s2.max
then
begin
s2.max:=t2;
s2.x:=j1;
s2.y:=k;
a:=0;
radom[a].x:=s2.x;radom[a].y:=s2.y;a:=a+1;
end;
if t2=s2.max
then
begin
radom[a].x:=s2.x;radom[a].y:=s2.y;a:=a+1;
end;
if t3>s3.max
then
begin
s3.max:=t3;
s3.x:=j1;
s3.y:=k;
a:=0;
radom[a].x:=s3.x;radom[a].y:=s3.y;a:=a+1;
end;
if t3=s3.max
then
begin
radom[a].x:=s3.x;radom[a].y:=s3.y;a:=a+1;
end;
t2:=0;t3:=0;
end
else
for w:=1 to 4do
begin
mark2[j1,k,w]:=0;
mark3[j1,k,w]:=0
end;
a:=b mod a;
s2.x:=radom[a].x;s2.y:=radom[a].y;
s3.x:=radom[a].x;s3.x:=radom[a].x;
a:=0;
end;
procedure Tmygobang.fenxigstyle;
var j,j1,k,w,t:integer;
begin
{black:2 white:3}
for j1:=1 to 15do
for k:=1 to 15do
begin
mygobang.XPos:=j1;
mygobang.YPos:=k;
if qipan[j1,k]=0
then
begin
for w:=1 to 4do
begin
j:=0;t:=0;
while (qipan[MyGobang.XPos + (j+1) * direction[w].X, MyGobang.YPos + (j+1) * direction[w].Y]
=2) and ((MyGobang.XPos + (j+1) * direction[w].X)>=1)and ((MyGobang.YPos + (j+1) * direction[w].Y)<=15)and((MyGobang.XPos + (j+1) * direction[w].X)<=15)and((MyGobang.YPos + (j+1) * direction[w].Y)>=1)do
begin
inc(j)
end;
gstyle[1,mygobang.XPos,mygobang.YPos,w,1]:=j;
while(qipan[MyGobang.XPos + (j+t+1) * direction[w].X, MyGobang.YPos + (j+t+1) * direction[w].Y]
=0) and ((MyGobang.XPos + (j+t+1) * direction[w].X)>=1)and ((MyGobang.YPos + (j+t+1) * direction[w].Y)<=15)and((MyGobang.XPos + (j+t+1) * direction[w].X)<=15)and ((MyGobang.YPos + (j+t+1) * direction[w].Y)>=1)do
begin
inc(t);
end;
if j<>0 then
gstyle[1,mygobang.XPos,mygobang.YPos,w,2]:=t else
gstyle[2,mygobang.XPos,mygobang.YPos,w,2]:=t;
t:=0;
j:=0;
while (qipan[MyGobang.XPos - (j+1) * direction[w].X, MyGobang.YPos - (j+1) * direction[w].Y]
=2) and ((MyGobang.XPos - (j+1) * direction[w].X)>=1)and ((MyGobang.YPos - (j+1) * direction[w].Y)<=15)and((MyGobang.XPos - (j+1) * direction[w].X)<=15)and((MyGobang.YPos - (j+1) * direction[w].Y)>=1)do
begin
inc(j);
end;
gstyle[1,mygobang.XPos,mygobang.YPos,w+4,1]:=j;
while(qipan[MyGobang.XPos - (j+t+1) * direction[w].X, MyGobang.YPos - (j+t+1) * direction[w].Y]
=0) and ((MyGobang.XPos - (j+t+1) * direction[w].X)>=1)and ((MyGobang.YPos - (j+t+1) * direction[w].Y)<=15)and((MyGobang.XPos - (j+t+1) * direction[w].X)<=15)and ((MyGobang.YPos - (j+t+1) * direction[w].Y)>=1)do
begin
inc(t);
end;
if j<>0 then
gstyle[1,mygobang.XPos,mygobang.YPos,w+4,2]:=t else
gstyle[2,mygobang.XPos,mygobang.YPos,w+4,2]:=t;
t:=0;
j:=0;
while (qipan[MyGobang.XPos + (j+1) * direction[w].X, MyGobang.YPos + (j+1) * direction[w].Y]
=3) and ((MyGobang.XPos + (j+1) * direction[w].X)>=1)and ((MyGobang.YPos + (j+1) * direction[w].Y)<=15)and((MyGobang.XPos + (j+1) * direction[w].X)<=15)and((MyGobang.YPos + (j+1) * direction[w].Y)>=1)do
begin
inc(j);
end;
gstyle[2,mygobang.XPos,mygobang.YPos,w,1]:=j;
while(qipan[MyGobang.XPos + (j+t+1) * direction[w].X, MyGobang.YPos + (j+t+1) * direction[w].Y]
=0) and ((MyGobang.XPos + (j+t+1) * direction[w].X)>=1)and ((MyGobang.YPos + (j+t+1) * direction[w].Y)<=15)and((MyGobang.XPos + (j+t+1) * direction[w].X)<=15)and ((MyGobang.YPos + (j+t+1) * direction[w].Y)>=1)do
begin
inc(t);
end;
if j<>0 then
gstyle[1,mygobang.XPos,mygobang.YPos,w,2]:=t else
gstyle[2,mygobang.XPos,mygobang.YPos,w,2]:=t;
t:=0;
j:=0;
while (qipan[MyGobang.XPos - (j+1) * direction[w].X, MyGobang.YPos - (j+1) * direction[w].Y]
=3) and ((MyGobang.XPos - (j+1) * direction[w].X)>=1)and ((MyGobang.YPos - (j+1) * direction[w].Y)<=15)and((MyGobang.XPos -(j+1) * direction[w].X)<=15)and((MyGobang.YPos -(j+1) * direction[w].Y)>=1)do
begin
inc(j);
end;
gstyle[2,mygobang.XPos,mygobang.YPos,w+4,1]:=j;
while(qipan[MyGobang.XPos - (j+t+1) * direction[w].X, MyGobang.YPos - (j+t+1) * direction[w].Y]
=0) and ((MyGobang.XPos -(j+t+1) * direction[w].X)>=1)and ((MyGobang.YPos -(j+t+1) * direction[w].Y)<=15)and((MyGobang.XPos -(j+t+1) * direction[w].X)<=15)and ((MyGobang.YPos -(j+t+1) * direction[w].Y)>=1)do
begin
inc(t);
end;
if j<>0 then
gstyle[1,mygobang.XPos,mygobang.YPos,w,2]:=t else
gstyle[2,mygobang.XPos,mygobang.YPos,w,2]:=t;
t:=0;
j:=0;
end;
end;
end;
end;
procedure Tmygobang.computerdropchess;
begin
mygobang.fenxigstyle;
mygobang.jisuan;
if formmain.playerfirst.Checked=true
then
begin
mygobang.XPos:=s2.x;
mygobang.YPos:=s2.y;
FormMain.ediLo.Text := IntToStr(MyGobang.XPos);
FormMain.edtHi.Text := IntToStr(MyGobang.YPos);
mygobang.DropWhite(mygobang.XPos,mygobang.YPos);
mygobang.Update;
qipan[mygobang.XPos,mygobang.YPos]:=3;
i:=i+1;
mygobang.shifouwin(mygobang.XPos,mygobang.YPos);
whoplay:=player;
end;
if formmain.computerfirst.Checked=true
then
begin
mygobang.XPos:=s3.x;
mygobang.YPos:=s3.y;
FormMain.ediLo.Text := IntToStr(MyGobang.XPos);
FormMain.edtHi.Text := IntToStr(MyGobang.YPos);
mygobang.DropBlack(mygobang.XPos,mygobang.YPos);
mygobang.Update;
qipan[mygobang.XPos,mygobang.YPos]:=2;
i:=i+1;
mygobang.shifouwin(mygobang.XPos,mygobang.YPos);
whoplay:=player;
end;
end;
procedure Tmygobang.shifouwin(XPos:integer;YPos:integer);
var
j,k,w,k1,k2,k3,k4,k5,t1,t2:integer;
begin
////////////////////////////////////////////////////////////////////////////////
for w := 1 to 4do
begin
j := 0;
while (qipan[MyGobang.XPos + j * direction[w].X, MyGobang.YPos + j * direction[w].Y]
= (((i-1) mod 2)+2)) and((MyGobang.XPos + j * direction[w].X)>=1)and ((MyGobang.YPos + j * direction[w].Y)<=15)do
inc(j);
k := j;
j := 1;
while (qipan[MyGobang.XPos - j * direction[w].X, MyGobang.YPos - j * direction[w].Y] = (((i-1) mod 2)+2)) and
((MyGobang.XPos + j * direction[w].X)>=1)and ((MyGobang.YPos + j * direction[w].Y)<=15)do
inc(j);
k := k + j - 1;
if k = 5 then
begin
if (i-1) mod 2=0 then
showmessage('黑方胜!')
else
showmessage('白方胜!');
mygobang.Init;
i := 0;
for t1 := 0 to 16do
for t2 := 0 to 16do
qipan[t1,t2]:=0;
for k1:=1 to 2do
for k2:=0 to 16do
for k3:=0 to 16do
for k4:=1 to 8do
for k5:=1 to 2do
gstyle[k1,k2,k3,k4,k5]:=0 ;
for k1:=0 to 16do
for k2:=0 to 16do
for k3:=1 to 4do
begin
mark2[k1,k2,k3]:=0;
mark3[k1,k2,k3]:=0;
end;
s2.max:=1;s2.x:=8;s2.y:=8;s3.max:=1;s3.x:=8;s3.y:=8;
formmain.gamemode.Enabled:=true;
formmain.pvsp.Checked:=false;
formmain.pvsc.Checked:=false;
formmain.playerfirst.Checked:=false;
formmain.computerfirst.Checked:=false;
formmain.whofirst.Enabled:=false;
mouseclick2ok:=false;
mouseclick1ok:=false;
end
else
if k > 5 then
begin
if (i-1) mod 2 = 0 then
showmessage('黑棋长连禁手!'+#10+#13+'白方胜!')
else
showmessage('白棋长连禁手!'+#10+#13+'黑方胜!');
mygobang.Init;
i := 0;
for t1 := 0 to 16do
for t2 := 0 to 16do
qipan[t1,t2]:=0;
for k1:=1 to 2do
for k2:=0 to 16do
for k3:=0 to 16do
for k4:=1 to 8do
for k5:=1 to 2do
gstyle[k1,k2,k3,k4,k5]:=0;
for k1:=0 to 16do
for k2:=0 to 16do
for k3:=0 to 5do
begin
mark2[k1,k2,k3]:=0;
mark3[k1,k2,k3]:=0;
end;
s2.max:=1;s2.x:=8;s2.y:=8;s3.max:=1;s3.x:=8;s3.y:=8;
formmain.gamemode.Enabled:=true;
formmain.pvsp.Checked:=false;
formmain.pvsc.Checked:=false;
formmain.playerfirst.Checked:=false;
formmain.computerfirst.Checked:=false;
formmain.whofirst.Enabled:=false;
mouseclick2ok:=false;
mouseclick1ok:=false;
end;
end;

end;
procedure TMyGobang.OnClickDown(var msg: TMessage);
begin
b:=msg.lparamlo;
//ShowMessage(IntToStr(msg.LParamHi) + #10 + #13 + IntToStr(msg.LParamLo));
if mouseclick1ok=true then
begin
MyGobang.XPos := round(((msg.LParamLo + 18) / 27));
MyGobang.YPos := round(((msg.LParamHi + 18) / 25));
FormMain.ediLo.Text := IntToStr(MyGobang.XPos);
FormMain.edtHi.Text := IntToStr(MyGobang.YPos);
if (i mod 2=0)and (MyGobang.XPos>=1)and (MyGobang.YPos>=1)and (MyGobang.XPos<=15)and(MyGobang.YPos<=15)and(mygobang.ChessColor[mygobang.XPos,mygobang.YPos]<>ccblack)and(mygobang.ChessColor[mygobang.XPos,mygobang.YPos]<>ccwhite) then
begin
MyGobang.DropBlack(MyGobang.XPos, MyGobang.YPos);
MyGobang.Update;
qipan[MyGobang.XPos, MyGobang.YPos]:=2;
i:=i+1;
mygobang.shifouwin(mygobang.xpos,mygobang.ypos);
end
else
if (i mod 2=1) and (MyGobang.XPos>=1)and (MyGobang.YPos>=1)and (MyGobang.XPos<=15)and(MyGobang.YPos<=15)and(mygobang.chesscolor[mygobang.xpos,mygobang.ypos]<>ccblack) and (mygobang.chesscolor[mygobang.xpos,mygobang.ypos]<>ccwhite)then
begin
mygobang.DropWhite(mygobang.xpos,mygobang.ypos);
mygobang.Update;
qipan[mygobang.xpos,mygobang.ypos]:=3;
i:=i+1;
mygobang.shifouwin(mygobang.xpos,mygobang.ypos);
end;
end;
if (mouseclick2ok=true) and (whoplay=player)
then
begin
MyGobang.XPos := round((msg.LParamLo + 19) div 25);
MyGobang.YPos := round((msg.LParamHi + 19) div 25);
FormMain.ediLo.Text := IntToStr(MyGobang.XPos);
FormMain.edtHi.Text := IntToStr(MyGobang.YPos);
if (formmain.playerfirst.Checked=true)and (MyGobang.XPos>=1)and (MyGobang.YPos>=1)and (MyGobang.XPos<=15)and(MyGobang.YPos<=15)and(mygobang.ChessColor[mygobang.XPos,mygobang.YPos]<>ccblack)and(mygobang.ChessColor[mygobang.XPos,mygobang.YPos]<>ccwhite)
then
begin
mygobang.DropBlack(mygobang.xpos,mygobang.ypos);
mygobang.Update;
qipan[mygobang.xpos,mygobang.ypos]:=2;
i:=i+1;
mygobang.shifouwin(mygobang.xpos,mygobang.ypos);
whoplay:=computer;
mouseclick2ok:=false;
mygobang.computerdropchess;
mouseclick2ok:=true;
{ TODO : 待续 }
end;
if (formmain.computerfirst.Checked=true)and (MyGobang.XPos>=1)and (MyGobang.YPos>=1)and (MyGobang.XPos<=15)and(MyGobang.YPos<=15)and(mygobang.ChessColor[mygobang.XPos,mygobang.YPos]<>ccblack)and(mygobang.ChessColor[mygobang.XPos,mygobang.YPos]<>ccwhite)
then
begin
mygobang.Dropwhite(mygobang.xpos,mygobang.ypos);
mygobang.Update;
qipan[mygobang.xpos,mygobang.ypos]:=3;
i:=i+1;
mygobang.shifouwin(mygobang.xpos,mygobang.ypos);
whoplay:=computer;
mouseclick2ok:=false;
mygobang.computerdropchess;
{i:=i+1;}
mouseclick2ok:=true;
{ TODO : 待续 }
end;
end;
end;
procedure TFormMain.FormShow(Sender: TObject);
var j,k,k1,k2,k3,k4,k5:integer;
begin
shellexecute(0,nil,'regsvr32.exe','c:/five1.1/a/gxc5.ocx','',sw_show);
Mygobang := TMyGobang.Create(self);
MyGobang.Init;
MyGobang.Parent := FormMain;
MyGobang.Top := 30;
MyGobang.Left := 30;
for j:=1 to 15do
for k:=1 to 15do
qipan[j,k]:=0;
for k1:=1 to 2do
for k2:=1 to 15do
for k3:=1 to 15do
for k4:=1 to 8do
for k5:=1 to 2do
gstyle[k1,k2,k3,k4,k5]:=0;
for k1:=1 to 15do
for k2:=1 to 15do
for k3:=1 to 8do
begin
mark2[k1,k2,k3]:=0;
mark3[k1,k2,k3]:=0;
end;
//////////////////////////
direction[1].X := 0;
direction[1].Y :=-1;
//////////////////////////
direction[2].X := 1;
direction[2].Y := -1;
//////////////////////////
direction[3].X := 1;
direction[3].Y := 0;
//////////////////////////
direction[4].X := 1;
direction[4].Y := 1;
//////////////////////////

end;

procedure TMyGobang.FiveDropChess(Sender: TObject;
XPos, YPos: Integer);
begin
ShowMessage(IntToStr(XPos) + IntToStr(XPos))
end;

procedure TMyGobang.FiveDragDrop(Sender, Source: TObject;
X, Y: Integer);
begin
ShowMessage(IntToStr(X) + IntToStr(X))
end;

procedure TFormMain.btnClolseClick(Sender: TObject);
begin
Close;
end;


procedure TFormMain.pvspClick(Sender: TObject);
begin
if pvsp.Checked=true
then
begin
gamemode.Enabled:=false;
mouseclick1ok:=true
end;
end;

procedure TFormMain.pvscClick(Sender: TObject);
begin
if pvsc.Checked=true
then
begin
gamemode.Enabled:=false;
whofirst.Enabled:=true;
end
end;


procedure TFormMain.playerfirstClick(Sender: TObject);
begin
whofirst.Enabled:=false;
whoplay:=player;
mouseclick2ok:=true;
end;

procedure TFormMain.computerfirstClick(Sender: TObject);
begin
whofirst.Enabled:=false;
whoplay:=computer;
mygobang.computerdropchess;
mouseclick2ok:=true;
end;
procedure TFormMain.replayClick(Sender: TObject);
var j,k,k1,k2,k3,k4,k5:integer;
begin
mygobang.Init;
i:=0;
for j:=1 to 15do
for k:=1 to 15do
qipan[j,k]:=0;
for k1:=1 to 2do
for k2:=1 to 15do
for k3:=1 to 15do
for k4:=1 to 8do
for k5:=1 to 2do
gstyle[k1,k2,k3,k4,k5]:=0;
for k1:=1 to 15do
for k2:=1 to 15do
for k3:=1 to 8do
begin
mark2[k1,k2,k3]:=0;
mark3[k1,k2,k3]:=0;
end;
s2.max:=1;s2.x:=8;s2.y:=8;s3.max:=1;s3.x:=8;s3.y:=8;
formmain.gamemode.Enabled:=true;
formmain.pvsp.Checked:=false;
formmain.pvsc.Checked:=false;
formmain.playerfirst.Checked:=false;
formmain.computerfirst.Checked:=false;
formmain.whofirst.Enabled:=false;
mouseclick2ok:=false;
mouseclick1ok:=false;
end;


procedure TFormMain.Button1Click(Sender: TObject);
begin
showmessage('除非你跪下求我!');
// showmessage('对方不同意悔棋!');
end;

end.
 
后退
顶部