| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1926 人关注过本帖
标题:哪个高手帮忙看一下这个游戏的原代码
只看楼主 加入收藏
yangguofa
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2004-5-5
收藏
 问题点数:0 回复次数:10 
哪个高手帮忙看一下这个游戏的原代码

unit main;

interface

uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, fcImager, Menus,about, DeckCard, ExtCtrls, Buttons, fcButton, fcImgBtn, fcShapeBtn;

type TForm1 = class(TForm) MainMenu1: TMainMenu; N1: TMenuItem; B1: TMenuItem; N2: TMenuItem; X1: TMenuItem; O1: TMenuItem; H1: TMenuItem; I1: TMenuItem; N3: TMenuItem; A1: TMenuItem; Timer1: TTimer; SpeedButton3: TSpeedButton; SpeedButton4: TSpeedButton; SpeedButton5: TSpeedButton; SpeedButton6: TSpeedButton; SpeedButton7: TSpeedButton; procedure A1Click(Sender: TObject); procedure CardsClick(Sender: TObject); procedure CardsdbClick(Sender: TObject); procedure B1Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); procedure fcShapeBtn1Click(Sender: TObject); procedure SpeedButton3Click(Sender: TObject); procedure SpeedButton4Click(Sender: TObject); procedure SpeedButton5Click(Sender: TObject); procedure SpeedButton6Click(Sender: TObject); procedure SpeedButton7Click(Sender: TObject); procedure I1Click(Sender: TObject); procedure X1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } procedure init_card_value; procedure init_game; procedure TISHI_LIANGPAI(); procedure jiaopai(ower,cardcolor:integer); procedure qidipai(ower:integer); procedure sortcard(ower,dipai:integer); procedure liangdipai(); procedure pause(pausetime:integer); procedure diandipai(ower:integer); procedure chupai(ower:integer); function countcolornum(ower,color:integer):integer;

public { Public declarations } end;

var Form1: TForm1; currentstage,stage1,stage2,playower,currentcardnum,i,j,k,zhupaicolor:integer; cardarray:array [1..108] of tdeckcards; thebox:twincontrol; chupai_ower,chupai_color,chupai_num,chupai_value:integer; implementation

{$R *.DFM}

procedure TForm1.A1Click(Sender: TObject); begin ShowAboutBox; end; {新游戏开始} procedure tform1.init_game; begin stage1:=2; stage2:=2; playower:=0; end; {新局开始初始化值} procedure tform1.init_card_value; var nTemp,k1,k2,k3: Integer; begin timer1.Enabled:=false; zhupaicolor:=-1; fcshapebtn1.orientation:=soup; fcshapebtn1.hint:=''; speedbutton3.enabled:=FALSE; speedbutton4.enabled:=FALSE; speedbutton5.enabled:=FALSE; speedbutton6.enabled:=FALSE; speedbutton7.enabled:=FALSE; TheBox := TWinControl.create( self ); currentcardnum:=0; for i := 1 to 54 do begin cardarray[i] := TdeckCards.create( self ); cardarray[i].parent := thebox; CardArray[i].value := i; cardarray[i+54] := TdeckCards.create( self ); cardarray[i+54].parent := thebox; cardarray[i+54].value:=i; end; Randomize; val(TimeToStr(Time),k3,i); for i := 1 to k3 do for j := 1 to 108 do begin k1:= Random(108) + 1; k2:= Random(108) + 1; nTemp := CardArray[k1].value; CardArray[k1].value := CardArray[k2].value; CardArray[k2].value := nTemp; end; end;

搜索更多相关主题的帖子: 代码 游戏 
2004-06-09 20:09
yangguofa
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2004-5-5
收藏
得分:0 

procedure TForm1.CardsdbClick(Sender: TObject); begin with sender as tdeckcards do begin top:=200; left:=180; pause(2); chupai_color:=value div 13; chupai_num:=1; chupai_value:=value; chupai_ower:=0; end; for i:=1 to 3 do chupai((chupai_ower+1) mod 4); end;

procedure TForm1.CardsClick(Sender: TObject); begin with sender as tdeckcards do top:=fcimager1.height-96-10-20; end;

