Skip to content

Commit

Permalink
fixed a typo
Browse files Browse the repository at this point in the history
  • Loading branch information
aadeshnpn committed Jun 2, 2021
1 parent e0e8f41 commit 80f2ace
Show file tree
Hide file tree
Showing 3 changed files with 419 additions and 414 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"Hub", "Sites"]

__title__ = 'swarms'
__version__ = '0.0.1'
__version__ = '1.0.1'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright %s Project swarm Team' % datetime.date.today().year
56 changes: 28 additions & 28 deletions swarms/behaviors/sbehaviors.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def update(self):
except KeyError:
self.blackboard.neighbourobj = dict()
self.blackboard.neighbourobj[name] = {item}
return common.common.Status.SUCCESS
return common.Status.SUCCESS
else:
return common.common.Status.FAILURE
return common.Status.FAILURE


class NeighbourObjectsDist(Behaviour):
Expand Down Expand Up @@ -221,9 +221,9 @@ def update(self):
self.blackboard.neighbourobj[name].add(item)
except KeyError:
self.blackboard.neighbourobj[name] = {item}
return common.common.Status.SUCCESS
return common.Status.SUCCESS
else:
return common.common.Status.FAILURE
return common.Status.FAILURE


class GoTo(Behaviour):
Expand Down Expand Up @@ -275,9 +275,9 @@ def update(self):
self.item, self.agent.name)[0]
self.agent.direction = get_direction(
objects.location, self.agent.location)
return common.common.Status.SUCCESS
return common.Status.SUCCESS
except (AttributeError, IndexError):
return common.common.Status.FAILURE
return common.Status.FAILURE


# Behavior defined to move towards something
Expand All @@ -301,7 +301,7 @@ def initialise(self):

def update(self):
"""Nothing much to do."""
return common.common.Status.SUCCESS
return common.Status.SUCCESS


# Behavior defined to move away from something
Expand All @@ -323,7 +323,7 @@ def initialise(self):
def update(self):
"""Compute direction and negate it."""
self.agent.direction = (self.agent.direction + np.pi) % (2 * np.pi)
return common.common.Status.SUCCESS
return common.Status.SUCCESS


# Behavior defined for Randomwalk
Expand All @@ -346,7 +346,7 @@ def update(self):
"""Compute random direction and set it to agent direction."""
delta_d = self.agent.model.random.normal(0, .1)
self.agent.direction = (self.agent.direction + delta_d) % (2 * np.pi)
return common.common.Status.SUCCESS
return common.Status.SUCCESS


class IsMoveable(Behaviour):
Expand Down Expand Up @@ -376,10 +376,10 @@ def update(self):
self.item, self.agent.name)
for obj in objects:
if not objects.moveable:
return common.common.Status.FAILURE
return common.common.Status.SUCCESS
return common.Status.FAILURE
return common.Status.SUCCESS
except (AttributeError, IndexError):
return common.common.Status.FAILURE
return common.Status.FAILURE


# Behavior defined to move
Expand Down Expand Up @@ -482,7 +482,7 @@ def update(self):

# Now the agent location has been updated, update the signal grids
if not self.update_signals(self.agent.location, new_location):
return common.common.Status.FAILURE
return common.Status.FAILURE

self.agent.location = new_location
self.agent.direction = direction
Expand All @@ -491,7 +491,7 @@ def update(self):
for item in self.agent.attached_objects:
item.location = self.agent.location
else:
return common.common.Status.FAILURE
return common.Status.FAILURE

else:
new_location = self.agent.partial_attached_objects[0].location
Expand All @@ -501,13 +501,13 @@ def update(self):
new_location):
agent.location = new_location
else:
return common.common.Status.FAILURE
return common.Status.FAILURE

# Now the agent location has been updated, update the signal grids
if not self.update_signals(self.agent.location, new_location):
return common.common.Status.FAILURE
return common.Status.FAILURE

return common.common.Status.SUCCESS
return common.Status.SUCCESS


# Behavior define for donot move
Expand All @@ -529,7 +529,7 @@ def initialise(self):
def update(self):
"""Update agent moveable property."""
self.agent.moveable = False
return common.common.Status.SUCCESS
return common.Status.SUCCESS


# Behavior to check carryable attribute of an object
Expand Down Expand Up @@ -558,11 +558,11 @@ def update(self):
self.blackboard.neighbourobj, self.agent.shared_content,
self.thing, self.agent.name)[0]
if objects.carryable:
return common.common.Status.SUCCESS
return common.Status.SUCCESS
else:
return common.common.Status.FAILURE
return common.Status.FAILURE
except (AttributeError, IndexError):
return common.common.Status.FAILURE
return common.Status.FAILURE


# Behavior to check carryable attribute of an object
Expand Down Expand Up @@ -591,11 +591,11 @@ def update(self):
self.blackboard.neighbourobj, self.agent.shared_content,
self.thing, self.agent.name)[0]
if objects.dropable:
return common.common.Status.SUCCESS
return common.Status.SUCCESS
else:
return common.common.Status.FAILURE
return common.Status.FAILURE
except (AttributeError, IndexError):
return common.common.Status.FAILURE
return common.Status.FAILURE


# Behavior define to check is the item is carrable on its own
Expand Down Expand Up @@ -626,13 +626,13 @@ def update(self):
self.thing, self.agent.name)[0]
if objects.weight:
if self.agent.get_capacity() > objects.calc_relative_weight():
return common.common.Status.SUCCESS
return common.Status.SUCCESS
else:
return common.common.Status.FAILURE
return common.Status.FAILURE
else:
return common.common.Status.FAILURE
return common.Status.FAILURE
except (AttributeError, IndexError):
return common.common.Status.FAILURE
return common.Status.FAILURE


# Behavior define to check is the item is carrable on its own or not
Expand Down
Loading

0 comments on commit 80f2ace

Please sign in to comment.