Write a program to simulate a simplified board game called Settlers. Settlers is a two player game played on a 10x10 game board, where the objective is to create as many settlements as possible in the land to win. The winner is the player who has the highest scores in terms of their settlements. This modified version of Settlers will be simulated using two computer players.
No user input is required for this game. The 10x10 board will be simulated using a 10 x 10 2D array. At the start, the game must randomly decide which computer player (1 or 2) will go first. This game will include the following pieces:
• “Settler” piece – represents a single settler in the land
• “Castle” piece – represents a settlement
• “Tower” piece – represents a tower to protect the settlement
• “Mine” piece – represents a mine for the settlers to do mining
The following are the initial number of pieces for the entire game:
Piece Quantity
Settler 20
Castle 5
Tower 10
Mine 10
Then, the program should simulate the game play as follows:
• At each turn, the current state of the game board should be displayed
• At each turn, each computer player rolls a dice. Then, the program must also generate two random numbers that represent the x and y position in the 2D array.
• The rules to follow for placing an item on the game board is as follows:
o If the dice value is between 1 and 3, inclusive, and there are “settler” pieces available, place a “settler” piece at [x][y] position on the game board
o If the dice value is 4 and there are “castle” pieces available, place a “castle” piece at [x][y] position on the game board
o If the dice value is 5 and there are “tower” pieces available, place a “tower” piece at [x][y] position on the game board
o If the dice value is 6 and there are “mine” pieces available, place a “mine” piece at [x][y] position on the game board
• If the [x][y] position on the game board is occupied, the computer player skips its turn.
Overall, each position (or slot) in the displayed 10x10 2D game board can contain any of the following:
• E = empty space
• S = settler
• C = castle
• T = tower
• M = mine
Your program also needs to track which computer player owns which piece on the game board.
The game ends when the following condition is satisfied:
• When there are no more remaining pieces to place on the game board. At this point, your program should go through the game board and add up the scores for each computer player according to the following table:
Rule Number of points
For every “settler” piece 1
For every “castle” piece 5
For every “tower” piece 3
For every “mine” piece 3
For every “settler” piece
that is surrounded
by a castle* 15 points for each surrounding castle
For every “mine”
piece that is adjacent
(left or right only)
to a “settler” piece 10 points for each adjacent mine
*Surrounded means there is a piece on one of the 8 neighbouring positions around position [x][y] on the game board.
In the computation of the scores you can assume that there will be double-counting for certain pieces based on the rules above.
Your program must, at least, include the following methods/functions with the correct input parameters and output type:
i. initializeGameBoard, which will take as input the player’s 2D array and assign empty slots containing E.
ii. placeItem, which will take as input the 2D array and place an item onto the game board depending on the above stated rules.
Your program also needs to track and print the following:
• The total number of pieces dropped onto the game board by computer player 1
• The total number of pieces dropped onto the game board by computer player 2
Please help me with this.