资源简介
人工智能伯克利大学经典作业pacman吃豆人python源代码
代码片段和文件信息
# api.py
# parsons/07-oct-2017
#
# Version 1.1
#
# An API for use with the PacMan AI projects from:
#
# http://ai.berkeley.edu/
#
# This provides a simple way of controlling the way that Pacman moves
# and senses its world to permit exercises with limited sensing
# ability and nondeterminism in sensing and action.
#
# As required by the licensing agreement for the PacMan AI we have:
#
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions (2) you retain this notice and (3) you provide clear
# attribution to UC Berkeley including a link to http://ai.berkeley.edu.
#
# Attribution Information: The Pacman AI projects were developed at UC Berkeley.
# The core projects and autograders were primarily created by John DeNero
# (denero@cs.berkeley.edu) and Dan Klein (klein@cs.berkeley.edu).
# Student side autograding was added by Brad Miller Nick Hay and
# Pieter Abbeel (pabbeel@cs.berkeley.edu).
# The code here was written by Simon Parsons based on examples from
# the PacMan AI projects.
# Sensing
def whereAmI(state):
# Retunrs an (x y) pair of Pacman‘s position.
#
# This version says exactly where Pacman is.
# In later version this may be obfusticated.
return state.getPacmanPosition()
def legalActions(state):
# Returns the legal set of actions
#
# Just pulls this data out of the state. Functin included so that
# all interactions are through this API.
return state.getLegalPacmanActions()
def ghosts(state):
# Returns a list of (x y) pairs of ghost positions.
#
# This version just returns the ghost positions from the state data
# In later versions this will be more restricted and include some
# uncertainty.
return state.getGhostPositions()
def capsules(state):
# Returns a list of (x y) pairs of capsule positions.
#
# This version just returns the capsule positions from the state data
# In later versions this will be more restricted and include some
# uncertainty.
return state.getCapsules()
def food(state):
# Returns a list of (x y) pairs of food positions
#
# This version just returns all the current food locations
# extracted from the state data. In later versions this will be
# restricted by distance and include some uncertainty.
foodList= []
foodGrid = state.getFood()
width = foodGrid.width
height = foodGrid.height
for i in range(width):
for j in range(height):
if foodGrid[i][j] == True:
foodList.append((i j))
return foodList
def walls(state):
# Returns a list of (x y) pairs of wall positions
#
# This version just returns all the current wall locations
# extracted from the state data. In later versions this will be
# restricted by distance and include some uncertainty.
wallList= []
wallGrid = state.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-10-18 20:00 pacman\
文件 26331 2017-09-28 21:28 pacman\pacman.py
目录 0 2018-10-19 21:39 __MACOSX\
目录 0 2018-10-19 21:39 __MACOSX\pacman\
文件 212 2017-09-28 21:28 __MACOSX\pacman\._pacman.py
文件 2116 2017-09-28 21:28 pacman\pacmanAgents.py
文件 212 2017-09-28 21:28 __MACOSX\pacman\._pacmanAgents.py
文件 24313 2018-10-18 19:34 pacman\game.pyc
文件 28031 2017-09-28 21:28 pacman\graphicsDisplay.py
文件 212 2017-09-28 21:28 __MACOSX\pacman\._graphicsDisplay.py
文件 10572 2017-09-28 21:28 pacman\grading.py
文件 212 2017-09-28 21:28 __MACOSX\pacman\._grading.py
文件 4739 2018-10-18 19:43 pacman\sampleAgents.py
文件 3511 2018-10-18 19:34 pacman\ghostAgents.pyc
文件 26645 2017-09-28 21:28 pacman\util.py
文件 212 2017-09-28 21:28 __MACOSX\pacman\._util.py
文件 25518 2017-09-28 21:28 pacman\game.py
文件 212 2017-09-28 21:28 __MACOSX\pacman\._game.py
目录 0 2017-09-28 21:28 pacman\test_cases\
文件 32 2017-09-28 21:28 pacman\test_cases\CONFIG
目录 0 2018-10-19 21:39 __MACOSX\pacman\test_cases\
文件 212 2017-09-28 21:28 __MACOSX\pacman\test_cases\._CONFIG
目录 0 2017-09-28 21:28 pacman\test_cases\q8\
文件 103 2017-09-28 21:28 pacman\test_cases\q8\closest_dot_3.test
目录 0 2018-10-19 21:39 __MACOSX\pacman\test_cases\q8\
文件 212 2017-09-28 21:28 __MACOSX\pacman\test_cases\q8\._closest_dot_3.test
文件 87 2017-09-28 21:28 pacman\test_cases\q8\closest_dot_5.solution
文件 212 2017-09-28 21:28 __MACOSX\pacman\test_cases\q8\._closest_dot_5.solution
文件 87 2017-09-28 21:28 pacman\test_cases\q8\closest_dot_4.solution
文件 212 2017-09-28 21:28 __MACOSX\pacman\test_cases\q8\._closest_dot_4.solution
文件 160 2017-09-28 21:28 pacman\test_cases\q8\closest_dot_11.test
............此处省略400个文件信息
- 上一篇:幂法的python实现
- 下一篇:15.时间序列预测LSTM模型python代码实现
相关资源
- python实现SGBM图像匹配算法
- python实现灰度直方图均衡化
- scrapy_qunar_one
- Python学习全系列教程永久可用
- python简明教程.chm
- 抽奖大转盘python的图形化界面
- 双边滤波器实验报告及代码python
- python +MYSQL+HTML实现21蛋糕网上商城
- Python-直播答题助手自动检测出题搜索
- OpenCV入门教程+OpenCV官方教程中文版
- Python 串口工具源码+.exe文件
- Python开发的全栈股票系统.zip
- Python操作Excel表格并将其中部分数据写
- python书籍 PDF
- 利用python绘制散点图
- python+labview+No1.vi
- 老男孩python项目实战
- python源码制作whl文件.rar
- python3.5可用的scipy
- PYTHON3 经典50案例.pptx
- 计算机科学导论-python.pdf
- python模拟鼠标点击屏幕
- windows鼠标自动点击py脚本
- 鱼c小甲鱼零基础学python全套课后题和
- Python 练习题100道
- Practical Programming 2nd Edition
- wxPython Application Development Cookbook
- python 3.6
- Python 3.5.2 中文文档 互联网唯一CHM版本
- python3.5.2.chm官方文档
评论
共有 条评论