Dim Cards(1 To 52) As StringDim seq(1 To 52) As IntegerDim W(1 To 13) As IntegerDim N(1 To 13) As IntegerDim E(1 To 13) As IntegerDim S(1 To 13) As IntegerDim t As Integer
Private Sub Command1_Click()For i = 1 To 13For j = i + 1 To 13 If N(i) > N(j) Then t = N(i) N(i) = N(j) N(j) = t End If Next j Next i
Form3Image1Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(1)) & "GIF")Form3Image2Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(2)) & "GIF")Form3Image3Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(3)) & "GIF")Form3Image4Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(4)) & "GIF")Form3Image5Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(5)) & "GIF")Form3Image6Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(6)) & "GIF")Form3Image7Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(7)) & "GIF")Form3Image8Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(8)) & "GIF")Form3Image9Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(9)) & "GIF")Form3Image10Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(10)) & "GIF")Form3Image11Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(11)) & "GIF")Form3Image12Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(12)) & "GIF")Form3Image13Picture = LoadPicture(AppPath & "\GIF\" & Cards(N(13)) & "GIF")Form3ShowEnd Sub
Private Sub Command2_Click()For i = 1 To 13For j = i + 1 To 13 If S(i) > S(j) Then t = S(i) S(i) = S(j) S(j) = t End If Next j Next i
Form5Image1Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(1)) & "GIF")Form5Image2Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(2)) & "GIF")Form5Image3Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(3)) & "GIF")Form5Image4Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(4)) & "GIF")Form5Image5Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(5)) & "GIF")Form5Image6Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(6)) & "GIF")Form5Image7Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(7)) & "GIF")Form5Image8Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(8)) & "GIF")Form5Image9Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(9)) & "GIF")Form5Image10Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(10)) & "GIF")Form5Image11Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(11)) & "GIF")Form5Image12Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(12)) & "GIF")Form5Image13Picture = LoadPicture(AppPath & "\GIF\" & Cards(S(13)) & "GIF")Form5ShowEnd Sub
Private Sub Command3_Click()For i = 1 To 13For j = i + 1 To 13 If W(i) > W(j) Then t = W(i) W(i) = W(j) W(j) = t End If Next j Next i
Form2Image1Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(1)) & "GIF")Form2Image2Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(2)) & "GIF")Form2Image3Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(3)) & "GIF")Form2Image4Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(4)) & "GIF")Form2Image5Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(5)) & "GIF")Form2Image6Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(6)) & "GIF")Form2Image7Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(7)) & "GIF")Form2Image8Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(8)) & "GIF")Form2Image9Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(9)) & "GIF")Form2Image10Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(10)) & "GIF")Form2Image11Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(11)) & "GIF")Form2Image12Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(12)) & "GIF")Form2Image13Picture = LoadPicture(AppPath & "\GIF\" & Cards(W(13)) & "GIF")Form2ShowEnd Sub
Private Sub Command4_Click()For i = 1 To 13For j = i + 1 To 13 If E(i) > E(j) Then t = E(i) E(i) = E(j) E(j) = t End If Next j Next i
Form4Image1Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(1)) & "GIF")Form4Image2Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(2)) & "GIF")Form4Image3Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(3)) & "GIF")Form4Image4Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(4)) & "GIF")Form4Image5Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(5)) & "GIF")Form4Image6Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(6)) & "GIF")Form4Image7Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(7)) & "GIF")Form4Image8Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(8)) & "GIF")Form4Image9Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(9)) & "GIF")Form4Image10Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(10)) & "GIF")Form4Image11Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(11)) & "GIF")Form4Image12Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(12)) & "GIF")Form4Image13Picture = LoadPicture(AppPath & "\GIF\" & Cards(E(13)) & "GIF")Form4ShowEnd Sub
Private Sub Command5_Click()Dim ABC(1 To 52) As IntegerABC(1) = Int(52 Rnd() + 1)seq(1) = ABC(1)For i = 2 To 52ll: ABC(i) = Int(52 Rnd() + 1) For j = 1 To i - 1 If ABC(i) = ABC(j) Then GoTo ll Next seq(i) = ABC(i)NextFor i = 1 To 13W(i) = seq(i)N(i) = seq(i + 13)E(i) = seq(i + 26)S(i) = seq(i + 39)Next iMsgBox "发牌完成。", vbOKOnly, "好了"Command1Enabled = TrueCommand2Enabled = TrueCommand3Enabled = TrueCommand4Enabled = TrueEnd Sub
Private Sub Command6_Click()EndEnd Sub
Private Sub Form_Load()Cards(1) = "S1"Cards(2) = "S2"Cards(3) = "S3"Cards(4) = "S4"Cards(5) = "S5"Cards(6) = "S6"Cards(7) = "S7"Cards(8) = "S8"Cards(9) = "S9"Cards(10) = "S10"Cards(11) = "S11"Cards(12) = "S12"Cards(13) = "S13"Cards(14) = "H1"Cards(15) = "H2"Cards(16) = "H3"Cards(17) = "H4"Cards(18) = "H5"Cards(19) = "H6"Cards(20) = "H7"Cards(21) = "H8"Cards(22) = "H9"Cards(23) = "H10"Cards(24) = "H11"Cards(25) = "H12"Cards(26) = "H13"Cards(27) = "D1"Cards(28) = "D2"Cards(29) = "D3"Cards(30) = "D4"Cards(31) = "D5"Cards(32) = "D6"Cards(33) = "D7"Cards(34) = "D8"Cards(35) = "D9"Cards(36) = "D10"Cards(37) = "D11"Cards(38) = "D12"Cards(39) = "D13"Cards(40) = "C1"Cards(41) = "C2"Cards(42) = "C3"Cards(43) = "C4"Cards(44) = "C5"Cards(45) = "C6"Cards(46) = "C7"Cards(47) = "C8"Cards(48) = "C9"Cards(49) = "C10"Cards(50) = "C11"Cards(51) = "C12"Cards(52) = "C13"End Sub
洗牌要牌,就是当众洗牌时,通过运用洗牌术把自己需要的牌安排在适当位置发牌时,自己需要的牌全集中在自己份牌中。
一般来说,当众洗牌,叠牌,就是以示公正的做法,如果洗牌干脆利落,再加上叠牌,对手大都相信你而不会“炒牌”的。
四人搏击时,如何洗牌要牌的呢
各家开牌后,台面上的牌比较集中都是分三路摆好的。各家的后路牌通常是蛇(顺)虎路及同花比较多,你想一下轮得四条或同花顺,你要注意在开牌前先看自己的牌,是否具备或已具备哪些较好的条件,比如要得四条,而自己此轮已有虎路,再在别家开出的牌上执一张跟自己兰张牌一样的合起来就是四条牌技揭秘,如果自己有四张按顺序排列的同花,再在别家执一张合适的牌合拼便是同花顺,若自己具备的条件没有别家开出的牌好,那就要拿别家的牌来做基础牌此招办法简单,首先是在收牌时(最好是用双手》把你想要的牌合拼在一起收在牌叠底部,为避免别人有意或无意看见底牌,在得知结果后引起怀疑,最好在最底的一牌就是杂牌整副牌收好后放在台上(四张或五张关键牌在底),然后右手从面上拿起约五分之三的牌。剩下的牌左手拿起,再将手的牌叠进行牌登与牌叠之间的牌边碰撞,或把牌的一边落在台面,其余三边用手指压平压实,其目的是使左右手的牌叠十分整齐,这个动作不可忽略,牌叠不齐是不能做下去的。接着是正式洗牌代牌的动作姿势有多种其中较普遍的有内弯放牌和外弯放牌,你平时习惯哪种则采用哪种外弯放牌张然后右手放三张,又左手放一张,右手放三张,接着都是左手放一张,右手放三张茶叶减肥 喝对方法才能瘦身
,按照这规定放牌,直至你原执在一起的四张或五张牌放完洗完牌后可继续登牌,叠牌时只能叠乱上面部分如果从底部抽出一部分(不能小于二十张),你务必运用手法再把这部分牌受回原处,其方法有两种,一是当把底部的一登牌抽出,放在另一叠牌上面时稍为向前或向后一点,使整副牌形成两级
二是当把底部的一叠牌抽出,放在另一叠牌上面时用左手中指压住下面的牌叠,把两叠牌略为分开,如图:
如果在最底的一张杂牌不是2,6,10那么洗牌时,左右手第一次放牌的张数就不一样如是3%7,J,放牌顺序规则是左一,右一。接着同上。如是4,8,Q,则是左一,右二,接着同上。如是1,5,9,K,则是左一右三,接着同上。
#include
#include
#include
#include
#define SUIT 52
#define HALF 26
#define COLOR ((char)13)
// 扑克牌的编码是一组13进制的数据,从0编到51
// 函数tell用于解释编码的内容
int tell(char card, char description)
{
char i=0, j=0;
char suit[]={"Spades","Hearts","Clubs","Diamonds"};
char face[] = {"A","2","3","4","5","6","7","8","9",
"10","Jack","Queen","King"};
//题干比较奇怪,要求扣8张底牌,但是含大小王。正确的规则应该是不含大小王的情况下扣8张牌,每人11张牌就对了
//否则应该扣10张牌或者6张牌,否则每人发牌得到的牌数不相同(不是4的倍数)
//如需要,可自行定义JB=52,JA=53,SUIT=54,HALF=27即可。
//if (card > JB || card < 0 || !description) return 0;
//if (card == JB) { sprintf(description, "Big Joker"); return 1; }
//if (card == JA) { sprintf(description, "Little Joker"); return 1; }
i = card / COLOR; j = card % COLOR;
sprintf(description, "%s %s", suit[i], face[j]);
return 1;
}
//初始化牌,形成一个顺序牌
int init(char poker)
{
char i = 0;
if (!poker) return 0;
for (i=0; i<SUIT; i++) poker[i]=i;
srand((unsigned)time(0));
return 1;
}
//洗牌,将当前牌分成上下两组,然后交叉,有右手先和左手先两种可能,这一个是左手先交换法
int wash_left_hand(char poker)
{
char i=0, j=0, k=0;
char boker[SUIT];
if(!poker) return 0;
for(i=0; i<HALF; i++) {
j = i 2; //上半组
boker[j] = poker[i];
k = i + HALF; //下半组
boker[j+1]=poker[k];
}//next i
memcpy(poker, boker, SUIT);
return 1;
}
//洗牌,将当前牌分成上下两组,然后交叉,有右手先和左手先两种可能,这一个是右手先交换法
//注意左右手先后顺序的区别在于变量j的奇偶变化
int wash_right_hand(char poker)
{
char i=0, j=0, k=0;
char boker[SUIT];
if(!poker) return 0;
for(i=0; i<HALF; i++) {
j = i 2; //上半组
boker[j+1] = poker[i];
k = i + HALF; //下半组
boker[j]=poker[k];
}//next i
memcpy(poker, boker, SUIT);
return 1;
}
//在当前牌的基础上洗一次牌,主要用随机函数的奇偶性确定用左手洗还是右手洗
int wash_once(char poker)
{
return rand()%2wash_left_hand(poker):wash_right_hand(poker);
}
//在当前牌的基础上随机洗若干次牌,至少8次,最多18次
int wash_full(char poker)
{
int i = 0, j = 0, k = 0;
i = rand() % 10 + 8;
printf("\nTry to wash %d times\n", i);
for (j=0; j < i ; j++) k+=wash_once(poker);
return k;
}
int main(void)
{
char choice = 0, i = 0, j = 0; char poker[SUIT], card[16];
init(poker);
do {
printf("\n\tWelcome to My Poker Game!\n");
printf("\t0-Wash\n");
printf("\t1-Show A\n");
printf("\t2-Show B\n");
printf("\t3-Show C\n");
printf("\t4-Show D\n");
printf("\tany other number-quit\n");
printf("Your Choice");
scanf("%d", &choice);
if(choice 4) break;
if(choice ==0) {
wash_full(poker);
continue;
}//end if
i = (choice - 1) 11; //注意用11张牌,扣8张底牌
printf("His card is\n");
for(j = i; j<i+11; j++) {
tell(poker[j], card);
printf("%s\t", card);
}//next
printf("\n");
}while(1);
return 0;
}
以上就是关于自动发牌的vb程序全部的内容,包括:自动发牌的vb程序、洗牌怎么把好牌洗到自己手里、C语言编程——发牌洗牌模拟,求帮助等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)