Skip to content

Commit b8be5fc

Browse files
committed
intro_tutorial: Don't initialize agents with an unique_id
1 parent 7037a32 commit b8be5fc

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

docs/tutorials/intro_tutorial.ipynb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@
232232
" super().__init__()\n",
233233
" self.num_agents = N\n",
234234
" # Create agents\n",
235-
" for i in range(self.num_agents):\n",
236-
" a = MoneyAgent(i, self)"
235+
" for _ in range(self.num_agents):\n",
236+
" a = MoneyAgent(self)"
237237
]
238238
},
239239
{
@@ -284,8 +284,8 @@
284284
" self.schedule = mesa.time.RandomActivation(self)\n",
285285
"\n",
286286
" # Create agents\n",
287-
" for i in range(self.num_agents):\n",
288-
" a = MoneyAgent(i, self)\n",
287+
" for _ in range(self.num_agents):\n",
288+
" a = MoneyAgent(self)\n",
289289
" # Add the agent to the scheduler\n",
290290
" self.schedule.add(a)\n",
291291
"\n",
@@ -464,7 +464,7 @@
464464
"outputs": [],
465465
"source": [
466466
"model = MoneyModel(10)\n",
467-
"for i in range(10):\n",
467+
"for _ in range(10):\n",
468468
" model.step()"
469469
]
470470
},
@@ -511,10 +511,10 @@
511511
"source": [
512512
"all_wealth = []\n",
513513
"# This runs the model 100 times, each model executing 10 steps.\n",
514-
"for j in range(100):\n",
514+
"for _ in range(100):\n",
515515
" # Run the model\n",
516516
" model = MoneyModel(10)\n",
517-
" for i in range(10):\n",
517+
" for _ in range(10):\n",
518518
" model.step()\n",
519519
"\n",
520520
" # Store the results\n",
@@ -573,8 +573,8 @@
573573
" self.schedule = mesa.time.RandomActivation(self)\n",
574574
"\n",
575575
" # Create agents\n",
576-
" for i in range(self.num_agents):\n",
577-
" a = MoneyAgent(i, self)\n",
576+
" for _ in range(self.num_agents):\n",
577+
" a = MoneyAgent(self)\n",
578578
" self.schedule.add(a)\n",
579579
"\n",
580580
" # Add the agent to a random grid cell\n",
@@ -686,8 +686,8 @@
686686
" self.grid = mesa.space.MultiGrid(width, height, True)\n",
687687
" self.schedule = mesa.time.RandomActivation(self)\n",
688688
" # Create agents\n",
689-
" for i in range(self.num_agents):\n",
690-
" a = MoneyAgent(i, self)\n",
689+
" for _ in range(self.num_agents):\n",
690+
" a = MoneyAgent(self)\n",
691691
" self.schedule.add(a)\n",
692692
" # Add the agent to a random grid cell\n",
693693
" x = self.random.randrange(self.grid.width)\n",
@@ -712,7 +712,7 @@
712712
"outputs": [],
713713
"source": [
714714
"model = MoneyModel(100, 10, 10)\n",
715-
"for i in range(20):\n",
715+
"for _ in range(20):\n",
716716
" model.step()"
717717
]
718718
},
@@ -810,8 +810,8 @@
810810
" self.schedule = mesa.time.RandomActivation(self)\n",
811811
"\n",
812812
" # Create agents\n",
813-
" for i in range(self.num_agents):\n",
814-
" a = MoneyAgent(i, self)\n",
813+
" for _ in range(self.num_agents):\n",
814+
" a = MoneyAgent(self)\n",
815815
" self.schedule.add(a)\n",
816816
" # Add the agent to a random grid cell\n",
817817
" x = self.random.randrange(self.grid.width)\n",
@@ -845,7 +845,7 @@
845845
"outputs": [],
846846
"source": [
847847
"model = MoneyModel(100, 10, 10)\n",
848-
"for i in range(100):\n",
848+
"for _ in range(100):\n",
849849
" model.step()"
850850
]
851851
},
@@ -1052,8 +1052,8 @@
10521052
" self.running = True\n",
10531053
"\n",
10541054
" # Create agents\n",
1055-
" for i in range(self.num_agents):\n",
1056-
" a = MoneyAgent(i, self)\n",
1055+
" for _ in range(self.num_agents):\n",
1056+
" a = MoneyAgent(self)\n",
10571057
" self.schedule.add(a)\n",
10581058
" # Add the agent to a random grid cell\n",
10591059
" x = self.random.randrange(self.grid.width)\n",

0 commit comments

Comments
 (0)