This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"An agent, as defined in 2.1 is anything that can perceive its <b>environment</b> through sensors, and act upon that environment through actuators based on its <b>agent program</b>. This can be a dog, robot, or even you. As long as you can perceive the environment and act on it, you are an agent. This notebook will explain how to implement a simple agent, create an environment, and create a program that helps the agent act on the environment based on its percepts.\n",
Expand All
@@ -17,6 +18,7 @@
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true,
"scrolled": true
},
"outputs": [],
Expand Down
Expand Up
@@ -80,7 +82,9 @@
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"class Food(Thing):\n",
Expand Down
Expand Up
@@ -151,7 +155,9 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"class BlindDog(Agent):\n",
Expand All
@@ -163,14 +169,12 @@
" def eat(self, thing):\n",
" '''returns True upon success or False otherwise'''\n",
" if isinstance(thing, Food):\n",
" #print(\"Dog: Ate food at {}.\".format(self.location))\n",
" return True\n",
" return False\n",
" \n",
" def drink(self, thing):\n",
" ''' returns True upon success or False otherwise'''\n",
" if isinstance(thing, Water):\n",
" #print(\"Dog: Drank water at {}.\".format(self.location))\n",
" return True\n",
" return False\n",
" \n",
Expand Down
Expand Up
@@ -456,7 +460,9 @@
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from random import choice\n",
Expand Down
Expand Up
@@ -487,14 +493,12 @@
" def eat(self, thing):\n",
" '''returns True upon success or False otherwise'''\n",
" if isinstance(thing, Food):\n",
" #print(\"Dog: Ate food at {}.\".format(self.location))\n",
" return True\n",
" return False\n",
" \n",
" def drink(self, thing):\n",
" ''' returns True upon success or False otherwise'''\n",
" if isinstance(thing, Water):\n",
" #print(\"Dog: Drank water at {}.\".format(self.location))\n",
" return True\n",
" return False\n",
" \n",
Expand Down
Expand Up
@@ -546,11 +550,9 @@
" if action == 'turnright':\n",
" print('{} decided to {} at location: {}'.format(str(agent)[1:-1], action, agent.location))\n",
" #print('{} at {} facing {}'.format(agent, loc, agent.direction.direction))\n",
" if self.is_inbounds(loc):# move only if the target is a valid location\n",
" print('{} decided to move {}wards at location: {}'.format(str(agent)[1:-1], agent.direction.direction, agent.location))\n",
" agent.moveforward()\n",
Expand Down
Expand Up
@@ -1157,7 +1155,9 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from ipythonblocks import BlockGrid\n",
Expand Down
Expand Up
@@ -1252,7 +1252,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4rc1"
"version": "3.6.4"
}
},
"nbformat": 4,
Expand Down
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove Commented codes in agents.ipynb #805
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Remove Commented codes in agents.ipynb #805
Filter by extension
Viewed files
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing