首先游戏的简介如下:

                                                                                     Blackjack Game

This project is a simplified version of the casino card game Blackjack. The game works like this: Players are dealt cards with point values. Each player tries to reach a total of 21 without exceeding that amount. Numbered cards count as their face value. An ace counts as either 1 or 11 (whichever is best for the player), and any jack, queen, or king counts as 10.

The computer is the house (the casino) and it competes against one to seven players. At the beginning of the round, all participants (including the house) are dealt two cards. Players can see all of their cards, along with their total. However, one of house’s cards is hidden for the time being.

Next, each player gets the chance to take one additional card at a time for as long as he likes. If a player’s total exceeds 21 (known as busting), the player loses. After all players have had the chance to take additional cards, the house reveals its hidden card. The house must then take additional cards as long as its total is 16 or less. If the house busts, all players who have not busted win. Otherwise, each remaining player’s total is compared to the house’s total. If the player’s total is greater than the house’s, he wins. If the player’s total is less than the house’s, he loses. If the two totals are the same, the player ties the house (also known as pushing). Figure 1 shows the game.

其中的一种结果显示:

1.BlackJack类

基类

用途

Card

一张普通的扑克牌

handCard

一手牌,Card 对象的集合

deckCard

Hand

一副牌,具有除了Hand之外的洗牌和发牌的功能

commonPlayer

Hand

通用的玩家,不是正式玩家,就是电脑和人都能够玩的公共的

Player

commonPlayer

一个玩家

House

commonPlayer

电脑玩家,庄家

oneGame

一个游戏

所有的成员函数都是public的,所有的数据成员都是protected的,继承都通过public 继承,即各个派生类都继承基类的所有成员;

2.基本的继承层次图

1.Card是实际的纸牌

2.oneHand是Card的对象,所以有一个数据成员,就是指向Card对象的指针,存在于堆上

 

最新文章

  1. jsf组件对应表
  2. 安装Impala
  3. Yii框架 400 错误
  4. 关于composer安装插件时候提示找不到fxp插件时候的解决办法
  5. C#删除文件
  6. 如何修改mysql默认的数据库密码
  7. 希望早几年知道的5个Unix命令
  8. Jcrop简单实用
  9. android图像处理系列之三--图片色调饱和度、色相、亮度处理
  10. java类的高级特性
  11. javascript 高效按字节截取字符串
  12. C# Json数据反序列化为Dictionary并根据关键字获取指定值1
  13. 用EnableMenuItem不能使菜单变灰的原因
  14. hibernate4整合spring3出现java.lang.NoClassDefFoundError: [Lorg/hibernate/engine/FilterDefinition;
  15. NPOI 修改指定单元格字体颜色
  16. excel转换为TXT文本
  17. Nginx详解一:Nginx基础篇之环境准备
  18. 机器学习简要笔记(三)-KNN算法
  19. UIPickerView的使用
  20. 大数据IDEA调试flink程序

热门文章

  1. Oracle卸载
  2. linxu scp命令
  3. SQL pivot 基本用法 行列转换 数据透视
  4. 【转】GATK使用方法详解(包含bwa使用)
  5. redis.1--SDS结构
  6. 9.4用WebApi去连接外部认证服务
  7. JQuery可见性过滤选择器:hidden无法获取通过visibility:hidden样式隐藏的元素-遁地龙卷风
  8. ajax验证登录注册
  9. this.getServletContext().getRealPath("WEB-INF");
  10. Codeforces Round #288 (Div. 2) E. Arthur and Brackets