VB.net 中的面向对象黑杰克

发布于 2024-08-22 23:37:07 字数 294 浏览 4 评论 0原文

好吧,所以我想提高我的编程和面向对象技能。我想在 Visual Studio 2008 下用 VB.net 编写一个完全面向对象的二十一点游戏。我做的第一件事就是学习二十一点的所有规则。

我一直在集思广益。 (我认为)我需要的是一个 Card 类,它有一个数字值及其表示形式(2、3、4、5、6、7、8、9、10、J、Q、KA)和一个符号(红心、钻石等)。

我想我需要一个类外的方法来创建一副 52 张不同的牌,以及一种处理它们和洗牌的方法。

我不确定是否应该为扮演房子的人工智能开设一个课程。

您有什么建议?

Alright, so I want to improve my programming and object orientation skills. I want to program a fully object oriented blackjack game in VB.net under Visual Studio 2008. The first thing I did was learn all the rules of BlackJack.

I've been brainstorming about it. What (I think) I need is a Card class that has a number value and its representation (2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K A) and a sign (hearts, diamonds, etc.).

I think I'd a method outside the class that creates a deck of 52 different cards, and a method to deal them and shuffle them.

I'm not sure whether or not I should make a class for the AI that plays as the house.

What suggestions do you have?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白昼 2024-08-29 23:37:07

构建一个 UML 图,尽可能抽象并计划、计划、计划!

Visual Paradigm 有一个免费供学生使用的版本(我相信是社区版),它是规划类、属性和方法的绝佳工具。

是的,我会构建某种类型的类来封装与游戏逻辑分离的人工智能逻辑。当您构建人工智能时,请确保以简单的方式规划游戏的获胜条件。

Build a UML diagram, abstract as much as possible and plan, plan, plan!

Visual Paradigm has a version that's free for students use (Community Edition I believe) and it's a great tool to plan your classes, properties and methods out.

Yes, I would build some type of class to encapsulate the AI logic that's separate from the game logic. When you build your AI, make sure you plan out your game's winning conditions in a simple manner.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文