procedure TForm1.B1Click(Sender: TObject); var middlex,middley:integer; begin init_game; for i:=1 to 108 do if assigned(cardarray[i]) then cardarray[i].free; init_card_value; middlex:=(fcimager1.width-71-2*108) div 2; middley:=(fcimager1.height-96) div 2; for i:=1 to 108 do begin cardarray[i].parent:= form1; cardarray[i].left:=middlex+(i-1)*2 ; cardarray[i].top:= middley; cardarray[i].faceup:=true; {测试使用时全显示} end; timer1.enabled:=true; end;

procedure TForm1.Timer1Timer(Sender: TObject); var tempi,player0startx,player1starty,player2startx,player3starty,player4startx:integer; begin currentcardnum:=currentcardnum+1; player0startx:=(fcimager1.width-71-15*(currentcardnum-1)) div 2; player1starty:=(fcimager1.height-96+15*(currentcardnum-1)) div 2; player2startx:=(fcimager1.width-71+15*(currentcardnum-1)) div 2; player3starty:=(fcimager1.height-96-15*(currentcardnum-1)) div 2; for i:=1 to currentcardnum do begin cardarray[(i-1)*4+1].onclick:=cardsclick; cardarray[(i-1)*4+1].ondblclick:=cardsdbclick; cardarray[(i-1)*4+1].left:=player0startx+(i-1)*15 ; cardarray[(i-1)*4+1].top:= fcimager1.height-96-10; cardarray[(i-1)*4+2].left:=fcimager1.width-71-10 ; cardarray[(i-1)*4+2].top:= player1starty-(i-1)*15; cardarray[(i-1)*4+3].left:=player2startx-(i-1)*15 ; cardarray[(i-1)*4+3].top:= fcimager1.top+10; cardarray[(i-1)*4+4].left:=fcimager1.left+10 ; cardarray[(i-1)*4+4].top:= player3starty+(i-1)*15; cardarray[(i-1)*4+1].faceup:=true; {判断南家是否能叫牌} if cardarray[(i-1)*4+1].value=53 then {小王} for j:=1 to currentcardnum do begin if (cardarray[(j-1)*4+1].value<53) and (((cardarray[(j-1)*4+1].value-stagE1) mod 13)=0) then {有该级的牌} if ((cardarray[(j-1)*4+1].value-stage1) div 13)=1 then {草花} speedbutton5.enabled:=true else if ((cardarray[(j-1)*4+1].value-stage1) div 13)=3 then {黑桃} speedbutton3.enabled:=true; if (cardarray[(j-1)*4+1].value=53) and (i<>j) then speedbutton7.enabled:=true; {无将} end; if cardarray[(i-1)*4+1].value=54 then {大王} for j:=1 to currentcardnum do begin if (cardarray[(j-1)*4+1].value<53) AND (((cardarray[(j-1)*4+1].value-STAGE1) mod 13)=0) then {有该级的牌} if ((cardarray[(j-1)*4+1].value-stage1) div 13)=2 then {方块} speedbutton6.enabled:=true else if ((cardarray[(j-1)*4+1].value-stage1) div 13)=0 then {红心} speedbutton4.enabled:=true; if (cardarray[(j-1)*4+1].value=54) and (i<>j) then speedbutton7.enabled:=true; {无将} end; end; player4startx:=(fcimager1.width-71-2*(108-currentcardnum*4)) div 2; for i:=currentcardnum*4+1 to 108 do cardarray[i].left:=player4startx+(i-currentcardnum*4)*2 ; if currentcardnum=25 then begin timer1.Enabled:=false; TISHI_LIANGPAI(); end; end;

procedure tform1.pause(pausetime:integer); var currentTime:longint; begin form1.refresh; currentTime:=GetTickCount; while GetTickCount<currentTime+pausetime*1000 do ;

end;

procedure TForm1.fcShapeBtn1Click(Sender: TObject); begin ShowAboutBox; end;

procedure TForm1.SpeedButton3Click(Sender: TObject); begin jiaopai(0,3); end;

