十点半扑克牌玩法(扑克推牌9的玩法和规则)


[中学教育]纸牌游戏:十点半设计报告 题目:纸牌游戏:十点半 学院:化学工程学院 专业:制药工程 班级:050607班 姓名:李艳明 指导教师: 设计日期: 2007年1月10日 一(选题背景 扑克牌是一种大众化的游戏牌,日常生活中我们为了娱乐消遣经常用之来进行一些小游戏,如红心大战,斗地主,活龙等,多种多样。 十点半是这些游戏中一种比较简单的玩法。这个程序模仿了十点半的各个过程,将游戏在程序运行中表示其玩法过程。 二.设计思想 (一)游戏规则:游戏可为两人或多人,但不超过八人。本游戏中选了人与电脑及四人间的玩法为例。第一轮玩家依次取一张牌,之后玩家根据自己牌的总点数,选择继续要牌或不要牌,但一旦选择不要牌以后就不能再要牌。玩家牌的总点数一旦超过10.5,不能再要牌,J,Q,K算为半点。如果玩家牌的总点数都大于或小于10.5,点大者胜;如果有大于也有小于10.5,则点数最小者赢。 (二)任何一张纸牌都有其本身的属性:花色,数值及起其所代表的点数。为将这些特征表示出来,特定义一个结构体数组来表示一副扑克牌,由于十点半游戏中不需要大小王,故可以定义如下: Struct book{ int color; char number; float num; }Card[52]; (三)不论何种扑克游戏都有其必经的三个步骤:一是有一副牌(即牌的初始化)二是洗牌,三是发牌。

十点半扑克牌玩法

这三个步骤在程序中通过三个函数来实现: void Build_Show(int HuaSe[],float DianShu[],char ShuZi[]); void Wash_Card(void); void Get_Card(int n); 三(流程图 for 调用函数 do循环 调用函数 终止 Main()函数流程图 Build_Show()的流程图 Wash_Card()的流程图for for i=0 i=0 i #include struct book{ int color; char number; float num; } Card[52]; /*To store the color,number and the points*/void Build_Show(int HuaSe[], float DianShu[], char ShuZi[]); /*Establish a pair of cards and show it to the player*/ void Wash_Card(void); /*Wash the cards*/ void Get_Card(int n) ; /*Give the player cards and the result*/void DuoRen(); int main(void) {int flag, n; int HuaSe[4]={3,4,5,6}; /*Store the color*/ char ShuZi[13]={'A','K','Q','J','0','9','8','7','6','5','4','3','2'};/*Store the number*/ float DianShu[13]={1,0.5,0.5,0.5,10,9,8,7,6,5,4,3,2};/*Store the points*/Build_Show(HuaSe, DianShu,ShuZi); /*Establish the card and show it*/do{ Wash_Card(); /*Wash cards*/ a: puts("nPlease input the number of the player:"); scanf("%d", &n); switch(n){ case 1:puts("You play with the computer!"); break; case 2:puts(:You two play!:); break; case 3:puts("You three play!"); break; case 4:puts("You four play!"); break; case 5:puts("You five play!"); break; case 6:puts("You six play!"); break; case 7:puts("You seven play!"); break; case 8:puts("You eight play!"); break; default:puts("The number of the players is too large!"); goto a; } Get_Card(n); /*Hand out the cards and give the result*/do{ puts("nDo you want to play again?1 represents yes and 0 no:");scanf("%d", &flag); }while(flag != 1 && flag != 0); } while(flag == 1); } void Build_Show(int HuaSe[], float DianShu[], char ShuZi[]) { int i, j; for(i=0; i 10.5 && (sum_c + Card[i].num) >=sum_m))/*Let the computer know what the next card is and decide whetherto get a card */{ Computer[k++]=Card[i++]; /*The computer gets a card*/ sum_c += Computer[k-1].num; /*Acumulate the whole points of the computer*/} else flag2=0; printf("n"); puts("Now the cards you get are:"); for(i=0; i 10.5 && (sum_c + Card[i].num) >=sum_m))/*Let the computer knonws what the next card is and decide wheter to get one*/{ Computer[k++]=Card[i++]; sum_c += Computer[k-1].num; if( sum_c > 10.5) break; } puts("Okay,now give out the result:"); puts("Now the cards you've got are:"); for( i=0; i 10.5 && sum_c > 10.5)||(sum_m

十点半扑克牌玩法

本文收集自互联网,如果发现有涉嫌侵权或违法违规的内容,请联系6532516@qq.com以便进行及时清除。
分享到