我需要纸牌游戏的帮助。 [英] I need help with a card game.

查看:61
本文介绍了我需要纸牌游戏的帮助。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了清楚起见,这不是家庭作业,我已经尝试了其他网站,他们把我踢出去,因为这有点像。我只是想和我那个假装潇洒的程序员朋友一起下赌注,他并不认为我可以用Java制作纸牌游戏,但我是新手程序员,所以我要求你们帮忙。这是我可以做到的具体情况,如果我还需要提供其他任何内容,请告诉我。我也很快就需要这个,如果它不太难做。



请创建一个名为Card的类,可以用来代表扑克牌。

一张卡片应该有一套西装(心形,钻石,球杆或锹)和一个数值(让我们使用ace作为1通过国王作为13)。

创建一个名为Deck的类,可以用来代表一副52张扑克牌。

Deck类应该有一个类型为Card的数组,其中包含每个可能卡中的一个。

Deck构造函数应该创建一个已排序的牌组(就像你刚刚开箱即用)。

另外,Deck类应该有一个shuffle()方法。

您应该使用最简单的方法来创建一个良好的洗牌卡。

除了shuffle()方法,Deck类应该有一个drawCard( )从甲板上随机挑选一张牌并以某种方式标记它以便不能重新绘制的方法。

最后,Deck类应该有一个removeCard()方法,它将特定的卡作为参数并且将它从甲板上移除(对于不同时使用两个插孔等的游戏)

谢谢!

Just to be clear, this is not homework, I''ve tried other sites for this and they kick me out because this kinda looks like it. I''m just trying to win a bet with my sanctimonious programmer friend, he didn''t think that I could make a card game in Java, but I''m a novice programmer, so I''m asking you guys for help. This is as specific as I can make it, please let me know if there''s anything else I need to provide. I also need this rather soon, if it''s not too hard to make.

Please create a class called Card that can be used to represent a playing card.
A Card should have a suit (heart, diamond, club, or spade) and a numeric value (lets use ace as 1 up through king as 13).
Create a class called Deck that can be used to represent a deck of 52 playing cards.
The Deck class should have an array of type Card that contains one of each possible card.
The Deck constructor should create a sorted deck of Cards (like you just took it out of the box).
In addition, the Deck class should have a shuffle() method.
You should use whatever approach is easiest to create a well-shuffled deck of cards.
In addition to the shuffle() method, the Deck class should have a drawCard() method that picks a card at random from the deck and somehow marks it so it cannot be redrawn.
Finally, the Deck class should have a removeCard() method that takes a specific card as a parameter and removes it from the Deck (for games that do not use both Jacks etc.)
Thank you!

推荐答案

我'我只是想和我的假装好的程序员朋友一起下赌注,他并不认为我可以用Java制作纸牌游戏



和你刚刚证明他是对的。
I''m just trying to win a bet with my sanctimonious programmer friend, he didn''t think that I could make a card game in Java

And you have just proved him right.


我们不做你的功课:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


正如理查德所说的那样,你不应该欺骗赢得你的赌注:毕竟你可以诚实地赢得它。

满足这些要求的麻烦是什么?他们看起来并不令人生畏。

开始编码,玩得开心,并在遇到问题时在这里发布具体问题。
As Richard well said, you shouldn''t cheat to win your bet: after all you may win it honestly.
What are your troubles in satisfying such requirements? They don''t look daunting to me.
Start coding, have fun, and post here specific questions when you get stuck.


这篇关于我需要纸牌游戏的帮助。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