procedure tform1.jiaopai(ower,cardcolor:integer); var tempi,tempstage,tempjiaopainum,tempwujiang:integer; hintstring,temphintstring:string[50]; begin tempjiaopainum:=0; tempwujiang:=0; if (ower=0) or (ower=2) then tempstage:=stage1 else tempstage:=stage2; case cardcolor of 2:{方块} for j:=1 to currentcardnum do if (cardarray[(j-1)*4+ower+1].value=54) or ((((cardarray[(j-1)*4+ower+1].value-tempstage) div 13)=2) and (((cardarray[(j-1)*4+ower+1].value-tempSTAGE) mod 13)=0)) then begin cardarray[(j-1)*4+ower+1].top:=100+(fcimager1.height-96) div 2; cardarray[(j-1)*4+ower+1].left:=(fcimager1.width-75) div 2+tempjiaopainum*15; tempjiaopainum:=tempjiaopainum+1; temphintstring:='方块为主牌'; end; 1:{草花} for j:=1 to currentcardnum do if (cardarray[(j-1)*4+ower+1].value=53) or ((((cardarray[(j-1)*4+ower+1].value-tempstage) div 13)=1) and (((cardarray[(j-1)*4+ower+1].value-tempSTAGE) mod 13)=0)) then begin cardarray[(j-1)*4+ower+1].top:=100+(fcimager1.height-96) div 2; cardarray[(j-1)*4+ower+1].left:=(fcimager1.width-75) div 2+tempjiaopainum*15; tempjiaopainum:=tempjiaopainum+1; temphintstring:='草花为主牌'; end; 0:{红心} for j:=1 to currentcardnum do if (cardarray[(j-1)*4+ower+1].value=54) or ((((cardarray[(j-1)*4+ower+1].value-tempstage) div 13)=0) and (((cardarray[(j-1)*4+ower+1].value-tempSTAGE) mod 13)=0)) then begin cardarray[(j-1)*4+ower+1].top:=100+(fcimager1.height-96) div 2; cardarray[(j-1)*4+ower+1].left:=(fcimager1.width-75) div 2+tempjiaopainum*15; tempjiaopainum:=tempjiaopainum+1; temphintstring:='红心为主牌'; end; 3:{黑桃} for j:=1 to currentcardnum do if (cardarray[(j-1)*4+ower+1].value=53) or ((((cardarray[(j-1)*4+ower+1].value-tempstage) div 13)=3) and (((cardarray[(j-1)*4+ower+1].value-tempSTAGE) mod 13)=0)) then begin cardarray[(j-1)*4+ower+1].top:=100+(fcimager1.height-96) div 2; cardarray[(j-1)*4+ower+1].left:=(fcimager1.width-75) div 2+tempjiaopainum*15; tempjiaopainum:=tempjiaopainum+1; temphintstring:='黑桃为主牌'; end; 4:{无将} for j:=1 to currentcardnum do begin if (cardarray[(j-1)*4+ower+1].value=54) or (cardarray[(j-1)*4+ower+1].value=53) then tempwujiang:=(j-1)*4+ower+1; if (cardarray[(j-1)*4+ower+1].value=cardarray[tempwujiang].value) and (((j-1)*4+ower+1)<>tempwujiang) then begin cardarray[(j-1)*4+ower+1].top:=100+(fcimager1.height-96) div 2; cardarray[(j-1)*4+ower+1].left:=(fcimager1.width-75) div 2+tempjiaopainum*15; tempjiaopainum:=tempjiaopainum+1; cardarray[tempwujiang].top:=100+(fcimager1.height-96) div 2; cardarray[tempwujiang].left:=(fcimager1.width-75) div 2+tempjiaopainum*15; tempjiaopainum:=tempjiaopainum+1; temphintstring:='无将'; end; end; end; currentstage:=tempstage; fcshapebtn1.caption:=inttostr(tempstage); case ower of 0:begin playower:=0; fcshapebtn1.orientation:=sodown; hintstring:='南家当庄,'+temphintstring; end; 1:begin playower:=1; fcshapebtn1.orientation:=soright; hintstring:='东家当庄,'+temphintstring; end; 2:begin playower:=2; fcshapebtn1.orientation:=soup; hintstring:='北家当庄,'+temphintstring; end; 3:begin playower:=3; fcshapebtn1.orientation:=soleft; hintstring:='西家当庄,'+temphintstring; end; end; zhupaicolor:=cardcolor; fcshapebtn1.hint:=hintstring; pause(1); if currentcardnum=25 then begin qidipai(playower); for tempi:=0 to 3 do if tempi=playower then sortcard(tempi,1) else sortcard(tempi,0); diandipai(playower); end; end;


