Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please use python and shoe screenshots of output the problem goes like this: you'll implement an agent that can solve Block World problems for an

please use python and shoe screenshots of output the problem goes like this: you'll implement an agent that can solve Block World problems for an arbitrary initial arrangement of blocks. You will be given an initial arrangement of blocks and a goal arrangement of blocks, and return a list of moves that will transform the initial state into the goal state.For us, blocks will be identified as single letters from A to Z. Blocks may be moved one at a time. A block may not be moved if there is another block on top of it. Blocks may be placed either on the table or on top of another block. Your goal is to generate a list of moves that will turn the initial state into the goal state. In the example above, that could be: Move D to the table, move B to A, move C to D, move B to C, and move A to B. There may be more than one sequence of moves that can accomplish the goal. If so, your goal is to generate the smallest number of moves that will turn the initial state into the goal state. Your solve() method will have two parameters: the initial configuration of blocks, and the goal configuration of blocks. Configurations will be represented by lists of lists of characters, where each character represents a different block (e.g. "A" would be Block A). Within each list, each subsequent block is on top of the previous block in the list; the first block in the list is on the table. For example, this list would represent the configuration shown above: two stacks, one with D on B and B on C, and the other with just A: [["C", "B", "D"], ["A"]] There may be up to 26 blocks in a puzzle and you may have as many stacks as there are blocks. You may assume that the goal configuration contains all the blocks and only the blocks present in the initial configuration. Yoursolve()method should return a list of moves that will convert the initial state into the goal state. Each move should be a 2-tuple. The first item in each 2-tuple should be what block is being moved, and the second item should be where it is being moved toeither the name of another block or "Table" if it is to be put into a new pile. For example, imagine the following initial and target state: Initial:[["A", "B", "C"], ["D", "E"]]Goal:[["A", "C"], ["D", "E", "B"]] Put in simple terms, the goal here is to move Block B from the middle of the pile on the left and onto the top of the pile on the right. Given that, this sequence of moves would be an acceptable solution: ("C", "Table")("B", "E")("C", "A")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions