Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    Node.js

    Protecting Your API from Brute Forcing By Rate Limiting in NodeJS

    JavaScript

    Basic Principles and Rules of Our Team

    Programming

    19. Уроки Node.js. Безопасный Путь к Файлу в fs и path.

    Important Pages:
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Today's Picks:
    • Scaling Success: Monitoring Indexation of Programmatic SEO Content
    • Leveraging Influencers: Key Drivers in New Product Launches
    • How Privacy-First Marketing Will Transform the Industry Landscape
    • The Impact of Social Proof on Thought Leadership Marketing
    • Balancing Value-Driven Content and Promotional Messaging Strategies
    • Top Influencer Marketing Platforms to Explore in 2025
    • Emerging Trends in Marketing Automation and AI Tools for 2023
    • Strategies to Mitigate Duplicate Content in Programmatic SEO
    Tuesday, February 10
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Soshace Digital Blog
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Services
    • SaaS & Tech

      Maximizing Efficiency: How SaaS Lowers IT Infrastructure Costs

      August 27, 2025

      Navigating Tomorrow: Innovations Shaping the Future of SaaS

      August 27, 2025

      Maximizing Impact: Strategies for SaaS & Technology Marketing

      August 27, 2025
    • AI & Automation

      Enhancing Customer Feedback Analysis Through AI Innovations

      August 27, 2025

      Navigating the Impact of AI on SEO and Search Rankings

      August 27, 2025

      5 Automation Hacks Every Home Service Business Needs to Know

      May 3, 2025
    • Finance & Fintech

      Critical Missteps in Finance Marketing: What to Avoid

      August 27, 2025

      Analyzing Future Fintech Marketing Trends: Insights Ahead

      August 27, 2025

      Navigating the Complex Landscape of Finance and Fintech Marketing

      August 27, 2025
    • Legal & Compliance

      Exploring Thought Leadership’s Impact on Legal Marketing

      August 27, 2025

      Maximizing LinkedIn: Strategies for Legal and Compliance Marketing

      August 27, 2025

      Why Transparency Matters in Legal Advertising Practices

      August 27, 2025
    • Medical Marketing

      Enhancing Online Reputation Management in Hospitals: A Guide

      August 27, 2025

      Analyzing Emerging Trends in Health and Medical Marketing

      August 27, 2025

      Exploring Innovative Content Ideas for Wellness Blogs and Clinics

      August 27, 2025
    • E-commerce & Retail

      Strategic Seasonal Campaign Concepts for Online and Retail Markets

      August 27, 2025

      Emerging Trends in E-commerce and Retail Marketing Strategies

      August 27, 2025

      Maximizing Revenue: The Advantages of Affiliate Marketing for E-Commerce

      August 27, 2025
    • Influencer & Community

      Leveraging Influencers: Key Drivers in New Product Launches

      August 27, 2025

      Top Influencer Marketing Platforms to Explore in 2025

      August 27, 2025

      Key Strategies for Successful Influencer Partnership Negotiations

      August 27, 2025
    • Content & Leadership

      The Impact of Social Proof on Thought Leadership Marketing

      August 27, 2025

      Balancing Value-Driven Content and Promotional Messaging Strategies

      August 27, 2025

      Analyzing Storytelling’s Impact on Content Marketing Effectiveness

      August 27, 2025
    • SEO & Analytics

      Scaling Success: Monitoring Indexation of Programmatic SEO Content

      August 27, 2025

      Strategies to Mitigate Duplicate Content in Programmatic SEO

      August 27, 2025

      Effective Data Visualization Techniques for SEO Reporting

      August 27, 2025
    • Marketing Trends

      How Privacy-First Marketing Will Transform the Industry Landscape

      August 27, 2025

      Emerging Trends in Marketing Automation and AI Tools for 2023

      August 27, 2025

      Maximizing ROI: Key Trends in Paid Social Advertising

      August 27, 2025
    Soshace Digital Blog
    Blog / JavaScript / Swarm Intelligence: Infusoria Slipper
    JavaScript

    Swarm Intelligence: Infusoria Slipper

    Nikita BraginBy Nikita BraginApril 6, 2023Updated:April 26, 2023No Comments3 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    Swarm Intelligence: Infusoria Slipper
    Way to AGI. Infusoria-slipper
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link
    Grid, gradient and one cell organism
    Grid, gradient and one cell organism

    Infusoria slipper

    The topic of artificial intelligence is very popular right now. I am not familiar with neural networks and the like, but I do have experience programming in JavaScript, so I will use that, even though it may not be the best choice for machine learning. I set a research goal for myself: to understand the most optimal decision-making algorithms at each level of task-setting, and to move from simpler solutions to more and more complex ones as the external environment becomes more complicated.

    For the starting point, I decided to take the behavior of the Infusoria slipper. If there is light, it moves towards the light; if there is no light, it stays still. With such behavior, the main task will be very simple: find the shortest path to the center of the light source.

    Environmental conditions

    A field of cells, like a chessboard, through which the light and the organism will move. There is one light source with a configurable gradient radius and center coordinates.

    Single-celled organism

    As long as the gradient does not reach the organism, it does not see it. When it does, the organism begins to move towards its center. The time interval is 0.5 seconds.

    Implementation

    Repository: https://github.com/brnikita/Cellular-Automata/tree/Step1.-Infusoria-slipper

    I will only describe the main ideas; the full code can be found at the link above.

    Gradient (source of excitation)

    scripts/gradient.js

    applyGradient(index) {
        const cells = this.container.children;
    
        for (let i = 0; i < this.cellsNumber; i++) {
          const xDistance = (index % this.numberOfColumns) - (i % this.numberOfColumns);
          const yDistance = Math.floor(index / this.numberOfColumns) - Math.floor(i / this.numberOfColumns);
          const distance = Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2));
    
          const intensity = Math.max(0, this.selectedIntensity - distance);
          const bgColor = `rgba(${hexToRgb(this.selectedColor)}, ${intensity / 9})`;
          cells[i].style.backgroundColor = bgColor;
          createIntensityMap(i, intensity, this.numberOfColumns, this.intensityMap);
        }
      }
    
    Field's cells are arranged in a row like a long snake
    Field’s cells are arranged in a row like a long snake

    In my implementation, the field cells are arranged in a row in order and are moved to a new line due to styles, like a long snake. Therefore, to calculate the gradient coordinates, we need to consider the length of one line. I store the gradient of each field cell in an array called createIntensityMap, and when drawing the field, I take the data for the color of each cell from it.

    Read More:  Node.js Lesson 13: Debugging in Node.js

    Cell’s brain

    scripts/oneCellorganism.js

    brain(thisX, thisY) {
        let newX = thisX;
        let newY = thisY;
        let newXY = {};
        let maxIntensity = 0;
    
        const neighbors = [
          [-1, -1], [-1, 0], [-1, 1],
          [0, -1], [0, 0], [0, 1],
          [1, -1], [1, 0], [1, 1],
        ];
    
        for (const [dx, dy] of neighbors) {
          const x = thisX + dx;
          const y = thisY + dy;
    
          if (x < 0 || x >= this.numberOfColumns || y < 0 || y >= Math.floor(this.cellsNumber / this.numberOfColumns)) {
            //checking field's borders
            continue;
          }
    
        const intensity = this.intensityMap[y][x];
    
        if (intensity > maxIntensity) {
          maxIntensity = intensity;
          newX = x;
          newY = y;
        }
      }
    
      newXY.x= newX;
      newXY.y= newY;
      return newXY;
    }

    I put the decision-making algorithm for the cell in a separate function. The logic is as follows: the cell collects gradient data around it, in a loop, selects the cell with the highest gradient, and moves to it.

    How to play

    Download the project at https://github.com/brnikita/Cellular-Automata/tree/Step1.-Infusoria-slipper

    Open the index.html file in a browser. Enjoy the game!

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Nikita Bragin

      Related Posts

      Streamlining Resource Allocation for Enhanced Project Success

      December 18, 2024

      Conducting Effective Post-Project Evaluations: A Guide

      December 16, 2024

      Strategies for Keeping Projects on Track and Meeting Deadlines

      December 10, 2024
      Leave A Reply Cancel Reply

      You must be logged in to post a comment.

      Stay In Touch
      • Facebook
      • Twitter
      • Pinterest
      • Instagram
      • YouTube
      • Vimeo
      Don't Miss
      JavaScript June 27, 2019

      Introduction to Micro Frontends: The New Tech on the Block

      Like with all powerful technologies, micro frontends often cause confusion among developers, as evidenced by the ever so popular search queries like “What are micro frontends?” It may be tempting to try and ignore it, but then you’ll be missing out on the amazing opportunities that micro frontends provide — after all, they’re not just a hip trend to follow. In this article, we’ll explore what micro frontends are, what benefits they can bring, how they can be used, and what caveats and pitfalls they pose.

      Securing Node.js Applications with JWT and Passport.js

      May 2, 2023

      Mapping the World: Creating Beautiful Maps and Populating them with Data using D3.js 

      January 21, 2020

      This Is How I Created a Simple App Using React Routing

      February 19, 2020

      Categories

      • AI & Automation
      • Angular
      • ASP.NET
      • AWS
      • B2B Leads
      • Beginners
      • Blogs
      • Business Growth
      • Case Studies
      • Comics
      • Consultation
      • Content & Leadership
      • CSS
      • Development
      • Django
      • E-commerce & Retail
      • Entrepreneurs
      • Entrepreneurship
      • Events
      • Express.js
      • Facebook Ads
      • Finance & Fintech
      • Flask
      • Flutter
      • Franchising
      • Funnel Strategy
      • Git
      • GraphQL
      • Home Services Marketing
      • Influencer & Community
      • Interview
      • Java
      • Java Spring
      • JavaScript
      • Job
      • Laravel
      • Lead Generation
      • Legal & Compliance
      • LinkedIn
      • Machine Learning
      • Marketing Trends
      • Medical Marketing
      • MSP Lead Generation
      • MSP Marketing
      • NestJS
      • Next.js
      • Node.js
      • Node.js Lessons
      • Paid Advertising
      • PHP
      • Podcasts
      • POS Tutorial
      • Programming
      • Programming
      • Python
      • React
      • React Lessons
      • React Native
      • React Native Lessons
      • Recruitment
      • Remote Job
      • SaaS & Tech
      • SEO & Analytics
      • Soshace
      • Startups
      • Swarm Intelligence
      • Tips
      • Trends
      • Vue
      • Wiki
      • WordPress
      Top Posts

      Strategic LinkedIn Branding: A Key to Effective Lead Generation

      LinkedIn December 9, 2024

      How to Build Real-Time Applications Using Node.js and WebSockets

      JavaScript May 27, 2023

      Building Machine Learning-Enabled Web Applications with Django and Scikit-Learn Introduction

      Django March 28, 2023

      Tim&Tom JavaScript Frameworks

      Comics August 24, 2016

      Subscribe to Updates

      Get The Latest News, Updates, And Amazing Offers

      About Us
      About Us

      Soshace Digital delivers comprehensive web design and development solutions tailored to your business objectives. Your website will be meticulously designed and developed by our team of seasoned professionals, who combine creative expertise with technical excellence to transform your vision into a high-impact, user-centric digital experience that elevates your brand and drives measurable results.

      7901 4th St N, Suite 28690
      Saint Petersburg, FL 33702-4305
      Phone: 1(877)SOSHACE

      Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
      Our Picks
      JavaScript

      Fortune 500 top hiring trends in 2019. How big corporations hire top talents?

      Flask

      Implementing a BackgroundRunner with Flask-Executor

      JavaScript

      JavaScript Closures and Scoping: Understanding Execution Context and Variable Hoisting

      Most Popular

      Create simple POS with React.js, Node.js, and MongoDB #7: Adding redux to other components

      JavaScript

      TOP 6 Coding Interview Tools for Screening & Testing Web Developers

      Programming

      A Few Productivity Tips and Tools for Web Developers

      Tips
      © 2026 Soshace Digital.
      • Home
      • About
      • Services
      • Contact Us
      • Privacy Policy
      • Terms & Conditions

      Type above and press Enter to search. Press Esc to cancel.