/bbs/UploadFile/2005-3/2005320191459674.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./bbs/UploadFile/2005-3/2005320191459674.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-09 20:10
yangguofa
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2004-5-5
收藏
得分:0 

procedure TForm1.SpeedButton4Click(Sender: TObject); begin jiaopai(0,0); end;

procedure TForm1.SpeedButton5Click(Sender: TObject); begin jiaopai(0,1); end;

procedure TForm1.SpeedButton6Click(Sender: TObject); begin jiaopai(0,2); end;

procedure TForm1.SpeedButton7Click(Sender: TObject); begin jiaopai(0,4); end;

procedure TForm1.I1Click(Sender: TObject); begin Application.HelpFile := 'zgss.HLP'; Application.HelpCommand(HELP_CONTENTS,0); end;

procedure TForm1.qidipai(ower:integer); var player0startx,player1starty,player2startx,player3starty,player4startx:integer; begin speedbutton3.enabled:=FALSE; speedbutton4.enabled:=FALSE; speedbutton5.enabled:=FALSE; speedbutton6.enabled:=FALSE; speedbutton7.enabled:=FALSE; player0startx:=(fcimager1.width-71-15*(25-1)) div 2; player1starty:=(fcimager1.height-96+15*(25-1)) div 2; player2startx:=(fcimager1.width-71+15*(25-1)) div 2; player3starty:=(fcimager1.height-96-15*(25-1)) div 2; case ower of 0: begin for i:=1 to 25 do begin cardarray[(i-1)*4+ower+1].left:=player0startx+(i-1)*11 ; cardarray[(i-1)*4+ower+1].top:= fcimager1.height-96-10; end; for i:=101 to 108 do begin cardarray[i].onclick:=cardsclick; cardarray[i].faceup:=true; cardarray[i].left:=player0startx+(i-76)*11 ; cardarray[i].top:= fcimager1.height-96-10; end; end; 1: begin for i:=1 to 25 do begin cardarray[(i-1)*4+ower+1].left:=fcimager1.width-71-10 ; cardarray[(i-1)*4+ower+1].top:=player1starty-(i-1)*11; end; for i:=101 to 108 do begin cardarray[i].faceup:=false; cardarray[i].left:=fcimager1.width-71-10 ; cardarray[i].top:= player1starty-(i-76)*11;; end; end; 2: begin for i:=1 to 25 do begin cardarray[(i-1)*4+ower+1].left:=player2startx-(i-1)*11 ; cardarray[(i-1)*4+ower+1].top:=fcimager1.top+10; end; for i:=101 to 108 do begin cardarray[i].faceup:=false; cardarray[i].left:=player2startx-(i-76)*11 ; cardarray[i].top:=fcimager1.top+10; end; end; 3: begin for i:=1 to 25 do begin cardarray[(i-1)*4+ower+1].left:=fcimager1.left+10 ; cardarray[(i-1)*4+ower+1].top:=player3starty+(i-1)*11; end; for i:=101 to 108 do begin cardarray[i].faceup:=false; cardarray[i].left:=fcimager1.left+10 ; cardarray[i].top:=player3starty+(i-76)*11; end; end; end; end;

