Skip to content

Commit

Permalink
intro_tutorial: Don't initialize agents with an unique_id
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutH committed Sep 21, 2024
1 parent 7037a32 commit b8be5fc
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions docs/tutorials/intro_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@
" super().__init__()\n",
" self.num_agents = N\n",
" # Create agents\n",
" for i in range(self.num_agents):\n",
" a = MoneyAgent(i, self)"
" for _ in range(self.num_agents):\n",
" a = MoneyAgent(self)"
]
},
{
Expand Down Expand Up @@ -284,8 +284,8 @@
" self.schedule = mesa.time.RandomActivation(self)\n",
"\n",
" # Create agents\n",
" for i in range(self.num_agents):\n",
" a = MoneyAgent(i, self)\n",
" for _ in range(self.num_agents):\n",
" a = MoneyAgent(self)\n",
" # Add the agent to the scheduler\n",
" self.schedule.add(a)\n",
"\n",
Expand Down Expand Up @@ -464,7 +464,7 @@
"outputs": [],
"source": [
"model = MoneyModel(10)\n",
"for i in range(10):\n",
"for _ in range(10):\n",
" model.step()"
]
},
Expand Down Expand Up @@ -511,10 +511,10 @@
"source": [
"all_wealth = []\n",
"# This runs the model 100 times, each model executing 10 steps.\n",
"for j in range(100):\n",
"for _ in range(100):\n",
" # Run the model\n",
" model = MoneyModel(10)\n",
" for i in range(10):\n",
" for _ in range(10):\n",
" model.step()\n",
"\n",
" # Store the results\n",
Expand Down Expand Up @@ -573,8 +573,8 @@
" self.schedule = mesa.time.RandomActivation(self)\n",
"\n",
" # Create agents\n",
" for i in range(self.num_agents):\n",
" a = MoneyAgent(i, self)\n",
" for _ in range(self.num_agents):\n",
" a = MoneyAgent(self)\n",
" self.schedule.add(a)\n",
"\n",
" # Add the agent to a random grid cell\n",
Expand Down Expand Up @@ -686,8 +686,8 @@
" self.grid = mesa.space.MultiGrid(width, height, True)\n",
" self.schedule = mesa.time.RandomActivation(self)\n",
" # Create agents\n",
" for i in range(self.num_agents):\n",
" a = MoneyAgent(i, self)\n",
" for _ in range(self.num_agents):\n",
" a = MoneyAgent(self)\n",
" self.schedule.add(a)\n",
" # Add the agent to a random grid cell\n",
" x = self.random.randrange(self.grid.width)\n",
Expand All @@ -712,7 +712,7 @@
"outputs": [],
"source": [
"model = MoneyModel(100, 10, 10)\n",
"for i in range(20):\n",
"for _ in range(20):\n",
" model.step()"
]
},
Expand Down Expand Up @@ -810,8 +810,8 @@
" self.schedule = mesa.time.RandomActivation(self)\n",
"\n",
" # Create agents\n",
" for i in range(self.num_agents):\n",
" a = MoneyAgent(i, self)\n",
" for _ in range(self.num_agents):\n",
" a = MoneyAgent(self)\n",
" self.schedule.add(a)\n",
" # Add the agent to a random grid cell\n",
" x = self.random.randrange(self.grid.width)\n",
Expand Down Expand Up @@ -845,7 +845,7 @@
"outputs": [],
"source": [
"model = MoneyModel(100, 10, 10)\n",
"for i in range(100):\n",
"for _ in range(100):\n",
" model.step()"
]
},
Expand Down Expand Up @@ -1052,8 +1052,8 @@
" self.running = True\n",
"\n",
" # Create agents\n",
" for i in range(self.num_agents):\n",
" a = MoneyAgent(i, self)\n",
" for _ in range(self.num_agents):\n",
" a = MoneyAgent(self)\n",
" self.schedule.add(a)\n",
" # Add the agent to a random grid cell\n",
" x = self.random.randrange(self.grid.width)\n",
Expand Down

0 comments on commit b8be5fc

Please sign in to comment.