Ants Search For Food Simulation

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024
  • In my first video, • Ants Wander & Seek Beh... I had ants that could wander around, or target a certain point. Now I've added food. The ants can spot the food, and carry it back to the nest.
    It took a little bit of work to scale this up to work for hundreds of ants and hundreds of food. And I don't think that it would work very well for thousands of ants yet, although I think thousands of food should be OK. The main trick I used to scale this up was to store the food in a grid based dictionary. Then each ant only needed to look for food in its grid, and the 8 adjacent grids.
    There is potentially additional optimization because an ant that is pointing one way doesn't need to look at the 3-5 grids that are behind it. I decided to not pursue that because figuring out which grids to look at would be some calculation itself, and I may want to play with other ant search angles in the future, for instance ants might be able to see food 180 degrees or 360 degrees in the future, rather than the 120 degrees I gave them now.
    The next step will be to add pheromones so that the ants can communicate with other ants about where food is.
    For my inspiration videos, see
    Pezzza's Work: • C++ Ants Simulation 1,...
    Sebastian Lague: • Coding Adventure: Ant ...
    All this was done with
    Python
    Pygame
    Ant Picture by "Clker-Free-Vector-Images" : pixabay.com/ve...

Комментарии • 1

  • @dubiousinsights4008
    @dubiousinsights4008  3 года назад

    If you liked this video, check out the first in the series here ruclips.net/video/XM2IOUQcr2U/видео.html