procedure tform1.sortcard(ower,dipai:integer); var tempcardarray,tempcardarray2:array [1..33] of integer; sortok:array [1..33] of boolean; tempstage:integer; begin for i:=1 to 33 do sortok[i]:=false; for i:=1 to 25 do {转换2为小,1为大} if cardarray[(i-1)*4+ower+1].value>52 then tempcardarray[i]:=cardarray[(i-1)*4+ower+1].value else if (cardarray[(i-1)*4+ower+1].value-1) mod 13=0 then tempcardarray[i]:=cardarray[(i-1)*4+ower+1].value+12 else tempcardarray[i]:=cardarray[(i-1)*4+ower+1].value-1; if dipai=1 then {带底牌排序} begin for i:=26 to 33 do if cardarray[i+75].value>52 then tempcardarray[i]:=cardarray[i+75].value else if (cardarray[i+75].value-1) mod 13=0 then tempcardarray[i]:=cardarray[i+75].value+12 else tempcardarray[i]:=cardarray[i+75].value-1; for j:=1 to 32 do for i:=33 downto j do if tempcardarray[i]>tempcardarray[j] then begin k:=tempcardarray[i]; tempcardarray[i]:=tempcardarray[j]; tempcardarray[j]:=k; end; j:=1; k:=1;{扫描次数} repeat case k of 1:{王优先} for i:=1 to 33 do if (tempcardarray[i]>52) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 2:{本级常主} for i:=1 to 33 do if (((tempcardarray[i]+1-currentstage) mod 13)=0) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 3:{主牌花色} for i:=1 to 33 do if (((tempcardarray[i]-1) div 13)=zhupaicolor) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 5:{主牌隔二花色} for i:=1 to 33 do if (((tempcardarray[i]-1) div 13)=((zhupaicolor+2) mod 4)) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 4:{主牌隔一花色} for i:=1 to 33 do if (((tempcardarray[i]-1) div 13)=((zhupaicolor+1) mod 4)) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 6:{主牌隔三花色} for i:=1 to 33 do if (((tempcardarray[i]-1) div 13)=((zhupaicolor+3) mod 4)) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; end; k:=k+1; until j>33; for i:=101 to 108 do if tempcardarray2[i-75]>52 then cardarray[i].value:=tempcardarray2[i-75] else if tempcardarray2[i-75] mod 13=0 then cardarray[i].value:=tempcardarray2[i-75]-12 else cardarray[i].value:=tempcardarray2[i-75]+1; end else {无底牌排序} begin for j:=1 to 24 do for i:=25 downto j do if tempcardarray[i]>tempcardarray[j] then begin k:=tempcardarray[i]; tempcardarray[i]:=tempcardarray[j]; tempcardarray[j]:=k; end; j:=1; k:=1;{扫描次数} repeat case k of 1:{王优先} for i:=1 to 25 do if (tempcardarray[i]>52) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 2:{本级常主} for i:=1 to 25 do if (((tempcardarray[i]+1-currentstage) mod 13)=0) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 3:{主牌花色} for i:=1 to 25 do if (((tempcardarray[i]-1) div 13)=zhupaicolor) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 5:{主牌隔二花色} for i:=1 to 25 do if (((tempcardarray[i]-1) div 13)=((zhupaicolor+2) mod 4)) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 4:{主牌隔一花色} for i:=1 to 25 do if (((tempcardarray[i]-1) div 13)=((zhupaicolor+1) mod 4)) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; 6:{主牌隔三花色} for i:=1 to 25 do if (((tempcardarray[i]-1) div 13)=((zhupaicolor+3) mod 4)) and (sortok[i]=false) then begin tempcardarray2[j]:=tempcardarray[i]; j:=j+1; sortok[i]:=true; end; end; k:=k+1; until j>25; end; for i:=1 to 25 do if tempcardarray2[i]>52 then cardarray[(i-1)*4+ower+1].value:=tempcardarray2[i] else if tempcardarray2[i] mod 13=0 then cardarray[(i-1)*4+ower+1].value:=tempcardarray2[i]-12 else cardarray[(i-1)*4+ower+1].value:=tempcardarray2[i]+1; end;


/bbs/UploadFile/2005-3/2005320191459674.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./bbs/UploadFile/2005-3/2005320191459674.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-09 20:10
yangguofa
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2004-5-5
收藏
得分:0 

