Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Kniffel in C ++ Hello, can somebody help me with this task I would need a finished, running program to compare. Task: You should

Programming Kniffel in C ++

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.

image text in transcribed

KniffelGame FiveDice - fiveDice Sorted: FiveDice fiveDiceUnique: FiveDice firstIndexOut: size_t + KniffelGame () + rollAndProcess(): void + fullHouse (): bool + smallStreet(): bool + bigStreet(): bool + kniffel (): bool dice: array - points: unsigned + FiveDice () + rollDice (): void + sort(): void + unique (): size_t + difference (size_t, size_t): unsigned + toString(): string + KniffelGame FiveDice - fiveDice Sorted: FiveDice fiveDiceUnique: FiveDice firstIndexOut: size_t + KniffelGame () + rollAndProcess(): void + fullHouse (): bool + smallStreet(): bool + bigStreet(): bool + kniffel (): bool dice: array - points: unsigned + FiveDice () + rollDice (): void + sort(): void + unique (): size_t + difference (size_t, size_t): unsigned + toString(): string +

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago