程序代写代做代考 prolog # Hints

# Hints

`Project 4 Hints.pdf` 里面有更多 hint

—-

– [ ] 如果在角落,不撞墙

– [ ] Smell 的时候可能已经在pit边上了?

– [ ] The **total energy** used will be used to compare solutions.

– First criterium: did you **kill the wumpus** (without this you get 0 marks)
– second criterium: how many **attempts** required
– third criterium: **total energy** used.

Don‘t worry about other criteria but the first until your solution can always find and kill the wumpus!

– [ ] Best to try many starting points, it will help find more bugs!

– [ ] The key to this project is that ==every guess must gain new information.== Your robot instructions must **explore the maze**, **find the Wumpus**, and then **get a robot to move to shoot the Wumpus**. *Every attempt must be guaranteed to gain **new information** about the map, otherwise you can **get stuck in a loop**.*

– [ ] A critical decision for the project is ==your representation of state==. You need to track what parts of the map you **have visited**. You also may want to track **which shots (which position and direction) you have taken**. You may want to add **more state** as you get a better solution.

– [ ] The **first approach should be to ignore the damp, smell and stench feedback** and simply **concentrate on recording accurate information** about the map.????

– [ ] You need to be careful that **when searching for a plan** that the search doesn’t go into an infinite loop. You can prevent this by making sure that **plan uses at most 100 energy.**

– [ ] The key part of your code is to ==use the ability of Prolog to search for a possible plan==. **The plan must find new information**. You may break down the project into two parts: e.g. plans to find the Wumpus, and then plans to shoot the Wumpus. Or you might try to do everything at once, shooting wildly in all directions as you traverse the maze.

– [ ] You can use your **state type** to store a representation of the **map**, a representation of **shots you have previously taken**, a representation of **where the Wumpus could possibly be or not be**.

– [ ] Once you have a **basic version** that works you can consider things like: making **very long plans** that **generate lots of information** about the map; making **plans that narrow down the position of the Wumpus quickly**; making plans that only shoot where a previous shot could not have reached the Wumpus.

– [ ] Note that these are just hints; you are welcome to use any approach you like to solve this, as long as it is correct and runs within the allowed time.

– [ ] While debugging you should **add printing** to your Prolog code so you can **get a log of what it happening**.

– [ ] If you **add a trace goal** into your code for **guess** or **updateState** then you can see the calls made to your code from the test suite, and you can use **debugging** to step through the computation.

1. Find the Wumpus:
2. Move to and shoot the Wumpus:

#### State

– a representation of the map
– current position and direction
– Visited parts | Not visited part
– pit
– wall
– a representation of shots you have previously taken
– Which position? Which direction?
– a representation of where the Wumpus could possibly be or not be
– (Found Wumpus?)
– ……

#### Actions

– north
– south
– west
– east
– shoot

#### Guess

– which direction can I go?
– canMove?

#### canShoot

– 如果同方向,被包围,中间没有墙,绝对不射
– shoot的方向上确定没有Wunpus —> no
– 有没有墙壁挡着?

#### findPath

– Escape pit
– Escape wumpus

– 注意 execution order 来保证 efficiency (比如一大堆判断的时候)