Skip to content

Commit

Permalink
refactor: delete unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasfremming committed Nov 11, 2024
1 parent 786d3bb commit fb1f7a8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 606 deletions.
20 changes: 9 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ def create_creatures(amount, space):
vision = Vision(Point(0, 0))
creature: Creature = Creature(space, vision)
# Add limbs to the creature, placing them above the ground
limb1 = creature.add_limb(100, 60, (300, 100), mass=1)
limb2 = creature.add_limb(100, 20, (350, 100), mass=1)
limb3 = creature.add_limb(110, 60, (400, 100), mass=5)
# limb1 = creature.add_limb(100, 60, (300, 100), mass=1)
# limb2 = creature.add_limb(100, 20, (350, 100), mass=3)
# limb3 = creature.add_limb(110, 60, (400, 100), mass=5)

limb1 = creature.add_limb(100, 20, (300, 300), mass=1)
limb2 = creature.add_limb(100, 20, (350, 300), mass=3)
limb3 = creature.add_limb(80, 40, (400, 300), mass=5)

# Add a motor between limbs
creature.add_motor(
Expand All @@ -58,9 +62,9 @@ def create_creatures(amount, space):

creatures.append(creature)


return creatures


def create_population(population_size, creature: Creature):
amount_of_joints = creature.get_amount_of_joints()
amount_of_out_nodes = amount_of_joints
Expand All @@ -76,7 +80,6 @@ def create_population(population_size, creature: Creature):
return population



def apply_mutations(self):
"""
Apply mutations to the genome based on defined mutation rates.
Expand All @@ -100,11 +103,8 @@ def apply_mutations(self):
self.mutate_nodes()




def main():


# Initialize Pygame and Pymunk
pygame.init()
screen_width, screen_height = SCREEN_WIDTH, SCREEN_HEIGHT
Expand All @@ -124,7 +124,7 @@ def main():
environment.ground_type = GroundType.BASIC_GROUND

#Population and creatures
population_size = 10
population_size = 5
creatures: list[Creature] = create_creatures(population_size, space)
creature_instance: Creature = creatures[0]
population = create_population(population_size, creature_instance)
Expand Down Expand Up @@ -170,8 +170,6 @@ def main():
environment.ground,
environment.offset) # if perlin, offset = 0, if basic, offset = environment.offset



#creature_instance.render(screen)
for creature in creatures:
creature.render(screen)
Expand Down
Empty file removed src/agent_parts_old/__init__.py
Empty file.
113 changes: 0 additions & 113 deletions src/agent_parts_old/creature.py

This file was deleted.

116 changes: 0 additions & 116 deletions src/agent_parts_old/joint.py

This file was deleted.

Loading

0 comments on commit fb1f7a8

Please sign in to comment.