bustersAgents
.py
keyboard_arrow_up
School
University of California, Berkeley *
*We aren’t endorsed by this school
Course
188
Subject
Computer Science
Date
Apr 26, 2024
Type
py
Pages
3
Uploaded by ElderMongoose4017 on coursehero.com
# bustersAgents.py
# ----------------
# 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).
import util
from util import raiseNotDefined
from game import Agent
from game import Directions
from keyboardAgents import KeyboardAgent
import inference
import busters
class NullGraphics:
"Placeholder for graphics"
def initialize(self, state, isBlue = False):
pass
def update(self, state):
pass
def pause(self):
pass
def draw(self, state):
pass
def updateDistributions(self, dist):
pass
def finish(self):
pass
class KeyboardInference(inference.InferenceModule):
"""
Basic inference module for use with the keyboard.
"""
def initializeUniformly(self, gameState):
"Begin with a uniform distribution over ghost positions."
self.beliefs = util.Counter()
for p in self.legalPositions: self.beliefs[p] = 1.0
self.beliefs.normalize()
def observeUpdate(self, observation, gameState):
noisyDistance = observation
pacmanPosition = gameState.getPacmanPosition()
allPossible = util.Counter()
for p in self.legalPositions:
trueDistance = util.manhattanDistance(p, pacmanPosition)
if noisyDistance != None and \
busters.getObservationProbability(noisyDistance, trueDistance) > 0:
allPossible[p] = 1.0
allPossible.normalize()
self.beliefs = allPossible
def elapseTime(self, gameState):
pass
def getBeliefDistribution(self):
return self.beliefs
class BustersAgent:
"An agent that tracks and displays its beliefs about ghost positions."
def __init__( self, index = 0, inference = "ExactInference", ghostAgents = None, observeEnable = True, elapseTimeEnable = True):
try:
inferenceType = util.lookup(inference, globals())
except Exception:
inferenceType = util.lookup('inference.' + inference, globals())
self.inferenceModules = [inferenceType(a) for a in ghostAgents]
self.observeEnable = observeEnable
self.elapseTimeEnable = elapseTimeEnable
def registerInitialState(self, gameState):
"Initializes beliefs and inference modules"
import __main__
self.display = __main__._display
for inference in self.inferenceModules:
inference.initialize(gameState)
self.ghostBeliefs = [inf.getBeliefDistribution() for inf in self.inferenceModules]
self.firstMove = True
def observationFunction(self, gameState):
"Removes the ghost states from the gameState"
agents = gameState.data.agentStates
gameState.data.agentStates = [agents[0]] + [None for i in range(1, len(agents))]
return gameState
def getAction(self, gameState):
"Updates beliefs, then chooses an action based on updated beliefs."
for index, inf in enumerate(self.inferenceModules):
if not self.firstMove and self.elapseTimeEnable:
inf.elapseTime(gameState)
self.firstMove = False
if self.observeEnable:
inf.observe(gameState)
self.ghostBeliefs[index] = inf.getBeliefDistribution()
self.display.updateDistributions(self.ghostBeliefs)
return self.chooseAction(gameState)
def chooseAction(self, gameState):
"By default, a BustersAgent just stops. This should be overridden."
return Directions.STOP
class BustersKeyboardAgent(BustersAgent, KeyboardAgent):
"An agent controlled by the keyboard that displays beliefs about ghost positions."
def __init__(self, index = 0, inference = "KeyboardInference", ghostAgents =
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
user stories
I need 5 user stories about Online Crime Management for my project
For example, user stories might look like that:As a police officer, i would like to be able to check for past records with an ID number(like a passport), so that I don’t have to use the name of the person
arrow_forward
Submitting: Each INDIVIDUAL should submit his/her work online, both source code and output screenshots. All assignments should be submitted ON TIME.
Collaboration among students is strongly encouraged. It is legal to get approaches and ideas from students, the internet, etc.
However, it is ILLEGAL to get a code (if a part of the code is submitted by two or more students, ALL are guilty of cheating).
Any minor cheating will not be tolerated
arrow_forward
ER diagram for the following use cases:
Intro/Homepage: This first case will be used to give the user the first look at what the whole project is about. They see the beginning stage and interact with all the links to the movies, characters, and descriptions.
Browse MCU Shows: This case will be for the customers and users to be able to navigate through the feature and see what they are specifically. They can use it to find which exact Marvel Cinematic Universe movie/show they wish to watch and see what character they like.
View MCU Movie Details: This case will be for users to get more information about specific Marvel movies/shows. It will give more details like the cast, the run time, the review score, the characters involved and etc.
arrow_forward
Job portal system: This system allows the students to search and apply for jobs etc. online. The manager can use the system for posting and deleting job offers etc.
1.Create your own case study (problem statement) for the above application
arrow_forward
HCI project :
write at least 2 pages about the aspects related to the social and/or emotional interaction found in the chosen application .
arrow_forward
UI CRITIQUE
Good and Bad User Interface Design
The objective of this assignment is to critique the design of a user interfaces.
Find any TWO examples of DESIGN interfaces. Your examples should be
specific and different with others. It is very hard to find a large interface that is
completely good or completely bad, so don't try. Instead, focus on a particular
feature or aspect of the interface that makes your case. Find concrete reasons
for your judgment. Instead of providing reasoning based on the general design
principles, in this assignment, you must refer to usability goals and design
principles in lecture notes.
You are not limited to desktop software. Web sites offer many great candidates
for fame and shame. You aren't even limited to traditional computer interfaces.
Feel free to go out into the real world, and consider consumer appliances, car
dashboards, building entrances, traffic intersections, shower controls, mobile
phone etc. (Norman's book Design of Everyday Things…
arrow_forward
Userexperience Design concept.
Describe the worst interface that you have ever worked with and critique it relative to the concepts.
arrow_forward
Extreme Sports Web Site (Extreme Sports Web Site)
Extreme sports include activities that are considered to have a high degree of intrinsic risk, such as BMX racing, skate boarding, mountain biking, ice climbing, and base jumping, among others. As a lifelong enthusiast, you started selling hats and t-shirts with extreme sports themes, personalities, and inspiring sayings to raise money for charity. As a consequence, you have had the pleasure of travelling to many exotic locations across the globe over the last two years in order to sell your very successful goods at a variety of events and contests. When it comes to selling your goods to extreme sports enthusiasts all over the world, you're considering launching a Web site.
What difficulties could you encounter while attempting to distribute your goods to consumers in another country?
arrow_forward
Job portal system: This system allows the students to search and apply for jobs etc. online. The manager can use the system for posting and deleting job offers etc.
Create your own case study (problem statement) for the above application and
Draw the use case diagram
arrow_forward
Problem Statement
You are required to Download and Install the Hello theme into your WordPress site. After theme installation, you are required to Import the demo content of theme.
arrow_forward
How-tos for Microsoft Word The paper's name. As a connection, you might provide a hyperlink to an external file.
arrow_forward
Code to write:
Create JavaScript object array for Students with Id, Name, Program, GPA, Age.
How to submit:
Copy the code in the answer section.
BI
A
三 E
arrow_forward
Computer Graphics:
Using Unreal Engine or any CGI Software provide two rendered objects in which at least five(5) of the following techniques are realized.
Sphere , Materials , Point Lighting , Spot Lighting , Directional Lighting , Ambient Lighting , Recursive Depth , Soft Shadow , Transparent Object , Depth of Field , Motion Blur , Texture Mapping and 3D Transformation
There is no restriction on what techniques you choose to demonstrate, nor on the scene you choose to develop, but you must submit the following.
A still rendered image, provided as a *.jpg or *.png file
A five to ten (5-10) second animation clip, provided as an *.mpg or suitable video formatted file.
arrow_forward
Add a research method
Research MethodsHere you should describe the methodologies that you are employed in your project and the sources that you used. Basic to most projects will be online searches for materials such as web pages, articles, videos, and blogs. Social media such as Twitter or Facebook may play a role. Personal interviews with important people knowledgeable in your topic may be included. In some cases, it may be a good idea to do a survey. Include information on matchups between your sources and the stakeholders that you have identified and whose viewpoints are represented. Describe specifically how the researchmethods tie in with how you are advancing your project.
arrow_forward
Explain the concept of accessibility in user interface design. What are some best practices for designing interfaces that are inclusive and accessible to users with disabilities?
arrow_forward
Login and Registration form using GUI Swing
arrow_forward
comments appreciated
arrow_forward
Excel is a program that is used to
prepare a
text document
database
O spreadsheets
slide presentations
arrow_forward
Before you utilize a file extension, find out what it is and why it's useful for your project.
arrow_forward
Please assist... thumbs up guaranteed if the solution is correct. thanks
arrow_forward
Assignment Content
Rock, Paper, Scissors
For your final project, you will need to design an interface of Rock Paper Scissors. Please click here for the directions. You should work by yourself first, but if you should run into any problems, the following videos will help.
Introduction
Interface Design
Determine Winner
Play Game
Input Validation
Please attach your project as a Python file
arrow_forward
– Ethical HackingLab #2 – Legal and Ethical
Overview
Write up a case that pertains to one of the laws mentioned in the course content or another law that is relevant to the cybersecurity landscape. Make sure to include your references. You should use what you learned about Google Hacking to find actual court documents that detail the case, the charges levied, and results of the case. Finding pertinent primary sources of information in this field can be quite a challenge.
Pick a case that has occurred in the last 7 years and summarize the main points of the case.
Explain which laws were cited in the case and go into detail about why they were applied. You may need to take a closer look at the law in question to describe this.
Explain the verdict of the case and your opinion of the ruling based on the law.
In your opinion, does the law need reform or will it still apply in the future. Why or why
arrow_forward
Extreme Sports Web SiteExtreme sports encompasses certain activities perceived as having a high level of inherent danger such as BMX racing, skate boarding, mountain biking, ice climbing, and base jumping. You’ve always been a major fan and began selling caps and t-shirts with extreme sport themes, personalities, and inspirational sayings. As a result, over the past two years you have enjoyed traveling to many exotic venues around the world to sell your highly popular products at various events and competitions. You are thinking of starting a Web site to sell your products to extreme sports fans around the globe.
What information do you need to capture from a customer in order to accurately and completely fill an order?
arrow_forward
Make a ‘contact us form’ concept and layout for a login website using c#
arrow_forward
how to do a works cited page
arrow_forward
Matching - Front End , Back End , Optimizations
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Microsoft Windows 10 Comprehensive 2019
Computer Science
ISBN:9780357392607
Author:FREUND
Publisher:Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Related Questions
- user stories I need 5 user stories about Online Crime Management for my project For example, user stories might look like that:As a police officer, i would like to be able to check for past records with an ID number(like a passport), so that I don’t have to use the name of the personarrow_forwardSubmitting: Each INDIVIDUAL should submit his/her work online, both source code and output screenshots. All assignments should be submitted ON TIME. Collaboration among students is strongly encouraged. It is legal to get approaches and ideas from students, the internet, etc. However, it is ILLEGAL to get a code (if a part of the code is submitted by two or more students, ALL are guilty of cheating). Any minor cheating will not be toleratedarrow_forwardER diagram for the following use cases: Intro/Homepage: This first case will be used to give the user the first look at what the whole project is about. They see the beginning stage and interact with all the links to the movies, characters, and descriptions. Browse MCU Shows: This case will be for the customers and users to be able to navigate through the feature and see what they are specifically. They can use it to find which exact Marvel Cinematic Universe movie/show they wish to watch and see what character they like. View MCU Movie Details: This case will be for users to get more information about specific Marvel movies/shows. It will give more details like the cast, the run time, the review score, the characters involved and etc.arrow_forward
- Job portal system: This system allows the students to search and apply for jobs etc. online. The manager can use the system for posting and deleting job offers etc. 1.Create your own case study (problem statement) for the above applicationarrow_forwardHCI project : write at least 2 pages about the aspects related to the social and/or emotional interaction found in the chosen application .arrow_forwardUI CRITIQUE Good and Bad User Interface Design The objective of this assignment is to critique the design of a user interfaces. Find any TWO examples of DESIGN interfaces. Your examples should be specific and different with others. It is very hard to find a large interface that is completely good or completely bad, so don't try. Instead, focus on a particular feature or aspect of the interface that makes your case. Find concrete reasons for your judgment. Instead of providing reasoning based on the general design principles, in this assignment, you must refer to usability goals and design principles in lecture notes. You are not limited to desktop software. Web sites offer many great candidates for fame and shame. You aren't even limited to traditional computer interfaces. Feel free to go out into the real world, and consider consumer appliances, car dashboards, building entrances, traffic intersections, shower controls, mobile phone etc. (Norman's book Design of Everyday Things…arrow_forward
- Userexperience Design concept. Describe the worst interface that you have ever worked with and critique it relative to the concepts.arrow_forwardExtreme Sports Web Site (Extreme Sports Web Site) Extreme sports include activities that are considered to have a high degree of intrinsic risk, such as BMX racing, skate boarding, mountain biking, ice climbing, and base jumping, among others. As a lifelong enthusiast, you started selling hats and t-shirts with extreme sports themes, personalities, and inspiring sayings to raise money for charity. As a consequence, you have had the pleasure of travelling to many exotic locations across the globe over the last two years in order to sell your very successful goods at a variety of events and contests. When it comes to selling your goods to extreme sports enthusiasts all over the world, you're considering launching a Web site. What difficulties could you encounter while attempting to distribute your goods to consumers in another country?arrow_forwardJob portal system: This system allows the students to search and apply for jobs etc. online. The manager can use the system for posting and deleting job offers etc. Create your own case study (problem statement) for the above application and Draw the use case diagramarrow_forward
- Problem Statement You are required to Download and Install the Hello theme into your WordPress site. After theme installation, you are required to Import the demo content of theme.arrow_forwardHow-tos for Microsoft Word The paper's name. As a connection, you might provide a hyperlink to an external file.arrow_forwardCode to write: Create JavaScript object array for Students with Id, Name, Program, GPA, Age. How to submit: Copy the code in the answer section. BI A 三 Earrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LMicrosoft Windows 10 Comprehensive 2019Computer ScienceISBN:9780357392607Author:FREUNDPublisher:Cengage
- Np Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:Cengage
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Microsoft Windows 10 Comprehensive 2019
Computer Science
ISBN:9780357392607
Author:FREUND
Publisher:Cengage
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage