资源简介
人工智能伯克利大学经典作业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支持库
- Python-BDD100K大规模多样化驾驶视频数据
- Instant Pygame for Python Game Development How
- Biopython Tutorial
- Think Python 2nd
- 一个小小的表白程序(python)
- Python课堂笔记(高淇400集第一季)
- 二级考试python试题12套(包括选择题和
- pywin32_python3.6_64位
- python+ selenium教程
- PycURL(Windows7/Win32)Python2.7安装包 P
- 英文原版-Scientific Computing with Python
- 7.图像风格迁移 基于深度学习 pyt
- 基于Python的学生管理系统
- A Byte of Python(简明Python教程)(第
- Python实例174946
- Python 人脸识别
- Python 人事管理系统
- 基于python-flask的个人博客系统
- 计算机视觉应用开发流程
- python 调用sftp断点续传文件
- python socket游戏
- 基于Python爬虫爬取天气预报信息
- python函数编程和讲解
- Python开发的个人博客
- 基于python的三层神经网络模型搭建
- python实现自动操作windows应用
- python人脸识别(opencv)
- python 绘图(方形、线条、圆形)
- python疫情卡UN管控
评论
共有 条评论