唉。。。大牌很纠结啊!

SHAOYIOU 2009-10-30 05:20:24

A Hand of Bridge

1 Purposes
1)To give you practice in designing and using classes and objects
2)To give you practice using arrays
2 General idea of the assignment
2.1
General idea Play a hand of bridge.
Don’t worry-- you don't actually have to know bridge in order to do this assignment. In fact, thisassignment is "inspired by" bridge in the same way that a movie is "inspired by" a true story. I'm providing some very simplified rules. If you do know how to play bridge, please accept my apologies--but the assignment is still to write a program to play this version, not the real game.
2.2
The rules
A deck of cards consists of 52 cards--13 each in four different suits. The four suits are called Spades, Hearts, Diamonds, and Clubs. Each card in a suit has a number from 1 to 13. Hence we have cards such as "the 4 of Spades" or "the 13 of Diamonds." (We do not have Ace, Jack, Queen, King cards, just numbered cards.)
There are four players, whom we will call North, East, South and West. Any player can act as the "dealer."
Here's how it goes:
1.The dealer "shuffles" the deck. This randomizes the order of the cards, but there are still 52 different cards--no card ever occurs twice.
2.The dealer "deals" the cards; that is, she gives 13 cards to each player, including herself. The 13 cards held by a player are that player's "hand."
3.One of the players is chosen (I don't care how) to "lead," that is, to play the very first card.
Next, thirteen "tricks" are played. Each trick proceeds as follows:
1.The chosen player plays the first card. "Playing a card" means removing it from her hand and letting the other players know which card it is. (In the real game, the card is placed face up on the table.) It is important to notice what the suit of this card is. In this simplified game, any card may be played as the first card of a trick (the players have no strategy or any idea of a "good" card to play).
2.Each of the remaining players then plays a card. If a player has any cards of the same suit as the first card played, then she must "follow suit" (play a card of the same suit). If she has no cards of the same suit, she may play any card.
3.When all four players have played a card, the player who played the highest-numbered card of the first suit played "takes the trick"--she collects and puts aside all four cards (we can ignore this bit--you don't need to keep track of the cards after the trick has been played). This player is then chosen to lead (play the first card of) the next trick. 1
After doing the above 13 times, all cards have been played and the hand ends. The program ends, too.
There is no strategy to this game, it isn't scored, nobody wins or loses. It's a stupid game, OK?
2.3
Partial Example (one trick)
After the cards are shuffled and dealt:
1.North plays the 5 of Hearts
2.East plays the 8 of Hearts
3.South (who has no Hearts) plays the 12 of Diamonds
4.West plays the 1 of Hearts
Since the first card played was a Heart, the player who played the largest Heart (East, with the 8 of Hearts) collects the four cards, and "leads"--chooses any card from her hand (of any suit) to start the next trick. Whatever card East chooses, the other three players must play cards of the same suit, if possible.
3 Y
our assignment
I will suggest what classes you need (and you may have more, if you like), but it's up to you to decide what their instance variables and their methods should be.
Use the objects you define to play a hand of "bridge."
Print out at least:
Who gets dealt which cards
For each trick:
who leads,
who plays which cards, and

who takes the trick.
4 Structure of this assignment
Project name: Bridge
Package name: bridge
Suggested classes:
class Bridge -- contains the main method. Controls the game.
class Card -- represents one card. Has a suit and a value. You can find out what the suit and value are, but you can't change them.
class Player -- represents a player. Every player knows how to shuffle, how to deal, and how to play cards.
Provide UML class Diagrams
The above are requirements. You may have additional classes and methods as needed, and they should be documented and unit tested as appropriate.

5 Due date
Wednesday, November 04, before midnight. Hand in one project with both your names on it; zip up the entire project directory and hand it in via Course Management System.
...全文
117 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Agile牧 2009-11-01
  • 打赏
  • 举报
回复
这是。。。。。
jackalanfang 2009-10-31
  • 打赏
  • 举报
回复
....
lotusandjava 2009-10-31
  • 打赏
  • 举报
回复
............
内容概要:本文系统介绍了基于MATLAB平台的风力涡轮机雷达信号仿真研究,涵盖完整的仿真代码、实测数据及配套学术文章,重点实现雷达信号处理、风力涡轮机回波建模、微动特征提取与时频分析等核心技术。通过高精度模拟风机叶片旋转引起的调制效应与雷达散射截面变化,深入揭示风力发电场对周边雷达系统造成的电磁干扰机制,为雷达杂波抑制、目标检测优化及空域兼容性设计提供理论支撑与技术验证平台。资源内容还可拓展应用于无人机路径规划、电动汽车调度、电力系统优化等交叉领域,展现MATLAB在复杂系统仿真中的强大集成能力。; 适合人群:具备MATLAB编程基础与雷达信号处理知识的科研人员,适用于从事新能源并网影响评估、雷达系统设计、电磁兼容分析、智能电网或远程 sensing 领域研究的研究生、工程师及高校教师; 使用场景及目标:①开展风电场对空中监视雷达干扰效应的仿真评估;②研究风电杂波的时频特性与微多普勒特征建模方法;③开发针对非合作目标干扰的雷达抗干扰算法与信号分离技术;④作为科研项目申报、论文复现或工程预研的技术原型工具包; 阅读建议:建议结合百度网盘提供的完整资料包(含代码、数据集与参考文献)同步学习,优先运行示例脚本以掌握仿真流程,再根据具体研究需求调整系统参数进行扩展实验,同时可借鉴文中提到的其他MATLAB仿真案例以提升研究深度与广度。

23,404

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