Program Co_Vua;
uses crt,graph,dos;
const _KT = 50;
Q_Vua = 0;
Q_Hau = 1;
Q_Tuong = 2;
Q_Ma = 3;
Q_Xe = 4;
Q_Tot = 5;
Q_Khong = 6;
T_Trong = 0;
T_Vao = 1;
T_ChuanBi = 2;
T_QuanCo = 3;
T_Chon = 4;
type TOCo = record
QuanCo: integer;
TuThe: integer;
MauO,MauCo: Word;
X,Y: integer;
end;
var gd,gm: integer;
MX,MY: integer;
OCo: array[-2..7,-2..7] of TOCo;
LaOCo,OChon : TOCo;
DangChon,EndGame: Boolean;
Luot: integer;
function mousex:word;assembler;asm
mov ax,3; int 33h; mov ax,cx end;
function mousey:word;assembler;asm
mov ax,3; int 33h; mov ax,dx end;
function leftclick:boolean;assembler;asm
mov ax,3; int 33h; and bx,1; mov ax,bx end;
function MouseArea(x1,y1,x2,y2:word):boolean;
begin
if (LeftClick)
and (mousex >=x1)
and (mousex <=x2)
and (mousey >=y1)
and (mousey <=y2)
then mousearea:=true
else mousearea:=false;
end;
Function InitMouse : boolean;
var r: registers;
Begin
r.ax:=$00;intr($33,r);
if r.ax<>0 then InitMouse:=true
else InitMouse:=false;
End;
Procedure ShowMouse;
Var r: registers;
begin
r.ax:=$01;intr($33,r);
End;
Procedure HideMouse;
Var r:registers;
Begin
r.ax:=$002;
intr($33,r);
End;
Procedure VeQuanVua(X,Y,Mau: integer);
Begin
Line(X,Y+48,X+30,Y+48);
Line(X,Y+48,X+7,Y+24);
Line(X+30,Y+48,X+23,Y+24);
Line(X+7,Y+24,X,Y+24);
Line(X+23,Y+24,X+30,Y+24);
Line(X,Y+24,X,Y+21);
Line(X+30,Y+24,X+30,Y+21);
Line(X,Y+21,X+7,Y+21);
Line(X+30,Y+21,X+23,Y+21);
Line(X+7,Y+21,X,Y+16);
Line(X+23,Y+21,X+30,Y+16);
Line(X,Y+16,X+12,Y+16);
Line(X+30,Y+16,X+18,Y+16);
Line(X+12,Y+16,X+12,Y+10);
Line(X+18,Y+16,X+18,Y+10);
Line(X+12,Y+10,X+8,Y+10);
Line(X+18,Y+10,X+22,Y+10);
Line(X+8,Y+10,X+8,Y+6);
Line(X+22,Y+10,X+22,Y+6);
Line(X+8,Y+6,X+12,Y+6);
Line(X+22,Y+6,X+18,Y+6);
Line(X+12,Y+6,X+12,Y+3);
Line(X+18,Y+6,X+18,Y+3);
Line(X+12,Y+3,X+18,Y+3);
CirCle(X+15,Y+22,3);
FloodFill(X+15,Y+28,Mau);
End;
Procedure VeQuanHau(X,Y,Mau: integer);
Begin
Line(X,Y+48,X+30,Y+48);
Line(X,Y+48,X+7,Y+24);
Line(X+30,Y+48,X+23,Y+24);
Line(X+7,Y+24,X,Y+24);
Line(X+23,Y+24,X+30,Y+24);
Line(X,Y+24,X,Y+21);
Line(X+30,Y+24,X+30,Y+21);
Line(X,Y+21,X+7,Y+21);
Line(X+30,Y+21,X+23,Y+21);
Line(X+7,Y+21,X,Y+16);
Line(X+23,Y+21,X+30,Y+16);
Line(X,Y+16,X+15,Y+10);
Line(X+30,Y+16,X+15,Y+10);
Line(X+15,Y+10,X+15,Y+3);
FloodFill(X+15,Y+28,Mau);
End;
Procedure VeQuanTuong(X,Y,Mau: integer);
Begin
Line(X,Y+48,X+30,Y+48);
Line(X,Y+48,X+7,Y+35);
Line(X+30,Y+48,X+23,Y+35);
Line(X+7,Y+35,X+7,Y+16);
Line(X+23,Y+35,X+23,Y+16);
Line(X+7,Y+16,X+15,Y+6);
Line(X+23,Y+16,X+15,Y+6);
FillEllipse(X+15,Y+4,2,2);
Line(X+7,Y+21,X+17,Y+9);
FloodFill(X+15,Y+28,Mau);
End;
Procedure VeQuanXe(X,Y,Mau: integer);
Begin
Line(X,Y+48,X+30,Y+48);
Line(X,Y+48,X+7,Y+35);
Line(X+30,Y+48,X+23,Y+35);
Line(X+7,Y+35,X+7,Y+16);
Line(X+23,Y+35,X+23,Y+16);
Line(X+7,Y+16,X,Y+16);
Line(X+23,Y+16,X+30,Y+16);
Line(X,Y+16,X,Y+6);
Line(X+30,Y+16,X+30,Y+6);
Line(X,Y+6,X+6,Y+6);
Line(X+30,Y+6,X+24,Y+6);
Line(X+6,Y+6,X+6,Y+10);
Line(X+24,Y+6,X+24,Y+10);
Line(X+6,Y+10,X+12,Y+10);
Line(X+24,Y+10,X+18,Y+10);
Line(X+12,Y+10,X+12,Y+6);
Line(X+18,Y+10,X+18,Y+6);
Line(X+12,Y+6,X+18,Y+6);
FloodFill(X+15,Y+28,Mau);
End;
Procedure VeQuanMa(X,Y,Mau: integer);
Begin
Line(X,Y+48,X+30,Y+48);
Line(X,Y+48,X+7,Y+35);
Line(X+30,Y+48,X+23,Y+35);
Line(X+7,Y+35,X+13,Y+25);
Line(X+13,Y+25,X+7,Y+17);
Line(X+7,Y+17,X,Y+23);
Line(X,Y+23,X-3,Y+20);
Line(X-3,Y+20,X+2,Y+8);
Line(X+2,Y+8,X+13,Y+5);
Line(X+13,Y+5,X+23,Y+10);
Line(X+23,Y+10,X+25,Y+30);
Line(X+25,Y+30,X+23,Y+35);
Circle(X+11,Y+12,2);
FloodFill(X+15,Y+28,Mau);
End;
Procedure VeQuanTot(X,Y,Mau: integer);
Begin
Line(X,Y+48,X+30,Y+48);
Line(X,Y+48,X+7,Y+35);
Line(X+30,Y+48,X+23,Y+35);
Line(X+7,Y+35,X+10,Y+20);
Line(X+10,Y+20,X+7,Y+13);
Line(X+23,Y+35,X+20,Y+20);
Line(X+20,Y+20,X+23,Y+13);
Line(X+7,Y+13,X+23,Y+13);
FillEllipse(X+15,Y+7,6,6);
FloodFill(X+15,Y+25,Mau);
End;
Procedure InQuanCo(X,Y,Quanco,Mau: integer);
Begin
SetColor(Mau);
SetFillStyle(1,Mau);
HiDeMouse;
case QuanCo of
Q_Vua:
VeQuanVua(X+10,Y,Mau);
Q_Hau:
VeQuanHau(X+10,Y,Mau);
Q_Tuong:
VeQuanTuong(X+10,Y,Mau);
Q_Xe:
VeQuanXe(X+10,Y,Mau);
Q_Ma:
VeQuanMa(X+10,Y,Mau);
Q_Tot:
VeQuanTot(X+10,Y,Mau);
end;
ShowMouse;
End;
Procedure ChuanBiTot(X,Y,Mau: integer);
Begin
if Mau = Red then
begin
if X < 7 then
begin
if OCo[X+1,Y].TuThe = T_Trong then OCo[X+1,Y].TuThe := T_ChuanBi;
if Y > 0 then
if (OCo[X+1,Y-1].TuThe <> T_Trong) and (OCo[X+1,Y-1].MauCo = Black)
then OCo[X+1,Y-1].TuThe := T_ChuanBi;
if (OCo[X+1,Y+1].TuThe <> T_Trong) and (OCo[X+1,Y+1].MauCo = Black)
then OCo[X+1,Y+1].TuThe := T_ChuanBi;
end;
if (X = 1) and (OCo[3,Y].TuThe = T_Trong) then
OCo[3,Y].TuThe := T_ChuanBi;
end
else
begin
if X > 0 then
begin
if OCo[X-1,Y].TuThe = T_Trong then OCo[X-1,Y].TuThe := T_ChuanBi;
if Y > 0 then
if (OCo[X-1,Y-1].TuThe <> T_Trong) and (OCo[X-1,Y-1].MauCo = Red)
then OCo[X-1,Y-1].TuThe := T_ChuanBi;
if (OCo[X-1,Y+1].TuThe <> T_Trong) and (OCo[X-1,Y+1].MauCo = Red)
then OCo[X-1,Y+1].TuThe := T_ChuanBi;
if (X = 6) and (OCo[4,Y].TuThe = T_Trong) then
OCo[4,Y].TuThe := T_ChuanBi;
end;
end;
End;
Procedure ChuanBiXe(X,Y,Mau: integer);
var i: integer;
Begin
for i := X+1 to 7 do
begin
if OCo[i,Y].Tuthe = T_Trong then
OCo[i,Y].TuThe := T_ChuanBi
else if OCo[i,Y].MauCo <> Mau then
begin
OCo[i,Y].TuThe := T_ChuanBi;
break;
end
else break;
end;
for i := X-1 downto 0 do
begin
if OCo[i,Y].Tuthe = T_Trong then
OCo[i,Y].TuThe := T_ChuanBi
else if OCo[i,Y].MauCo <> Mau then
begin
OCo[i,Y].TuThe := T_ChuanBi;
break;
end
else break;
end;
for i := Y+1 to 7 do
begin
if OCo[X,i].Tuthe = T_Trong then
OCo[X,i].TuThe := T_ChuanBi
else if OCo[X,i].MauCo <> Mau then
begin
OCo[X,i].TuThe := T_ChuanBi;
break;
end
else break;
end;
for i := Y-1 downto 0 do
begin
if OCo[X,i].Tuthe = T_Trong then
OCo[X,i].TuThe := T_ChuanBi
else if OCo[X,i].MauCo <> Mau then
begin
OCo[X,i].TuThe := T_ChuanBi;
break;
end
else break;
end;
End;
Procedure ChuanBiMa(X,Y,Mau: integer);
Begin
if (OCo[X+2,Y-1].TuThe = T_Trong) or
((OCo[X+2,Y-1].TuThe <> T_Trong) and (OCo[X+2,Y-1].MauCo <> Mau)) then
OCo[X+2,Y-1].TuThe := T_ChuanBi;
if (OCo[X-2,Y-1].TuThe = T_Trong) or
((OCo[X-2,Y-1].TuThe <> T_Trong) and (OCo[X-2,Y-1].MauCo <> Mau)) then
OCo[X-2,Y-1].TuThe := T_ChuanBi;
if (OCo[X+2,Y+1].TuThe = T_Trong) or
((OCo[X+2,Y+1].TuThe <> T_Trong) and (OCo[X+2,Y+1].MauCo <> Mau)) then
OCo[X+2,Y+1].TuThe := T_ChuanBi;
if (OCo[X-2,Y+1].TuThe = T_Trong) or
((OCo[X-2,Y+1].TuThe <> T_Trong) and (OCo[X-2,Y+1].MauCo <> Mau)) then
OCo[X-2,Y+1].TuThe := T_ChuanBi;
if (OCo[X+1,Y-2].TuThe = T_Trong) or
((OCo[X+1,Y-2].TuThe <> T_Trong) and (OCo[X+1,Y-2].MauCo <> Mau)) then
OCo[X+1,Y-2].TuThe := T_ChuanBi;
if (OCo[X+1,Y+2].TuThe = T_Trong) or
((OCo[X+1,Y+2].TuThe <> T_Trong) and (OCo[X+1,Y+2].MauCo <> Mau)) then
OCo[X+1,Y+2].TuThe := T_ChuanBi;
if (OCo[X-1,Y-2].TuThe = T_Trong) or
((OCo[X-1,Y-2].TuThe <> T_Trong) and (OCo[X-1,Y-2].MauCo <> Mau)) then
OCo[X-1,Y-2].TuThe := T_ChuanBi;
if (OCo[X-1,Y+2].TuThe = T_Trong) or
((OCo[X-1,Y+2].TuThe <> T_Trong) and (OCo[X-1,Y+2].MauCo <> Mau)) then
OCo[X-1,Y+2].TuThe := T_ChuanBi;
End;
Procedure ChuanBiTuong(X,Y,Mau: integer);
var i: integer;
Begin
for i := 1 to 7 do
begin
if (X - i >= 0) and (Y - i >= 0) then
begin
if (OCo[X-i,Y-i].TuThe = T_Trong) then
OCo[X-i,Y-i].TuThe := T_ChuanBi
else if (OCo[X-i,Y-i].MauCo <> Mau) then
begin
OCo[X-i,Y-i].TuThe := T_ChuanBi;
break;
end;
end
else break;
end;
for i := 1 to 7 do
begin
if (X + i <= 7) and (Y + i <= 7) then
begin
if (OCo[X+i,Y+i].TuThe = T_Trong) then
OCo[X+i,Y+i].TuThe := T_ChuanBi
else if (OCo[X+i,Y+i].MauCo <> Mau) then
begin
OCo[X+i,Y+i].TuThe := T_ChuanBi;
break;
end;
end
else break;
end;
for i := 1 to 7 do
begin
if (X - i >= 0) and (Y + i <= 7) then
begin
if (OCo[X-i,Y+i].TuThe = T_Trong) then
OCo[X-i,Y+i].TuThe := T_ChuanBi
else if (OCo[X-i,Y+i].MauCo <> Mau) then
begin
OCo[X-i,Y+i].TuThe := T_ChuanBi;
break;
end;
end
else break;
end;
for i := 1 to 7 do
begin
if (X + i <= 7) and (Y - i >= 0) then
begin
if (OCo[X+i,Y-i].TuThe = T_Trong) then
OCo[X+i,Y-i].TuThe := T_ChuanBi
else if (OCo[X+i,Y-i].MauCo <> Mau) then
begin
OCo[X+i,Y-i].TuThe := T_ChuanBi;
break;
end;
end
else break;
end;
End;
Procedure ChuanBiHau(X,Y,Mau: integer);
Begin
ChuanBiXe(X,Y,Mau);
ChuanBiTuong(X,Y,Mau);
End;
Procedure ChuanBiVua(X,Y,Mau: integer);
var i,j : integer;
Begin
for i := X-1 to X+1 do
for j := Y-1 to Y+1 do
begin
if (i <> X) or (j <> Y) then
if (OCo[i,j].TuThe = T_Trong) or ((OCo[i,j].TuThe = T_QuanCo)
and (OCo[i,j].MauCo <> Mau)) then
OCo[i,j].TuThe := T_ChuanBi;
end;
End;
Procedure ChuanBiQuanCo(X,Y,QuanCo,Mau: integer);
Begin
case QuanCo of
Q_Tot: ChuanBiTot(X,Y,Mau);
Q_Xe: ChuanBiXe(X,Y,Mau);
Q_Ma: ChuanBiMa(X,Y,Mau);
Q_Tuong: ChuanBiTuong(X,Y,Mau);
Q_Hau: ChuanBiHau(X,Y,Mau);
Q_Vua: ChuanBiVua(X,Y,Mau);
end;
End;
Procedure HuyChuanBi;
var i,j: integer;
Begin
for i := 0 to 7 do
for j := 0 to 7 do
begin
if OCo[i,j].TuThe = T_ChuanBi then
begin
if OCo[i,j].QuanCo = Q_Khong then OCo[i,j].TuThe := T_Trong
else OCo[i,j].TuThe := T_QuanCo;
end;
end;
End;
Procedure TaoBanCo;
var i,j,k: integer;
Begin
for i := 0 to 7 do
begin
if k = Green then k := White
else k := Green;
for j := 0 to 7 do
begin
SetFillStyle(1,k);
Bar(i*_KT,j*_KT,(i+1)*_KT,(j+1)*_KT);
OCo[i,j].Tuthe := T_Trong;
OCo[i,j].MauO := k;
OCo[i,j].X := i;
OCo[i,j].Y := j;
OCo[i,j].QuanCo := Q_Khong;
if k = Green then k := White
else k := Green;
end;
end;
{ In Chu }
SetColor(Red);
SetTextStyle(DefaultFont, HorizDir,4);
OutTextXy(8*_KT+10,20,'GAME');
SetColor(LightGreen);
OutTextXY(8*_KT+70,60,'CHESS');
InQuanCo(8*_KT+10,120,Q_Vua,White);
InQuanCo(8*_KT+80,120,Q_Hau,White);
InQuanCo(8*_KT+160,120,Q_Xe,White);
InQuanCo(8*_KT+10,230,Q_Ma,White);
InQuanCo(8*_KT+80,230,Q_Tuong,White);
InQuanCo(8*_KT+160,230,Q_Tot,White);
SetFillStyle(7,Brown);
Bar(8*_KT+30,320,8*_KT+200,400);
SetColor(Cyan);
OutTextXy(8*_KT+60,345,'EXIT');
End;
Procedure KhoiTaoGame;
var i,j: integer;
Begin
OCo[0,0].QuanCo := Q_Xe;
OCo[0,1].QuanCo := Q_Ma;
OCo[0,2].QuanCo := Q_Tuong;
OCo[0,3].QuanCo := Q_Hau;
OCo[0,4].QuanCo := Q_Vua;
OCo[0,5].QuanCo := Q_Tuong;
OCo[0,6].QuanCo := Q_Ma;
OCo[0,7].QuanCo := Q_Xe;
OCo[7,0].QuanCo := Q_Xe;
OCo[7,1].QuanCo := Q_Ma;
OCo[7,2].QuanCo := Q_Tuong;
OCo[7,3].QuanCo := Q_Hau;
OCo[7,4].QuanCo := Q_Vua;
OCo[7,5].QuanCo := Q_Tuong;
OCo[7,6].QuanCo := Q_Ma;
OCo[7,7].QuanCo := Q_Xe;
for i := 0 to 7 do
begin
Oco[1,i].QuanCo := Q_Tot;
OCo[6,i].QuanCo := Q_Tot;
end;
for i := 0 to 1 do
for j := 0 to 7 do
begin
OCo[i,j].MauCo := Red;
OCo[i,j].Tuthe := T_QuanCo;
InQuanCo(i*_KT,j*_KT,OCo[i,j].QuanCo,OCo[i,j].MauCo);
OCo[7-i,j].MauCo := Black;
OCo[7-i,j].TuThe := T_QuanCo;
InQuanCo((7-i)*_KT,j*_KT,OCo[7-i,j].QuanCo,OCo[7-i,j].MauCo);
end;
End;
Procedure MouseEnter;
var X,Y: integer;
St: string;
Begin
X := mousex div _KT;
Y := mousey div _KT;
if (X < 8) and (Y < 8) and LeftClick then
begin
if not DangChon and (OCo[X,Y].MauCo = Luot) and
(LaOCo.X = X) and (LaOCo.Y = Y) and (LaOCo.tuThe = T_QuanCo) then
begin
HideMouse;
SetFillStyle(1,LaOCo.MauO);
Bar(LaOCo.X*_KT,LaOCo.Y*_KT,(LaOCo.X + 1)*_KT,(LaOCo.Y + 1)*_KT);
OCo[LaOCo.X,LaOCo.Y].Tuthe := LaOCo.TuThe;
SetFillStyle(1,Yellow);
Bar(X*_KT,Y*_KT,(X+1)*_KT,(Y+1)*_KT);
InQuanCo(LaOCo.X*_KT,LaOCo.Y*_KT,LaOCo.quanCo,LaOCo.MauCo);
OChon := OCo[X,Y];
OCo[X,Y].TuThe := T_Chon;
LaOCo := OCo[X,Y];
ShowMouse;
Dangchon := True;
ChuanBiQuanCo(X,Y,OCo[X,Y].QuanCo,OCo[X,Y].MauCo);
end
else
if (OCo[X,Y].TuThe = T_Chon) then
begin
HideMouse;
SetFillStyle(1,LaOCo.MauO);
Bar(LaOCo.X*_KT,LaOCo.Y*_KT,(LaOCo.X + 1)*_KT,(LaOCo.Y + 1)*_KT);
OCo[LaOCo.X,LaOCo.Y].Tuthe := LaOCo.TuThe;
SetFillStyle(1,Yellow);
Bar(X*_KT,Y*_KT,(X+1)*_KT,(Y+1)*_KT);
if LaOCo.TuThe <> T_Trong then
InQuanCo(LaOCo.X*_KT,LaOCo.Y*_KT,LaOCo.quanCo,LaOCo.MauCo);
OCo[X,Y].TuThe := T_QuanCo;
LaOCo := OCo[X,Y];
ShowMouse;
DangChon := False;
HuyChuanBi;
end
else
if (LaOCo.X = X) and (LaOCo.Y = Y) and (LaOCo.TuThe = T_ChuanBi) then
begin
HuyChuanBi;
HideMouse;
if OCo[X,Y].QuanCo = Q_Vua then
begin
SetColor(Blue);
SetTextStyle(DefaultFont, HorizDir, 2);
if OCo[X,Y].MauCo = Red then
OutTextXY(2*_KT,4*_KT,'Ben Do Thua Roi!')
else
OutTextXY(2*_KT,4*_KT,'Ben Den Thua Roi!');
EndGame := True;
end;
OCo[X,Y].QuanCo := OChon.QuanCo;
OCo[X,Y].MauCo := OChon.MauCo;
SetFillStyle(1,OCo[X,Y].MauO);
Bar(X*_KT,Y*_KT,(X+1)*_KT,(Y+1)*_KT);
SetFillStyle(1,OChon.MauO);
Bar(OChon.X*_KT,OChon.Y*_KT,(OChon.X+1)*_KT,(Ochon.Y+1)*_KT);
InQuanCo(X*_KT,Y*_KT,OChon.QuanCo,OChon.MauCo);
OCo[OChon.X,OChon.Y].TuThe := T_Trong;
OCo[Ochon.X,OChon.Y].QuanCo := Q_Khong;
OCo[X,Y].TuThe := T_QuanCo;
LaOCo := OCo[OChon.X,Ochon.Y];
ShowMouse;
DangChon := False;
if Luot = Red then Luot := Black
else Luot := Red;
end;
end
else
if (X < 8) and (Y < 8) then
begin
case OCo[X,Y].TuThe of
T_Trong:
begin
HideMouse;
SetFillStyle(1,LaOCo.MauO);
if LaOCo.TuThe <> T_Chon then
begin
Bar(LaOCo.X*_KT,LaOCo.Y*_KT,(LaOCo.X + 1)*_KT,(LaOCo.Y + 1)*_KT);
OCo[LaOCo.X,LaOCo.Y].Tuthe := LaOCo.TuThe;
end;
if LaOco.TuThe <> T_Trong then
InQuanCo(LaOCo.X*_KT,LaOCo.Y*_KT,LaOCo.quanCo,LaOCo.MauCo);
SetFillStyle(1,Cyan);
Bar(X*_KT,Y*_KT,(X+1)*_KT,(Y+1)*_KT);
LaOCo := OCo[X,Y];
OCo[X,Y].TuThe := T_Vao;
ShowMouse;
end;
T_QuanCo:
begin
HideMouse;
SetFillStyle(1,LaOCo.MauO);
if LaOCo.TuThe <> T_Chon then
begin
Bar(LaOCo.X*_KT,LaOCo.Y*_KT,(LaOCo.X + 1)*_KT,(LaOCo.Y + 1)*_KT);
OCo[LaOCo.X,LaOCo.Y].Tuthe := LaOCo.TuThe;
end;
if LaOco.TuThe <> T_Trong then
InQuanCo(LaOCo.X*_KT,LaOCo.Y*_KT,LaOCo.quanCo,LaOCo.MauCo);
SetFillStyle(1,Blue);
Bar(X*_KT,Y*_KT,(X+1)*_KT,(Y+1)*_KT);
InQuanCo(X*_KT,Y*_KT,OCo[X,Y].QuanCo,OCo[X,Y].MauCo);
LaOCo := OCo[X,Y];
OCo[X,Y].TuThe := T_Vao;
ShowMouse;
end;
T_ChuanBi:
begin
HideMouse;
SetFillStyle(1,LaOCo.MauO);
if LaOCo.TuThe <> T_Chon then
begin
Bar(LaOCo.X*_KT,LaOCo.Y*_KT,(LaOCo.X + 1)*_KT,(LaOCo.Y + 1)*_KT);
OCo[LaOCo.X,LaOCo.Y].Tuthe := LaOCo.TuThe;
end;
if LaOco.TuThe <> T_Trong then
InQuanCo(LaOCo.X*_KT,LaOCo.Y*_KT,LaOCo.quanCo,LaOCo.MauCo);
SetFillStyle(1,Brown);
Bar(X*_KT,Y*_KT,(X+1)*_KT,(Y+1)*_KT);
InQuanCo(X*_KT,Y*_KT,OCo[X,Y].QuanCo,OCo[X,Y].MauCo);
LaOCo := OCo[X,Y];
OCo[X,Y].TuThe := T_Vao;
ShowMouse;
end;
end;
end;
End;
BEGIN
InitGraph(gd,gm,'');
MX := GetMaxX;
MY := GetMaxY;
InitMouse;
Luot := Red;
TaoBanCo;
KhoiTaoGame;
LaOCo := OCo[0,0];
DangChon := False;
EndGame := False;
ShowMouse;
repeat
MouseEnter;
until MouseAreA(8*_KT+30,320,8*_KT+200,400) or EndGame;
if EndGame then readln;
CloseGraph;
END.