BlacJack游戏
首先游戏的简介如下:
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对象的指针,存在于堆上
BlacJack游戏的更多相关文章
- 使用HTML5开发Kinect体感游戏
一.简介 我们要做的是怎样一款游戏? 在前不久成都TGC2016展会上,我们开发了一款<火影忍者手游>的体感游戏,主要模拟手游章节<九尾袭来 >,用户化身四代,与九尾进行对决, ...
- jQuery实践-网页版2048小游戏
▓▓▓▓▓▓ 大致介绍 看了一个实现网页版2048小游戏的视频,觉得能做出自己以前喜欢玩的小游戏很有意思便自己动手试了试,真正的验证了这句话-不要以为你以为的就是你以为的,看视频时觉得看懂了,会写了, ...
- Unity游戏内版本更新
最近研究了一下游戏内apk包更新的方法. ios对于应用的管理比较严格,除非热更新脚本,不太可能做到端内大版本包的更新.然而安卓端则没有此限制.因此可以做到不跳到网页或应用商店,就覆盖更新apk包. ...
- 游戏服务器菜鸟之C#初探一游戏服务
本人80后程序猿一枚,原来搞过C++/Java/C#,因为工作原因最后选择一直从事C#开发,因为读书时候对游戏一直比较感兴趣,机缘巧合公司做一个手游的项目,我就开始游戏服务器的折腾之旅. 游戏的构架是 ...
- iOS审核这些坑,腾讯游戏也踩过
作者:Jamie,专项技术测试工程师,在iOS预审和ASO优化领域从事专项测试相关工作,为腾讯游戏近100个产品提供专项服务. WeTest 导读 在App上架苹果应用商店的过程中,相信大多数iOS开 ...
- 漫谈C#编程语言在游戏领域的应用
0x00 前言 随着微软越来越开放,C#也变得越来越吸引人们的眼球.而在游戏行业中,C#也开始慢慢地获得了关注.这不, 网易绝代双娇手游团队已经全面使用.Net Core支持前后端统一C#开发,跨平台 ...
- 解构C#游戏框架uFrame兼谈游戏架构设计
1.概览 uFrame是提供给Unity3D开发者使用的一个框架插件,它本身模仿了MVVM这种架构模式(事实上并不包含Model部分,且多出了Controller部分).因为用于Unity3D,所以它 ...
- 趣说游戏AI开发:曼哈顿街角的A*算法
0x00 前言 请叫我标题党!请叫我标题党!请叫我标题党!因为下面的文字既不发生在美国曼哈顿,也不是一个讲述美国梦的故事.相反,这可能只是一篇没有那么枯燥的关于算法的文章.A星算法,这个在游戏寻路开发 ...
- 拼图小游戏之计算后样式与CSS动画的冲突
先说结论: 前几天写了几个非常简单的移动端小游戏,其中一个拼图游戏让我郁闷了一段时间.因为要获取每张图片的位置,用`<style>`标签写的样式,直接获取计算后样式再用来交换位置,结果就悲 ...
随机推荐
- 第12天 android studio
1. http://jingyan.baidu.com/article/215817f7888dc21eda14230d.html Gradle DSL method not found:‘andro ...
- bootstrap-dropdown
功能:实现点击时下拉框显示 插件:dropdown.js 要点:dropdown功能往往用在导航栏.导航条上,用作标题显示.dropdown与<ul><li>标签搭配用. 以d ...
- CentOS-6.5安装zabbix 3.0.4
关闭selinux [root@localhost /]# sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/selinux ...
- 08OC之Foundation框架
1.Foundation框架简述 在前面,我们创建一个类的时候,都会选择Cocoa Class.到底Cocoa Class是什么东西呢? Cocoa 不是一门编程语言,因为它可以运行在多种编程语言上, ...
- 超级强大的formValidator
来源: http://www.cnblogs.com/wzmaodong http://www.neatstudio.com/show-73-1.shtml (全) http://www.cnblo ...
- 简单实现div遮罩
顾名思义,div遮罩就是将网页上的一部分用div遮盖起来,防止用户误点,因此div遮罩的一个用途就是将table设置为不可编辑. 作者通过查找资料,并进行简单的测试,最终完成了以下几段简单代码,来实现 ...
- NSFileManager
//返回一个字符串数组(子路径), 并且不包含文件夹 [[NSFileManager defaultManager] contentsOfDirectoryAtPath:folderPath erro ...
- Intent flag 与启动模式的对应关系
Activity有四种启动模式: 1.standard(标准) 2.singleTop 3.singleTask 4.singleInstance 标识某个Activity的启动模式,有 ...
- Android 中的 Intent 简介
Intent是Android程序中各组件之间进行交互的一种重要方式,它不仅可以指明当前组件想要执行的动作,还可以在不同组件之间传递数据. ------------------------------- ...
- 10个php笔试题
Q1 第一个问题关于弱类型 $str1 = 'yabadabadoo'; $str2 = 'yaba'; if (strpos($str1,$str2)) { echo "/"&q ...