Waived!

Write a Lisp program that generates a list containing all legal successor states for any state in

(2 customer reviews)

Original price was: $10.00.Current price is: $5.00.

Download button will appear immediately after successful payment.

Full support will be provided with necessary files installation.

Get impeccable customized solution within 24 hours, hassle-free.

View Details
Solved By Verified
Study Co-Pilot All Study Co-Pilots are evaluated by Gotit Pro as an expert in their subject area.
Instant
Download

Description

Write a Lisp program that generates a list containing all legal successor states for any state in the Missionaries and Cannibals problem. Your program should be invoked by the function call:

(mac-next state)

where state is of the form (m,n,b), with m representing the number of missionaries (0-3) on the left bank, n representing the number of cannibals (0-3) on the left bank, and b representing whether the boat is on the right side (r) or the left side (I) of the river.

For example:

(mac-next (33I)) => ((22r) (32r) (31r))

(mac-next (31r)) => ((32I) (33l))

(mac-next (33r)) => nil

Your function should check whether the inputted state is in the proper format. If not, an error message should be displayed instead of the list of successor states.


You may also like…