Question
In Java: You are given seven hexagon tiles. Each tile has 6 colored segments. Colored segments can be any color from the following,Red,Blue,Yellow,Green,Orange,Purple. Colors may
In Java:
You are given seven hexagon tiles. Each tile has 6 colored segments.
Colored segments can be any color from the following,Red,Blue,Yellow,Green,Orange,Purple. Colors may also repeat on the same hexagon tile. The tiles themselves are also labeled 1 - 7.
You need to place the 7 hexagon tiles on a board such that the first hexagon is placed in the center, and the remaining 6 are placed going around the first. The trick is that adjacent segments of the hexagons must have the same color in order for the placement to be valid.Your program must use recursion to find a possible solution.
The following presents a possible example given the 7 hexagons.
The input to the program will be a text file which will contain the color labels for each of the seven hexagon tiles. Each label will be separated by a comma and no spaces.
Example: The above hexagon tile would be represented in the text file as B,Y,G,O,P,R (starting with blue and continuing clockwise to red).
The program will take an input file which has the tile information for 7 hexagon tiles, and find and display a possible solution to the puzzle given.The program must solve the puzzle recursively. If a solution is found, then display the configuration of the hexagons on the console. If no solution is found display a message saying that there is no solution for the given hexagon tiles.
NOTE: Given a set of 7 hexagons, there may be more than one solution.
Step 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