Question: C++ Programming Electricity tariffs Hello, can somebody help me with this task I would need a finished, running program to compare. Happiness house Background: The

C++ Programming Electricity tariffs

Hello, can somebody help me with this task

I would need a finished, running program to compare.

C++ Programming Electricity tariffs Hello, can somebody help me with this task

Happiness house

Background:

The game 'Glckshaus' from the late Middle Ages is a game of chance that is played with two dice, a game board (see example on the right) and (game) coins. The aim is to win the coins of the other players. Course of the game: At the beginning each player has to put a certain number of coins on the table. The two dice are rolled in turn, the eyes are added together:

Total 3, 5, 6, 8, 9, 10, 11: If the field with this number on the playing field is empty, the player must put one of his coins on the field. If there is already a coin there, he may take it instead.

Total 4: Nothing happens, it's the next player's turn.

Total 7: A coin must be placed on the field with the 7, regardless of whether there are others there or not.

Total 2: The coins from the whole board - except for the field with the 7 - can be taken.

Total 12: The coins from the whole board - including the field with the 7 - may be taken.

End of the game: The game ends when all but one of the players have lost their coins.

Task:

You should realize an object-oriented simulation of the game 'Glckshaus' and simulate a series of games according to different specifications. To do this, use the HouseOfFortune class and the Player class:

I would need a finished, running program to compare. Happiness house Background:The game 'Glckshaus' from the late Middle Ages is a game of

The following applies to the data elements and element functions:

The array board represents the playing field with its 11 fields. The global constant for the array size has at least the value BOARD_SIZE = 11. If you want to make things a little easier, you can also choose BOARD_SIZE = 13 and both leave the first array spaces unused.

nextPlayer is given the player whose turn it is next. The function lets the transferred player roll the dice and remembers the number of points. Then it determines the win or loss according to the rules of the game (see above: course of the game) and hands over the won coins from the playing field to the player or takes a raffled

Take a coin from the player and place it on the field. In addition, nextPlayer returns the number rolled by the player.

noOfCoinsOnBoard counts all coins that are currently on the playing field and returns this number.

Player's constructor takes the name of the player and the number of coins he is playing with from outside. It also generates the id of every new player object by setting id to the value of the (static) class variable idPool and then increasing idPool by one. At the beginning, idPool has the value 0. The created player objects are given the id values 0, 1, 2, 3, 4, 5 one after the other.

rollDice simulates the throwing of two dice and returns the rolled total.

winCoins receives a number of coins from the playing field and increases the noOfCoins of the player accordingly.

looseCoin gives a coin to the playing field, i.e. the noOfCoins of the player is decreased by one and this one coin is returned for further processing. When the player has given his last coin, he is eliminated from the game.

outOfGame returns true if the player is eliminated as long as he is still playing, i.e. false

12. 9 10 11 6 7 8 3 4. 5 2. HouseOfFortune board: array + nextPlayer (Player): int + noofCoinsOnBoard (): int - Player name: string id: int noofCoins: int idPool: int + Player (string, int) + rollDice (): int + winCoins (int): void + looseCoin(): int + getName(): string + getId(): int + getNoOfCoins (): int + outofGame (): bool + setIdPool (int) : void fakultativ: + operator + nextPlayer (Player): int + noofCoinsOnBoard (): int - Player name: string id: int noofCoins: int idPool: int + Player (string, int) + rollDice (): int + winCoins (int): void + looseCoin(): int + getName(): string + getId(): int + getNoOfCoins (): int + outofGame (): bool + setIdPool (int) : void fakultativ: + operator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!