Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    JavaScript

    Top 11 Django Interview Questions

    Beginners

    Node.js Lesson 3: Node Package Manager

    Java

    10 Practices You Should Avoid to Become a Good Java Developer

    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
    Friday, November 28
    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:  Mastering N-API and Native Modules 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
      Comics November 3, 2016

      Outdated MVP

      We are looking forward to meeting you on our website blog.soshace.com

      The Ultimate Guide to Pip

      June 12, 2023

      How to mock a Sequelize database

      March 26, 2023

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

      October 27, 2016

      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

      Sorting Algorithms Overview: Theory and Visualization

      Beginners May 17, 2019

      Уроки React. Урок 11. Pt.2.

      Programming October 31, 2016

      Why Localize: Website Translation Best Practices

      Tips December 16, 2019

      Create simple POS with React, Node and MongoDB #3: setup E-mail pipeline with add activate on SignUp

      JavaScript January 28, 2020

      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
      Events

      Top IT Conferences and Events in 2020

      Startups

      Strategies to Cultivate Creativity and Innovation in Startups

      AI & Automation

      Navigating the Impact of AI on SEO and Search Rankings

      Most Popular

      Web development with Flask framework illustrated an address book project

      Flask

      Node.js Lesson 8: Inheritance from Errors, Error

      JavaScript

      How To Build a Github Jobs App using React, Apollo, and GraphQL – Part #1: Build the GraphQL Server

      GraphQL
      © 2025 Soshace Digital.
      • Home
      • About
      • Services
      • Contact Us
      • Privacy Policy
      • Terms & Conditions

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