117k views
4 votes
You are given three pegs and a sequence of discs of different sizes, stacked in decreasing order on the first peg. The goal is to move the entire stack to the third peg, while following the rules of the game, which are: • Only one disc can be moved at a time • A disc can only be placed on top of a larger disc or an empty peg Design a heuristic function that is admissible and consistent. Your heuristic

User AyB
by
8.0k points

1 Answer

2 votes

Final answer:

A possible heuristic function for the given problem is to count the number of discs that are not in their final position. This heuristic is admissible and consistent.

Step-by-step explanation:

One possible heuristic function for the given problem is to count the number of discs that are not in their final position. This heuristic is admissible because it never overestimates the number of moves required to solve the problem, since each move can only result in one disc being moved closer to its final position. This heuristic is also consistent because if a disc needs to be moved multiple times to reach its final position, the heuristic value will gradually decrease as the disc gets closer to its final position.

User JoshDM
by
8.1k points