Question: Please write in java code. This is a board game. Requirement: This class stores the data, an object of this class stores a board configuration

Please write in java code. This is a board game.

Requirement:

This class stores the data, an object of this class stores a board configuration and its integer score,Each board configuration will be represented as a string as follows. A blue tile is represented with the character b, an orange tile with o, and a green empty space with g. To form a string for a given board configuration we concatenate the characters corresponding to the tiles and empty positions on the board starting at the upper left position and moving top to bottom and left to right. For example, for the configurations in Figure 2, their string representations are obbbogbog, obbboobog, and obbbogboo.

For this class, you must implement all and only the following public methods:

public Configuration(String config, int score): A constructor which returns a new Configuration object with the specified configuration string and score. The string config will be used as the key attribute for every Configuration object.

public String getStringConfiguration(): Returns the configuration string stored in a Configuration object.

public int getScore(): Returns the score stored in a Configuration object.

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!