Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    JavaScript

    Advanced Node.Js: A Hands on Guide to Event Loop, Child Process and Worker Threads in Node.Js

    LinkedIn

    Optimizing LinkedIn Lead Generation: Seamless CRM Integration

    Programming

    Python Array Explained and Visualized

    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
    Wednesday, January 21
    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:  Build Real-world React Native App #1: Splash screen and App Icon

    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
      Java December 26, 2019

      Memory Leaks in Java: A Cautionary Tale and Gentle Introduction to Preventing Memory Errors

      What are memory leaks? Should you worry about them? How do you detect them and how can you get rid of them? This article covers various techniques for eliminating memory leaks in your Java application

      Basic Prototype Design

      November 15, 2019

      What Is Responsive Web Design?

      May 13, 2019

      Handling GraphQL API Authentication using Auth0 with Hasura Actions

      March 4, 2021

      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

      21. Node.js Lessons. Writable Response Stream (res), Pipe Method. Pt.1

      Programming October 27, 2016

      21. Node.js Lessons. Writable Response Stream (res), Pipe Method. Pt.2

      Programming October 28, 2016

      Implementing Data Privacy Principles in Software Development

      Development December 4, 2024

      Leveraging Influencers: Key Drivers in New Product Launches

      Influencer & Community August 27, 2025

      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
      Git

      Introduction to GitHub Desktop: A GUI Enhancement to a CLI Approach

      LinkedIn

      Effective LinkedIn Outreach: Proven Strategies for Prospects

      Beginners

      Data Science Overview: The Bigger Picture

      Most Popular

      The Impact of Integrated Development Environments on Coding

      Programming

      Automated Postgresql Backups with NodeJS and Bash

      JavaScript

      Comparing Data Structures in JavaScript (Arrays vs Objects)

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

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