procedure tform1.liangdipai(); var tempx,tempy,tempstage:integer; hintstring,temphintstring:string[50]; begin i:=101; repeat tempx:=cardarray[i].top; tempy:=cardarray[i].left; cardarray[i].left:=((fcimager1.width-71-2*8) div 2)+75+(i-100)*15; cardarray[i].top:=(fcimager1.height-96) div 2; cardarray[i].faceup:=true; pause(2); j:=1; repeat j:=j+1; until (cardarray[j].value=cardarray[i].value) or (j>100); if j>100 then begin {cardarray[i].left:=tempx; cardarray[i].top:=tempy; cardarray[i].faceup:=false;} i:=i+1; end; until (cardarray[j].value=cardarray[i].value) or (i>108); if cardarray[j].value=cardarray[i].value then begin if cardarray[j].faceup=false then cardarray[j].faceup:=true; {cardarray[j].left:=((fcimager1.width-71-2*8) div 2)+110+(i+1-100)*15; cardarray[j].top:=(fcimager1.height-96) div 2;} if (cardarray[j].value=53) or (cardarray[j].value=54) then zhupaicolor:=4 else zhupaicolor:=cardarray[j].value div 13; case zhupaicolor of 2:{方块} temphintstring:='方块为主牌'; 1:{草花} temphintstring:='草花为主牌'; 0:{红心} temphintstring:='红心为主牌'; 3:{黑桃} temphintstring:='黑桃为主牌'; 4:{无将} temphintstring:='无将'; end; playower:=(j-1) mod 4; case playower of 0:begin cardarray[j].top:=cardarray[j].top-48; fcshapebtn1.orientation:=sodown; hintstring:='南家当庄,'+temphintstring; end; 1:begin cardarray[j].left:=cardarray[j].left-35; fcshapebtn1.orientation:=soright; hintstring:='东家当庄,'+temphintstring; end; 2:begin cardarray[j].top:=cardarray[j].top+48; fcshapebtn1.orientation:=soup; hintstring:='北家当庄,'+temphintstring; end; 3:begin cardarray[j].left:=cardarray[j].left+35; fcshapebtn1.orientation:=soleft; hintstring:='西家当庄,'+temphintstring; end; end; if (playower=0) or (playower=2) then tempstage:=stage1 else tempstage:=stage2; currentstage:=tempstage; fcshapebtn1.caption:=inttostr(tempstage); fcshapebtn1.hint:=hintstring; end; pause(2); if playower=0 then cardarray[j].faceup:=true else cardarray[j].faceup:=false; end;

procedure TForm1.X1Click(Sender: TObject); begin close; end;

