Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28f413f

Browse files
Dragneel7norvig
authored andcommitted
fix typo for issue#664 (aimacode#665)
1 parent 7614b29 commit 28f413f

File tree

2 files changed

+26
-50
lines changed

2 files changed

+26
-50
lines changed

agents.ipynb

Lines changed: 25 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
"cell_type": "code",
1818
"execution_count": 1,
1919
"metadata": {
20-
"collapsed": false,
2120
"scrolled": true
2221
},
2322
"outputs": [],
@@ -44,9 +43,7 @@
4443
{
4544
"cell_type": "code",
4645
"execution_count": 2,
47-
"metadata": {
48-
"collapsed": false
49-
},
46+
"metadata": {},
5047
"outputs": [
5148
{
5249
"name": "stdout",
@@ -83,9 +80,7 @@
8380
{
8481
"cell_type": "code",
8582
"execution_count": 3,
86-
"metadata": {
87-
"collapsed": false
88-
},
83+
"metadata": {},
8984
"outputs": [],
9085
"source": [
9186
"class Food(Thing):\n",
@@ -156,9 +151,7 @@
156151
{
157152
"cell_type": "code",
158153
"execution_count": 4,
159-
"metadata": {
160-
"collapsed": false
161-
},
154+
"metadata": {},
162155
"outputs": [],
163156
"source": [
164157
"class BlindDog(Agent):\n",
@@ -195,15 +188,13 @@
195188
"cell_type": "markdown",
196189
"metadata": {},
197190
"source": [
198-
"Lets now run our simulation by creating a park with some food, water, and our dog."
191+
"Let's now run our simulation by creating a park with some food, water, and our dog."
199192
]
200193
},
201194
{
202195
"cell_type": "code",
203196
"execution_count": 5,
204-
"metadata": {
205-
"collapsed": false
206-
},
197+
"metadata": {},
207198
"outputs": [
208199
{
209200
"name": "stdout",
@@ -235,15 +226,13 @@
235226
"source": [
236227
"Notice that the dog moved from location 1 to 4, over 4 steps, and ate food at location 5 in the 5th step.\n",
237228
"\n",
238-
"Lets continue this simulation for 5 more steps."
229+
"Let's continue this simulation for 5 more steps."
239230
]
240231
},
241232
{
242233
"cell_type": "code",
243234
"execution_count": 6,
244-
"metadata": {
245-
"collapsed": false
246-
},
235+
"metadata": {},
247236
"outputs": [
248237
{
249238
"name": "stdout",
@@ -263,15 +252,13 @@
263252
"cell_type": "markdown",
264253
"metadata": {},
265254
"source": [
266-
"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."
255+
"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."
267256
]
268257
},
269258
{
270259
"cell_type": "code",
271260
"execution_count": 7,
272-
"metadata": {
273-
"collapsed": false
274-
},
261+
"metadata": {},
275262
"outputs": [
276263
{
277264
"name": "stdout",
@@ -298,7 +285,7 @@
298285
"cell_type": "markdown",
299286
"metadata": {},
300287
"source": [
301-
"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",
288+
"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",
302289
"\n",
303290
"\n",
304291
"# 2D Environment #\n",
@@ -349,8 +336,8 @@
349336
" return dead_agents or no_edibles\n",
350337
"\n",
351338
"class BlindDog(Agent):\n",
352-
" location = [0,1]# change location to a 2d value\n",
353-
" direction = Direction(\"down\")# variable to store the direction our dog is facing\n",
339+
" location = [0,1] # change location to a 2d value\n",
340+
" direction = Direction(\"down\") # variable to store the direction our dog is facing\n",
354341
" \n",
355342
" def movedown(self):\n",
356343
" self.location[1] += 1\n",
@@ -381,15 +368,13 @@
381368
"cell_type": "markdown",
382369
"metadata": {},
383370
"source": [
384-
"Now lets test this new park with our same dog, food and water"
371+
"Now let's test this new park with our same dog, food and water"
385372
]
386373
},
387374
{
388375
"cell_type": "code",
389376
"execution_count": 9,
390-
"metadata": {
391-
"collapsed": false
392-
},
377+
"metadata": {},
393378
"outputs": [
394379
{
395380
"name": "stdout",
@@ -436,7 +421,7 @@
436421
"\n",
437422
"# PROGRAM - EnergeticBlindDog #\n",
438423
"\n",
439-
"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",
424+
"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",
440425
"\n",
441426
"<table>\n",
442427
" <tr>\n",
@@ -471,14 +456,12 @@
471456
{
472457
"cell_type": "code",
473458
"execution_count": 10,
474-
"metadata": {
475-
"collapsed": false
476-
},
459+
"metadata": {},
477460
"outputs": [],
478461
"source": [
479462
"from random import choice\n",
480463
"\n",
481-
"turn = False# global variable to remember to turn if our dog hits the boundary\n",
464+
"turn = False # global variable to remember to turn if our dog hits the boundary\n",
482465
"class EnergeticBlindDog(Agent):\n",
483466
" location = [0,1]\n",
484467
" direction = Direction(\"down\")\n",
@@ -611,9 +594,7 @@
611594
{
612595
"cell_type": "code",
613596
"execution_count": 12,
614-
"metadata": {
615-
"collapsed": false
616-
},
597+
"metadata": {},
617598
"outputs": [
618599
{
619600
"name": "stdout",
@@ -653,15 +634,15 @@
653634
"park.add_thing(water, [2,1])\n",
654635
"morewater = Water()\n",
655636
"park.add_thing(morewater, [0,2])\n",
656-
"print('dog started at [0,0], facing down. Lets see if he found any food or water!')\n",
637+
"print(\"dog started at [0,0], facing down. Let's see if he found any food or water!\")\n",
657638
"park.run(20)"
658639
]
659640
},
660641
{
661642
"cell_type": "markdown",
662643
"metadata": {},
663644
"source": [
664-
"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 <b>GraphicEnvironment</b> instead of <b>XYEnvironment</b>. Lets see how this looks."
645+
"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 <b>GraphicEnvironment</b> instead of <b>XYEnvironment</b>. Let's see how this looks."
665646
]
666647
},
667648
{
@@ -739,7 +720,6 @@
739720
"cell_type": "code",
740721
"execution_count": 19,
741722
"metadata": {
742-
"collapsed": false,
743723
"scrolled": true
744724
},
745725
"outputs": [
@@ -1155,7 +1135,7 @@
11551135
"morefood = Food()\n",
11561136
"park.add_thing(morewater, [2,4])\n",
11571137
"park.add_thing(morefood, [4,3])\n",
1158-
"print('dog started at [0,0], facing down. Lets see if he found any food or water!')\n",
1138+
"print(\"dog started at [0,0], facing down. Let's see if he found any food or water!\")\n",
11591139
"park.run(20)"
11601140
]
11611141
},
@@ -1177,9 +1157,7 @@
11771157
{
11781158
"cell_type": "code",
11791159
"execution_count": 4,
1180-
"metadata": {
1181-
"collapsed": false
1182-
},
1160+
"metadata": {},
11831161
"outputs": [],
11841162
"source": [
11851163
"from ipythonblocks import BlockGrid\n",
@@ -1221,9 +1199,7 @@
12211199
{
12221200
"cell_type": "code",
12231201
"execution_count": 5,
1224-
"metadata": {
1225-
"collapsed": false
1226-
},
1202+
"metadata": {},
12271203
"outputs": [
12281204
{
12291205
"data": {
@@ -1276,9 +1252,9 @@
12761252
"name": "python",
12771253
"nbconvert_exporter": "python",
12781254
"pygments_lexer": "ipython3",
1279-
"version": "3.4.3"
1255+
"version": "3.5.4rc1"
12801256
}
12811257
},
12821258
"nbformat": 4,
1283-
"nbformat_minor": 0
1259+
"nbformat_minor": 1
12841260
}

agents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def some_things_at(self, location, tclass=Thing):
299299
def add_thing(self, thing, location=None):
300300
"""Add a thing to the environment, setting its location. For
301301
convenience, if thing is an agent program we make a new agent
302-
for it. (Shouldn't need to override this."""
302+
for it. (Shouldn't need to override this.)"""
303303
if not isinstance(thing, Thing):
304304
thing = Agent(thing)
305305
if thing in self.things:

0 commit comments

Comments
 (0)