CSCI 261 - Programming Concepts - Spring 2021

Lab 6A - Yahtzee!

This lab is due by Thursday, April 08, 2021, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.


Yahtzee!


For this lab, we are going to collectively implement most of a Yahtzee game. Everyone will make a small piece of the game and we could then put all the pieces together to make a fully functioning game.

The first step to make Yahtzee is to know how to play. Here are the official rules. Play a game of yahtzee online. Be sure to take note of two pieces of information each round:

  1. What conditions must be satisified to earn points
  2. How many points are scored for each category

Play through a complete game. Who won?

After you've played at least one complete game, choose two different Yahtzee categories. One must be from the "upper section" and one must be from the "lower section". These are:

You will need to write two functions for each of these categories.

  1. The first function will test the given five dice for whether the conditions of the Yahtzee category are met or not. We will represent each of our dice with an integer variable. Therefore, the function should accept as input five integers to represent our five dice. The function should return as output true if the conditions are met and false otherwise. Name the function isXYZ where XYZ is the name of the category you are testing for in proper camel case.
  2. The second function returns the score if the current set of dice were going to be scored for that category. The function should accept as input five integers to represent our five dice. The function should return as output the score for the category. Name the function scoreXYZ where XYZ is the name of the category you are testing for in proper camel case. Recall for scoring some categories, a score should only be returned if the condition is present. If the dice do not satisfy the conditions, then zero is returned as the score.

For example, the function for the Full House category would be structured as follows:

bool isFullHouse( int die1, int die2, int die3, int die4, int die5 ) {
  // code goes here
}

int scoreFullHouse( int die1, int die2, int die3, int die4, int die5 ) {
    // code goes here
}

To test that our functions are correct and can handle a variety of scenarios, we are going to use the AutoGrader to test our functions. Note you must be connected to the Mines network in order to access the AutoGrader website (this means you need to use the VPN if off campus).

Once logged in, choose "CSCI 261 Programming Concepts" and this lab. You will now see a list of all the functions possible for this lab.

Your goal is get all the boxes to be green. When all the tests pass and you've submitted the two functions, then you are done with this lab! Read below about how to properly receive credit for this lab.


What To Turn In



Back in CLion land, create a file called main.cpp for a Lab6A project. Inside this main, copy your functions from the AutoGrader and paste it into this file. We do not need a main() function and full program for this lab - just the two functions.


Lab Submission



You will submit your solution to this lab with the rest of Set6. Detailed instructions for doing this are posted in Assignment 6.


This lab is due by Thursday, April 08, 2021, 11:59 PM.
As with all labs you may, and are encouraged, to pair program a solution to this lab. If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.