From 4d2f58362a83fa346524ab43da58be71f54c0175 Mon Sep 17 00:00:00 2001 From: Dragneel7 Date: Fri, 15 Dec 2017 22:39:20 +0530 Subject: [PATCH] fix typo for issue#664 --- agents.ipynb | 74 ++++++++++++++++++---------------------------------- agents.py | 2 +- 2 files changed, 26 insertions(+), 50 deletions(-) diff --git a/agents.ipynb b/agents.ipynb index 968c8cdc9..6c547ee6c 100644 --- a/agents.ipynb +++ b/agents.ipynb @@ -17,7 +17,6 @@ "cell_type": "code", "execution_count": 1, "metadata": { - "collapsed": false, "scrolled": true }, "outputs": [], @@ -44,9 +43,7 @@ { "cell_type": "code", "execution_count": 2, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -83,9 +80,7 @@ { "cell_type": "code", "execution_count": 3, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class Food(Thing):\n", @@ -156,9 +151,7 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "class BlindDog(Agent):\n", @@ -195,15 +188,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Lets now run our simulation by creating a park with some food, water, and our dog." + "Let's now run our simulation by creating a park with some food, water, and our dog." ] }, { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -235,15 +226,13 @@ "source": [ "Notice that the dog moved from location 1 to 4, over 4 steps, and ate food at location 5 in the 5th step.\n", "\n", - "Lets continue this simulation for 5 more steps." + "Let's continue this simulation for 5 more steps." ] }, { "cell_type": "code", "execution_count": 6, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -263,15 +252,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Perfect! Note how the simulation stopped after the dog drank the water - exhausting all the food and water ends our simulation, as we had defined before. Lets add some more water and see if our dog can reach it." + "Perfect! Note how the simulation stopped after the dog drank the water - exhausting all the food and water ends our simulation, as we had defined before. Let's add some more water and see if our dog can reach it." ] }, { "cell_type": "code", "execution_count": 7, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -298,7 +285,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This is how to implement an agent, its program, and environment. However, this was a very simple case. Lets try a 2-Dimentional environment now with multiple agents.\n", + "This is how to implement an agent, its program, and environment. However, this was a very simple case. Let's try a 2-Dimentional environment now with multiple agents.\n", "\n", "\n", "# 2D Environment #\n", @@ -349,8 +336,8 @@ " return dead_agents or no_edibles\n", "\n", "class BlindDog(Agent):\n", - " location = [0,1]# change location to a 2d value\n", - " direction = Direction(\"down\")# variable to store the direction our dog is facing\n", + " location = [0,1] # change location to a 2d value\n", + " direction = Direction(\"down\") # variable to store the direction our dog is facing\n", " \n", " def movedown(self):\n", " self.location[1] += 1\n", @@ -381,15 +368,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now lets test this new park with our same dog, food and water" + "Now let's test this new park with our same dog, food and water" ] }, { "cell_type": "code", "execution_count": 9, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -436,7 +421,7 @@ "\n", "# PROGRAM - EnergeticBlindDog #\n", "\n", - "Lets make our dog turn or move forwards at random - except when he's at the edge of our park - in which case we make him change his direction explicitly by turning to avoid trying to leave the park. Our dog is blind, however, so he wouldn't know which way to turn - he'd just have to try arbitrarily.\n", + "Let's make our dog turn or move forwards at random - except when he's at the edge of our park - in which case we make him change his direction explicitly by turning to avoid trying to leave the park. Our dog is blind, however, so he wouldn't know which way to turn - he'd just have to try arbitrarily.\n", "\n", "\n", " \n", @@ -471,14 +456,12 @@ { "cell_type": "code", "execution_count": 10, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "from random import choice\n", "\n", - "turn = False# global variable to remember to turn if our dog hits the boundary\n", + "turn = False # global variable to remember to turn if our dog hits the boundary\n", "class EnergeticBlindDog(Agent):\n", " location = [0,1]\n", " direction = Direction(\"down\")\n", @@ -611,9 +594,7 @@ { "cell_type": "code", "execution_count": 12, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -653,7 +634,7 @@ "park.add_thing(water, [2,1])\n", "morewater = Water()\n", "park.add_thing(morewater, [0,2])\n", - "print('dog started at [0,0], facing down. Lets see if he found any food or water!')\n", + "print(\"dog started at [0,0], facing down. Let's see if he found any food or water!\")\n", "park.run(20)" ] }, @@ -661,7 +642,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This is good, but it still lacks graphics. What if we wanted to visualize our park as it changed? To do that, all we have to do is make our park a subclass of GraphicEnvironment instead of XYEnvironment. Lets see how this looks." + "This is good, but it still lacks graphics. What if we wanted to visualize our park as it changed? To do that, all we have to do is make our park a subclass of GraphicEnvironment instead of XYEnvironment. Let's see how this looks." ] }, { @@ -739,7 +720,6 @@ "cell_type": "code", "execution_count": 19, "metadata": { - "collapsed": false, "scrolled": true }, "outputs": [ @@ -1155,7 +1135,7 @@ "morefood = Food()\n", "park.add_thing(morewater, [2,4])\n", "park.add_thing(morefood, [4,3])\n", - "print('dog started at [0,0], facing down. Lets see if he found any food or water!')\n", + "print(\"dog started at [0,0], facing down. Let's see if he found any food or water!\")\n", "park.run(20)" ] }, @@ -1177,9 +1157,7 @@ { "cell_type": "code", "execution_count": 4, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "from ipythonblocks import BlockGrid\n", @@ -1221,9 +1199,7 @@ { "cell_type": "code", "execution_count": 5, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [ { "data": { @@ -1276,9 +1252,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.3" + "version": "3.5.4rc1" } }, "nbformat": 4, - "nbformat_minor": 0 + "nbformat_minor": 1 } diff --git a/agents.py b/agents.py index db93ca795..9308225f2 100644 --- a/agents.py +++ b/agents.py @@ -299,7 +299,7 @@ def some_things_at(self, location, tclass=Thing): def add_thing(self, thing, location=None): """Add a thing to the environment, setting its location. For convenience, if thing is an agent program we make a new agent - for it. (Shouldn't need to override this.""" + for it. (Shouldn't need to override this.)""" if not isinstance(thing, Thing): thing = Agent(thing) if thing in self.things: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy