
电脑上的游戏“纸牌”,游戏目标就是把四种花色的牌按A-1-2-3-4-首链5-6-7-8-9-10-J-Q-K的顺序放入四个框里,全都按花色排完之后游戏就过关了。
1、首先点电脑左下角的菜单按钮。
2、打开游戏界面选择“纸牌”游戏。
3、开局游戏之者卖孙后,玩家需要把游戏下方的7推牌全部按A到K的顺序放到上面的4个框中,右上角的4个框是所有纸牌的归属地,可以知通过鼠标拖动的方法把牌放进去,道开始第一张牌必须是A,然后按顺序排下去,没按顺序的牌是放不上去的,最后是K。
4、为了达到上面的目标,可以通过移动下方的7推牌组达到目的,移动牌时遵循牌的叠加规则-黑花色与内红花色牌相互叠加,如下图可以把黑色的6放到红色7上配卖面,以翻出6下面的牌。
5、点击左上方的牌推可以进行发牌,系统默认是一次翻容3张牌,但是也可以一次翻一张牌。
扩展资料:
电脑自带的纸牌游戏打开方法:
步骤如下:
1,打开电脑。点击桌面左下角的”开始抄“按钮。
2.在控制面板界面,单击“所以程序”按钮。
3.打开后,选择并打开游戏文件夹袭。
4.从列表中找到游戏文件夹。
5.点击该文件夹,即可找到该电脑自带的zd所有单机小游戏。
6.就找到纸牌。
#include <time.h>#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#define PLAYER 4//玩家人数
#define NUM 13//玩家拿牌数
#define SIZE 52//所有牌数
//声明函数
void PokerRand(int *pokerRand)
void Palyer(int *pokerRand)
void Process(int *countA, int *countB, int *countC, int *countD)
void Output(int *poker, int *countA, int *countB, int *countC, int *countD)
struct PokerGame
{
int A[NUM]//记录玩家手中的黑桃牌
int B[NUM]//记录玩家手中的红桃牌
int C[NUM]//记扰森录玩家手中的梅花牌
int D[NUM]//者瞎记录玩家手中的方片牌
int manNum[NUM]//记录玩家手里所有的牌首李空
}man[PLAYER]
//随机产生52张牌
void PokerRand(int *pokerRand)
{
int i, j
srand((unsigned)time(NULL))
for (i=0i<SIZEi++)
{
MARK:pokerRand[i] = rand()%52
for (j=0j<ij++)
{
if (pokerRand[i] == pokerRand[j])
{
goto MARK
}
}
}
}
//给4个玩家发牌
void Palyer(int *pokerRand)
{
int i, j
int count = 0
for (j=0j<NUMj++)
{
for (i=0i<PLAYERi++)//轮流发牌
{
man[i].manNum[j] = pokerRand[count++]
}
}
}
//统计玩家手中的牌
void Process(int *countA, int *countB, int *countC, int *countD)
{
int i, j
for (i=0i<PLAYERi++)
{
countA[i] = 0
countB[i] = 0
countC[i] = 0
countD[i] = 0
for (j=0j<NUMj++)//统计四个玩家手中的牌
{
if ((man[i].manNum[j] >= 0) &&(man[i].manNum[j] <13))//黑桃
{
man[i].A[ countA[i]++ ] = man[i].manNum[j]
}
else if (man[i].manNum[j] <26)//红桃
{
man[i].B[ countB[i]++ ] = man[i].manNum[j]
}
else if (man[i].manNum[j] <39)//梅花
{
man[i].C[ countC[i]++ ] = man[i].manNum[j]
}
else//方片
{
man[i].D[ countD[i]++ ] = man[i].manNum[j]
}
}
}
}
//输出
void Output(int *poker, int *countA, int *countB, int *countC, int *countD)
{
int i, j
printf("扑克牌自动发牌 %c(黑) %c(红) %c(梅) %c(方):\n", 6, 3, 5, 4)
for (i=0i<PLAYERi++)
{
printf("\n第%d人 :\n", i+1)//开始输出第i个玩家
printf("%c:\t", 6)//输出第i个玩家的黑桃牌
for (j=0j<countA[i]j++)
{
if (poker[ man[i].A[j] ] == 10)//假如等于10,以%d格式输出
{
printf("%4d", poker[ man[i].A[j] ])
}
else//否则以%c格式输出
{
printf("%4c", poker[ man[i].A[j] ])
}
}
printf("\n")
printf("%c:\t", 3)//输出第i个玩家的红桃牌
for (j=0j<countB[i]j++)
{
if (poker[ man[i].B[j] ] == 10)
{
printf("%4d", poker[ man[i].B[j] ])
}
else
{
printf("%4c", poker[ man[i].B[j] ])
}
}
printf("\n")
printf("%c:\t", 5)//输出第i个玩家的梅花牌
for (j=0j<countC[i]j++)
{
if (poker[ man[i].C[j] ] == 10)
{
printf("%4d", poker[ man[i].C[j] ])
}
else
{
printf("%4c", poker[ man[i].C[j] ])
}
}
printf("\n")
printf("%c:\t", 4)//输出第i个玩家的方片牌
for (j=0j<countD[i]j++)
{
if (poker[ man[i].D[j] ] == 10)
{
printf("%4d", poker[ man[i].D[j] ])
}
else
{
printf("%4c", poker[ man[i].D[j] ])
}
}
printf("\n")
}
}
void main(void)
{
int countA[PLAYER] = { 0 }//记录4个玩家持黑桃牌数
int countB[PLAYER] = { 0 }//记录4个玩家持红桃牌数
int countC[PLAYER] = { 0 }//记录4个玩家持梅花牌数
int countD[PLAYER] = { 0 }//记录4个玩家持方片牌数
int pokerRand[SIZE] = { 0 }//存放随机产生52张牌
int poker[SIZE] = {65, 50, 51, 52, 53, 54, 55, 56, 57, 10, 74, 81, 75,
65, 50, 51, 52, 53, 54, 55, 56, 57, 10, 74, 81, 75,
65, 50, 51, 52, 53, 54, 55, 56, 57, 10, 74, 81, 75,
65, 50, 51, 52, 53, 54, 55, 56, 57, 10, 74, 81, 75,}
PokerRand(pokerRand)//洗牌
Palyer(pokerRand)//发牌
Process(countA, countB, countC, countD)//整牌
Output(poker, countA, countB, countC, countD)//亮牌
printf("\n\n\n")
system("pause")
}
发牌原程序见我的空间(http://hi.baidu.com/crazycola/blog/item/52402bd4b3f68705a08bb746.html),可选是否包含大小王,可选发牌列数。以下为改过的版本,不包含大小王(即总数52张),丛誉只能发4堆。
另外附加了用户菜单,原程猜洞序中不含菜单部分。
代码如下:
---------------------------------------
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
int menu()
{
int choice
printf("渗兆段1 发牌/0 退出:")
scanf("%d",&choice)
return choice
}
void main( void )
{
int i1, j, total
int *iArr
int tag = 0
char* pok_C[] = { "黑桃", "红桃", "梅花", "方块" }
char* pok_N[] = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" }
if(!menu()) exit(0)
total = 52
srand( (unsigned)time( NULL ) )
iArr = (int*)malloc(total*sizeof(int))
for( i1=0i1<totali1++ )
{
iArr[i1]=rand()%total
if( i1==0 ) continue
do {
tag = 0
for( j=0j<i1j++ )
if( iArr[j] == iArr[i1] )
{
iArr[i1]=rand()%total
tag = 1
}
} while( tag==1 )
}
for( i1=0i1<totali1++ )
{
printf("%s%s\t",pok_C[iArr[i1]%4],pok_N[iArr[i1]%13])
if(i1%4==3) printf("\n")
}
free(iArr)
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)