Game of 21 help!

Started by
1 comment, last by Zahlman 14 years, 1 month ago
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(); };
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!
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.

This topic is closed to new replies.

Advertisement