Sign in to follow this  
nuclear123

Game of 21 help!

Recommended Posts

nuclear123    119
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
nbertoa    1022
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
Zahlman    1682
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this