{垫底牌} procedure tform1.diandipai(ower:integer); var selectok:array [1..33] of boolean; dipaicolor,tempi,tjnum:integer; colorok:array [0..3] of boolean; player0startx,player1starty,player2startx,player3starty,middlex,middley:integer; tempcardarray:array [1..33] of integer; begin for i:=0 to 3 do colorok[i]:=false; for i:=1 to 33 do selectok[i]:=false; for i:=1 to 25 do {转换2为小,1为大} if cardarray[(i-1)*4+ower+1].value>52 then tempcardarray[i]:=cardarray[(i-1)*4+ower+1].value else if (cardarray[(i-1)*4+ower+1].value-1) mod 13=0 then tempcardarray[i]:=cardarray[(i-1)*4+ower+1].value+12 else tempcardarray[i]:=cardarray[(i-1)*4+ower+1].value-1; for i:=26 to 33 do if cardarray[i+75].value>52 then tempcardarray[i]:=cardarray[i+75].value else if (cardarray[i+75].value-1) mod 13=0 then tempcardarray[i]:=cardarray[i+75].value+12 else tempcardarray[i]:=cardarray[i+75].value-1; j:=0; k:=0; i:=33; colorok[zhupaicolor]:=true; repeat dipaicolor:=(k+1) mod 4; for tempi:=1 to 33 do IF (((tempcardarray[tempi]+1-currentstage) mod 13=0) {有常主的非主牌花色尽量垫完} and (colorok[tempcardarray[tempi] div 13]=false)) THEN dipaicolor:=tempcardarray[tempi] div 13; if (colorok[dipaicolor]=false) then begin if ((tempcardarray[i]<53) and (tempcardarray[i] mod 13<>0) {非A} and ((tempcardarray[i]+1) mod 13<>0) {非K} and (tempcardarray[i] div 13=dipaicolor) and ((tempcardarray[i]+1-currentstage) mod 13<>0) and (selectok[i]=false) and (tempcardarray[i]<>tempcardarray[i+1]) and (tempcardarray[i]<>tempcardarray[i-1])) then begin j:=j+1; selectok[i]:=true; end; if ((tempcardarray[i]+1) mod 13=0) { 无A则垫K} and (tempcardarray[i]<>tempcardarray[i+1]) {非对} and (tempcardarray[i]<>tempcardarray[i-1]) and ((tempcardarray[i]+1-currentstage) mod 13<>0) and (tempcardarray[i] div 13=dipaicolor) and (tempcardarray[i-1] mod 13<>0) then begin j:=j+1; selectok[i]:=true; end; i:=i-1; if i=1 then begin i:=33; colorok[dipaicolor]:=true; end; end; until (j=8); for i:=1 to 25 do if selectok[i]=true then case ower of 0:cardarray[(i-1)*4+ower+1].top:=cardarray[(i-1)*4+ower+1].top-20; 1:cardarray[(i-1)*4+ower+1].left:=cardarray[(i-1)*4+ower+1].left-20; 2:cardarray[(i-1)*4+ower+1].top:=cardarray[(i-1)*4+ower+1].top+20; 3:cardarray[(i-1)*4+ower+1].left:=cardarray[(i-1)*4+ower+1].left+20; end; for i:=101 to 108 do if selectok[i-75]=true then begin case ower of 0:cardarray[i].top:=cardarray[i].top-20; 1:cardarray[i].left:=cardarray[i].left-20; 2:cardarray[i].top:=cardarray[i].top+20; 3:cardarray[i].left:=cardarray[i].left+20; end; cardarray[i].OnClick:=nil; end; pause(10); j:=1; k:=101; for i:=1 to 33 do if selectok[i]=false then {庄家牌赋值} begin if tempcardarray[i]>52 then cardarray[(j-1)*4+ower+1].value:=tempcardarray[i] else if tempcardarray[i] mod 13=0 then cardarray[(j-1)*4+ower+1].value:=tempcardarray[i]-12 else cardarray[(j-1)*4+ower+1].value:=tempcardarray[i]+1; j:=j+1; end else {底牌赋值} begin if tempcardarray[i]>52 then cardarray[k].value:=tempcardarray[i] else if tempcardarray[i] mod 13=0 then cardarray[k].value:=tempcardarray[i]-12 else cardarray[k].value:=tempcardarray[i]+1; k:=k+1; end; player0startx:=(fcimager1.width-71-15*(25-1)) div 2; player1starty:=(fcimager1.height-96+15*(25-1)) div 2; player2startx:=(fcimager1.width-71+15*(25-1)) div 2; player3starty:=(fcimager1.height-96-15*(25-1)) div 2; middlex:=(fcimager1.width-71-2*8) div 2; middley:=(fcimager1.height-96) div 2; case ower of 0: for i:=1 to 25 do begin cardarray[(i-1)*4+ower+1].left:=player0startx+(i-1)*15 ; cardarray[(i-1)*4+ower+1].top:= fcimager1.height-96-10; end; 1: for i:=1 to 25 do begin cardarray[(i-1)*4+ower+1].left:=fcimager1.width-71-10 ; cardarray[(i-1)*4+ower+1].top:=player1starty-(i-1)*15; end; 2: for i:=1 to 25 do begin cardarray[(i-1)*4+ower+1].left:=player2startx-(i-1)*15 ; cardarray[(i-1)*4+ower+1].top:=fcimager1.top+10; end; 3: for i:=1 to 25 do begin cardarray[(i-1)*4+ower+1].left:=fcimager1.left+10 ; cardarray[(i-1)*4+ower+1].top:=player3starty+(i-1)*15; end; end; for i:=101 to 108 do begin cardarray[i].faceup:=false; cardarray[i].left:=middlex+(i-100)*2 ; cardarray[i].top:=middley; end; end; {提示是否叫牌}


/bbs/UploadFile/2005-3/2005320191459674.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./bbs/UploadFile/2005-3/2005320191459674.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-09 20:11
yangguofa
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2004-5-5
收藏
得分:0 

