@@ -504,42 +504,6 @@ class SingleGrid(_Grid):
504504 torus: Boolean which determines whether to treat the grid as a torus.
505505 """
506506
507- def position_agent (
508- self , agent : Agent , x : int | str = "random" , y : int | str = "random"
509- ) -> None :
510- """Position an agent on the grid.
511- This is used when first placing agents! Setting either x or y to "random"
512- gives the same behavior as 'move_to_empty()' to get a random position.
513- If x or y are positive, they are used.
514- Use 'swap_pos()' to swap agents positions.
515- """
516- warn (
517- (
518- "`position_agent` is being deprecated; use instead "
519- "`place_agent` to place an agent at a specified "
520- "location or `move_to_empty` to place an agent "
521- "at a random empty cell."
522- ),
523- DeprecationWarning ,
524- )
525-
526- if not (isinstance (x , int ) or x == "random" ):
527- raise Exception (
528- "x must be an integer or a string 'random'."
529- f" Actual type: { type (x )} . Actual value: { x } ."
530- )
531- if not (isinstance (y , int ) or y == "random" ):
532- raise Exception (
533- "y must be an integer or a string 'random'."
534- f" Actual type: { type (y )} . Actual value: { y } ."
535- )
536-
537- if x == "random" or y == "random" :
538- self .move_to_empty (agent )
539- else :
540- coords = (x , y )
541- self .place_agent (agent , coords )
542-
543507 def place_agent (self , agent : Agent , pos : Coordinate ) -> None :
544508 """Place the agent at the specified location, and set its pos variable."""
545509 if self .is_cell_empty (pos ):
0 commit comments