Question
C++ Programming Kniffel Hello, can somebody help me with this task I would need a finished, running program to compare. Task: You should realize an
C++ Programming Kniffel
Hello, can somebody help me with this task
I would need a finished, running program to compare.
Task:
You should realize an object-oriented simulation of the dice game 'Kniffel' and with this simulation some statistical ones
Investigate questions. (Note: you don't need to know the game to do this. Everything you know
must, is in this assignment.) Use the class KniffelGame and the supporting class
FiveDice (see class diagrams):
The following applies to the data elements and element functions:
The FiveDice constructor ensures that every object is initialized by rollDice.
The member function rollDice implements the random throwing of five dice, whose numbers are in the array dice and the sum of the numbers in points are stored.
sort sorts the array dice in ascending order using the sorting method 'Insertion-Sort'.
unique should remove values that occur multiple times in the previously sorted array dice. You are supposed to function implement it yourself and use nonexistent unique implementations of the library. After expiry of unique at the beginning of dice are the original values in ascending order, but each Value only once. The last of these values is followed by a number of undefined values. The position of the first these undefined values should be returned as size_t by unique. The smallest of unique so the returned index value is 1 and the largest is 5 (if there are no multiple values).
difference takes two index values for the array dice and returns the difference between the associated values of dice back.
toString gives the content of the array dice and the value of points in a suitable formatting as a string back.
The KniffelGame constructor ensures that every object is initialized by rollAndProcess.
rollAndProcess generates new cube results, which are first sorted in fiveDiceSorted and then in five
DiceUnique can be saved as described under unique above; thereby the generated by unique
Return value adopted in firstIndexOut.
fullHouse returns the value true if and only if the elements of fiveDiceSorted double a number
and contain another number three times; otherwise the value false is returned.
smallStreet ('Kleine Strae') returns the value true if and only if the elements of fiveDiceSorted
contain four consecutive numbers; otherwise the value false is returned.
bigStreet ('Big Street') returns the value true if and only if the elements of fiveDiceSorted are five
contain consecutive numbers; otherwise the value false is returned.
kniffel returns the value true if and only if the elements of fiveDiceSorted have five identical numbers
contain; otherwise the value false is returned.
The application program (main) should carry out the following actions in sequence (i.e. no menu should be implemented will):
Ten repetitions of the following actions:
o Generation of a FiveDice object, call of sort, output of the sorted values,
o Call of unique and output of the values now saved in the FiveDice object. In addition, the
Index of the first value after the sorted part (without repeated values) is output will.
Roll five dice 1,000,000 times and answer the following statistical questions:
o Save the frequencies of the possible dice sums from 5 to 30 in a suitable container and then
output as numerical values in the form of a table,
and as a simple graphic representation in the form of a bar chart tilted by 90 degrees (e.g. output corresponding number of *). Here is a suitable standardization be careful so that the number of asterisks for the greatest frequency value is a console line fills in well.
o Counting the number of times Small Straight, Full House, Big Straight, and Kniffel are thrown.
Enter the values obtained both as absolute numerical values (example: "At 1 000 000 litters were 38580 full house thrown ") as well as relative frequencies in percent (example:" 3,858 percent the throws were full house ").
KniffelGame FiveDice fiveDiceSorted: FiveDice fiveDiceUnique: FiveDice firstIndexOut: size t + KniffelGame () + rollAndProcess(): void + fullHouse (): bool + smallstreet(): bool + bigstreet(): bool + kniffel(): bool dice: arrayStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started