Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <ctime>
- #include <iostream>
- using namespace std;
- void greenDice();
- void yellowDice();
- void redDice();
- int fish();
- int hook();
- int boot();
- int main()
- {
- int playerScore[4];
- int turn[3];
- int players;
- int input;
- cout << "Welcome to the Fish Die game!";
- cout << "Press 1 for rules, or 2 to start the game.";
- cin >> input;
- if(input == 1) {
- cout << "The rules are simple! Pick 3 dice out of the cup, then roll!\n";
- cout << "Each fish you roll counts as 1 point,\n";
- cout << "Each boot you roll counts as a strike, and any hooks can be rerolled. ";
- cout << "Each roll set aside any fish and boots and reroll 3 die again.\n";
- cout << "The first to 12 fish wins. If you get 3 boots, you get 0, and your turn is over.\n";
- } else {
- cout << "How many players will there be?\nEnter a number greater than 2\n";
- }
- while(players >= 2 && players <= 12) {
- cin >> players;
- cout << "Please enter a valid number";
- }
- system("PAUSE");
- return 0;
- }
- void roll()
- {
- srand(time(0));
- int s;
- for (int x = 1; x < 4; x++)
- s = rand()%13;
- if (s < 6) {
- greenDice();
- } else if(s > 5 && s<9) {
- yellowDice();
- } else if(s>8) {
- redDice();
- }
- }
- void greenDice()
- {
- srand(time(0));
- int g;
- g = rand()%6;
- if(g< 3) {
- fish();
- } else if(g>2 && g<5) {
- hook();
- } else if(g>4) {
- boot();
- }
- }
- void yellowDice()
- {
- srand(time(0));
- int y;
- y = rand()%6;
- if(y<2) {
- fish();
- } else if(y>1 && y<4) {
- hook();
- } else if(y>3) {
- boot();
- }
- }
- void redDice()
- {
- srand (time(0));
- int r;
- r = rand()%6;
- if (r<1) {
- fish();
- } else if(r>0 && r< 3) {
- hook();
- } else if(r>2) {
- boot();
- }
- }
- int fish()
- {
- cout << "You rolled a fish";
- ++turn[1];
- }
- int hook()
- {
- cout << "You rolled a hook";
- ++turn[2];
- }
- int boot()
- {
- cout <<"You rolled a boot.";
- ++turn[3];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement