墨尔本大学COMP20003Assignment2课业解析

题意: 
为Pacman吃豆人游戏实现AI算法寻找得分最高的策略 
解析: 
原游戏中,玩家控制Pacman在没有出口的迷宫里收集豆子dot(C表示玩家,‘.’表示豆子),尽可能得到更高的分。同时要躲避四个不同颜色的幽灵(&代表),碰到它们就会死亡(玩家有3条生命),敌人不会摧毁豆子,但会暂时占据豆子的位置,幽灵自动追杀Pacman。玩家并不是待宰的羔羊,迷宫里散布着一些水果(*表示),Pacman吃下水果后变身超人,在一定时间内所有幽灵会变成深蓝色并逃离Pacman,但它们速度更慢,Pacman可以杀死它们并获得高额奖励分。同一个水果持续的超人时间内,连续击杀幽灵奖励翻倍,第一个幽灵200分,第四个幽灵就是1600分。现在要求你实现给出的GraphSearch算法,为Pacman找到得分最高的路径。 
涉及知识点:
Dijkstra算法、图、队列 
更多可加V讨论 
题意: 
为Pacman吃豆人游戏实现AI算法寻找得分最高的策略 
解析: 
原游戏中,玩家控制Pacman在没有出口的迷宫里收集豆子dot(C表示玩家,‘.’表示豆子),尽可能得到更高的分。同时要躲避四个不同颜色的幽灵(&代表),碰到它们就会死亡(玩家有3条生命),敌人不会摧毁豆子,但会暂时占据豆子的位置,幽灵自动追杀Pacman。玩家并不是待宰的羔羊,迷宫里散布着一些水果(*表示),Pacman吃下水果后变身超人,在一定时间内所有幽灵会变成深蓝色并逃离Pacman,但它们速度更慢,Pacman可以杀死它们并获得高额奖励分。同一个水果持续的超人时间内,连续击杀幽灵奖励翻倍,第一个幽灵200分,第四个幽灵就是1600分。现在要求你实现给出的GraphSearch算法,为Pacman找到得分最高的路径。 
涉及知识点:
Dijkstra算法、图、队列 
更多可加微信讨论 
微信号g19963812037
V:luna619-
pdf 
COMP20003 Algorithms and Data Structures
Second (Spring) Semester 2019
[Assignment 2]
Solving Pac-Man:
online Graph Search
Handed out: Thursday, 10 of October
Due: 00:00, Thursday, 24 of
22 return bestAction
Figure 2: Online Graph algorithm variant of Dijkstra
Every time that you consider all the actions that can be applied for a given node, only use the ones
that will face Pac-Man towards a free tile. For example, in Figure 1 you should only consider the
actions Left, and Right.
When you applyAction you have to create a new node, that

  1. points to the parent,
  2. updates the state with the action chosen,
  3. updates the priority (used by the priority queue) of the node to be the negative node’s depth d

(if the node is the dth step of the path, then its priority is -d). This ensures the expansion of
the shortest paths first, as the priority queue provided is a max heap;

  1. updates the reward to be r(n) = (h(n) + score(n) - score(nParent)) × γd

(a) the heuristic value h(n) that biases the reward to account for losing lives and eating fruits,
plus
(b) the change in score from the current node and the parent node
(c) times a discount factor of γ = 0:99d, where d is the dept

你可能感兴趣的:(cs)