Jump to content
  • Advertisement
Sign in to follow this  
nuclear123

Game of 21 help!

This topic is 3050 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok so i'm working on a game of 21...it involved a player,computer,and 1 die... my question is how should i construct this? what is the proper way? 1.) have a class for the game? and a class for my die? 2.) do i need to have them linked together in anyway? class Twentyone { private: int computerScore; int playerScore; public: Twentyone(); // Game Functions int pickStarter(); int displayScores(); int checkQuitters(); int checkBusts(); void userDecision(); // Computer Functions int cRoll(); int cStopRolling(); //cQuit(); // Player Functions int pRoll(); int pStopRolling(); int pQuit(); }; /* ===================== Twentyone::Twentyone ===================== */ Twentyone::Twentyone() : computerScore(0), playerScore(0) { } class Die : public Twentyone { private: int dieValue; const static int maxDieValue; public: Die(); void getValue(); int setValue(); };

Share this post


Link to post
Share on other sites
Advertisement
You must think in the common things and in the class responsabilities!
You have the 21 game. What are the game responsabilities? To run the game, to take new cards, etc etc.
We have players (human and computer), hence you need to see the player's abstraction!

Share this post


Link to post
Share on other sites
Quote:
Original post by nuclear123
ok so i'm working on a game of 21...it involved a player,computer,and 1 die...


You're going to have to start out by stating your requirements a lot more clearly and in more detail. The only time I've ever heard a game called "21", it was another name for Blackjack, which is played with cards, not a die.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!