procedure TForm1.TISHI_LIANGPAI(); var tempi:integer; begin if zhupaicolor=-1 then begin if APPLICATION.MessageBox('是否叫牌?','提示信息',MB_yesno + MB_ICONQUESTION)=IDNO then begin liangdipai(); end; end; if zhupaicolor<>-1 then begin qidipai(playower); for tempi:=0 to 3 do if tempi=playower then sortcard(tempi,1) else sortcard(tempi,0); diandipai(playower); end;

end; {出牌} procedure tform1.chupai(ower:integer); var selectok:array [1..25] of boolean; begin if k=ower then {先手出牌} for i:=1 to currentcardnum do begin j:=0; {花色}

end else {跟随出牌} begin i:=1; j:=0; repeat if countcolornum(ower,chupai_color)<>0 then {有该花色} if (cardarray[(i-1)*4+ower+1].value div 13=chupai_color) then if (cardarray[(i-1)*4+ower+1].value>chupai_value) then begin selectok[i]:=true; j:=j+1; end else if (cardarray[i*4+ower+1].value div 13<>chupai_color) then {下一张非此花色,则此张为最小} begin selectok[i]:=true; j:=j+1; end; if countcolornum(ower,chupai_color)=0 then {无该花色} if (cardarray[i*4+ower+1].value div 13=zhupaicolor) then if cardarray[i*4+ower+1].fenshu<>0 then begin selectok[i]:=true; j:=j+1; end else if (cardarray[i*4+ower+1].value div 13<>zhupaicolor) then {下一张非此花色,则此张为最小} begin selectok[i]:=true; j:=j+1; end; i:=(i+1) mod currentcardnum; if i=0 then i:=1; until j=chupai_num; for i:=1 to currentcardnum do if selectok[i]=true then begin cardarray[i*4+ower+1].left:=200; cardarray[i*4+ower+1].top:=200; end; pause(2); for i:=1 to currentcardnum do if selectok[i]=true then cardarray[i*4+ower+1].free; end; end;

function tform1.countcolornum(ower,color:integer):integer; var tempstage:integer; begin result:=0; if (ower mod 2=0) then tempstage:=stage1 else tempstage:=stage2; for i:=1 to currentcardnum do begin if (color=zhupaicolor) {主牌加王和常主} and (((cardarray[(i-1)*4+ower+1].value - tempstage) mod 13=0) or (cardarray[(i-1)*4+ower+1].value>52)) then result:=result+1; if (cardarray[(i-1)*4+ower+1].value div 13=color) and ((cardarray[(i-1)*4+ower+1].value - tempstage) mod 13<>0) and (cardarray[(i-1)*4+ower+1].value<53) then result:=result+1; end; end;


/bbs/UploadFile/2005-3/2005320191459674.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./bbs/UploadFile/2005-3/2005320191459674.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-09 20:11
ant3000
Rank: 1
等 级:新手上路
帖 子:188
专家分:0
注 册:2004-6-7
收藏
得分:0 

看什么呢?有什么问题?

2004-06-10 10:24
yangguofa
Rank: 1
等 级:新手上路
帖 子:197
专家分:0
注 册:2004-5-5
收藏
得分:0 
有问题呀。编译不了。

/bbs/UploadFile/2005-3/2005320191459674.gif" border="0" onload="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('http://www./bbs/UploadFile/2005-3/2005320191459674.gif');}" onmousewheel="return imgzoom(this);" alt="" />
2004-06-11 19:20
chengstone
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
帖 子:562
专家分:226
注 册:2004-4-3
收藏
得分:0 

…………………………

你用什么编译的?

这个代码哪里搞到的呀


qq:69558139
2004-07-04 13:44
白峰
Rank: 1
等 级:新手上路
帖 子:29
专家分:0
注 册:2004-9-13
收藏
得分:0 

笨蛋,明显就是DELPHI呀!

就是CODE太长了!


白天永远都是我们寂静的时刻,只有到晚上,我们才会睁这惺忪的双眼来窥视着网络!让所有收费的东西都害怕我们吧!免费万岁,自由万岁!
2004-10-01 22:39
zhuangzhilang
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-4-27
收藏
得分:0 
这个组件在哪里搞到啊,请发给我好吗?
2005-04-27 10:49
快速回复:哪个高手帮忙看一下这个游戏的原代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.039648 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved