简单的c语言小程序游戏,21点游戏介绍和简单的算牌小程序C语言代码

Blackjack, also known as twenty-one, is the

most widely played casino banking game in the world. Blackjack is a

comparing card game between a player and dealer, meaning players

compete against the dealer but not against other players. It is

played with one or more decks of 52 cards. The objective of the

game is to beat the dealer in one of the following ways:

Get 21 points on the player's first two cards (called a

"blackjack" or "natural"), without a dealer blackjack;

Reach a final score higher than the dealer without exceeding 21;

or

Let the dealer draw additional cards until his or her hand exceeds

21.

The player or players are dealt a two-card hand and add together

the value of their cards. Face cards (kings, queens, and jacks) are

counted as ten points. A player and the dealer can count an ace as

1 point or 11 points. All other cards are counted as the numeric

value shown on the card. After receiving their first two cards,

players have the option of getting a "hit", or taking an additional

card. In a given round, the player or the dealer wins by having a

score of 21 or by having the higher score that is less than 21.

Scoring higher than 21 (called "busting" or "going bust") results

in a loss. A player may win by having any final score equal to or

less than 21 if the dealer busts. If a player holds an ace valued

as 11, the hand is called "soft", meaning that the player cannot go

bust by taking an additional card; 11 plus the value of any other

card will always be less than or equal to 21. Otherwise, the hand

is "hard".

The dealer must hit until the cards total 17 or more points. (At

many tables the dealer also hits on a "soft" 17, i.e. a hand

containing an ace and one or more other cards totaling six.)

Players win by not busting and having a total higher than the

dealer's. The dealer loses by busting or having a lesser hand than

the player who has not busted. If the player and dealer have the

same total, this is called

a "push", and the player typically does not win or lose money on

that hand. If all available players bust, the hand ends

automatically without the dealer having to play his or her

hand.

Blackjack has many rule variations. Since the 1960s, blackjack has

been a high-profile target of advantage players, particularly card

counters, who track the profile of cards that have been dealt and

adapt their wagers and playing strategies accordingly.

Blackjack has inspired other casino games, including Spanish 21 and

pontoon.

算牌程序C语言代码

#include

#include

int main(){

char

card_name[3];

int count =

0;

do{

puts("input

your card_name");

scanf("%2s",card_name);

int val =

0;

switch(card_name[0]){

case 'K': //

use the : instead of ;

case

'Q':

case

'J':

val=10;

break;

case

'A':

val=11;

break;

case

'X':

continue; //use continue to get to the start of a loop

default: // use "default" for other situations

val=atoi(card_name);break;} // convert into number

if(val<1||val>10){

puts("Not sure what you mean");

continue;

}

if(val>2&&val<7)

count++;

else if (val==10)

count--;

printf("the count is %i\n",count);

}while(card_name[0]!='X');

return 0;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值