  Anonymous

### Question Description

Imagine you are writing the AI for a simple game that will require an adversarial search.

The state of the game can be represented using a list of 3 elements, such as (B B B). The list representing the game state can contain any combination of 3 values: A, B, or C. It will always have exactly 3 items. (Let's call it the "state list").

With that in mind, write the following LISP functions:

• TERMINAL-TEST - this function takes a state list as it's only argument. If the list contains no B's, it is considered a terminal state and TERMINAL-TEST should return t, nil otherwise.
• UTILITY - this function accepts a state list as it's only argument and evaluates the state list. If the list contains all A's, then the function returns 1. If the list contains all C's, then the function returns -1. Any other combination of A's, B's, or C's returns 0.
• ACTIONS - this function accepts a state list as it's only argument and returns a list of possible actions according to the following table:
 State Action (B * *) A1 (* B *) A2 ( * * B) A3

Where :
* represents A, B, or C
State is the state list passed to the function
Action is the possible action returned given that state

So, if the state list passed to the function was (B C B), then the function should return (A1 A3).
• RESULT - this function accepts a state list and an action as it's only arguments. The function then returns a state list according to the following table:
 State Action Returned (B * *) A1 (A * *) (* B *) A2 (* A *) (* * B) A3 (* * A)
Where:

State and Action are both passed as arguments and
Returned is the state list that is returned.
The * represents A, B, or C.

For example, if (B C B) and A3 were both passed as arguments, then the state list that gets returned would be (B C A).

Demonstrate your functions work by calling each one in turn, passing each of them appropriate arguments, and then printing to the screen the values they returned. Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service. This question has not been answered.

Create a free account to get help with this and any other question! Brown University

1271 Tutors California Institute of Technology

2131 Tutors Carnegie Mellon University

982 Tutors Columbia University

1256 Tutors Dartmouth University

2113 Tutors Emory University

2279 Tutors Harvard University

599 Tutors Massachusetts Institute of Technology

2319 Tutors New York University

1645 Tutors Notre Dam University

1911 Tutors Oklahoma University

2122 Tutors Pennsylvania State University

932 Tutors Princeton University

1211 Tutors Stanford University

983 Tutors University of California

1282 Tutors Oxford University

123 Tutors Yale University

2325 Tutors