Write a Python program that accepts stacks of balls as input, conducts a Uniform-Cost Graph Search, and displays a solution as shown in the following example.
The program should output “No solution” when a given puzzle cannot be solved.
Ball Sort Puzzle: We have 16 balls. Each ball is labeled by either A, B, C, or D. We also have 6 stacks. Each stack can contain 4 balls. The 16 balls are randomly placed in 4 stacks. Two stacks are left empty. The goal of this puzzle is to sort the balls by label, so that 4 non-empty stacks contain 4 balls of the same label. There are two restrictions:
1. Only the top ball of each stack can be moved, and
2. A ball can only be placed on top of another ball of the same label or in an empty stack.
The following figure shows an example of the ball sort puzzle with an initial state and a possible goal state. Note that given an initial state, there may be multiple goal states.
Here are additional information
1) Your program must accept four lines of input using Python input() function. The first line is the top of the four stacks, the second line is the second element of the four stacks, etc. For example, the following input shows an initial state that is also a goal state.
A B C D
A B C D
A B C D
A B C D
2) Your program does not need to validate the input values. You can assume that the input values contain 4 As, 4 Bs, 4 Cs, and 4 Ds arranged in random order placed is the first four stacks.
6 freelances font une offre moyenne de 6769 ₹ pour ce travail
Hi there yes I am python expert and | am sure I can do this one ASAP Kindly send me a message we'll discuss further Looking forward to hear you Thank you.
Hi. I am a data scientist. I am very familiar to Deep learning apis such as Tensorflow and fastai, mxnet. I have a good hands on working with Advanced R and Python and BI tools and technologies, AI, Big Data. I have Plus
Hello! Greetings I have seen your posted project on Freelancer and I feel very much interested to work with you. I have read the things that you want. I consider myself perfect match for this project because I am curr Plus
Hi, I have extensive experience working with Python and Machine Learning. I can do task within budget and timeline. Please ping to discuss further.
I would like to apply for this job. I have a firm grip on the concepts of Python, and I have 2+ years of experience in this programming language. I have worked on several projects. I assure you that you will be satisfi Plus
Hi, It is easy,I can do on time.I work online, where you can track progress of your project.I have 6 years of experience in development(websites,web applications,mobile apps, desktop applications,UI/UX), using PHP, Wor Plus