Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    Interview

    Tips and Tricks for a Newbie at Web Development: How to Prepare for the Interview

    JavaScript

    Agile Software Development, Scrum part 1

    Job

    DevOps Overview: Rethinking How Development and Operations Work

    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, September 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:  Handling Side Effects in Redux: Redux-Saga

    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
      Programming December 16, 2016

      3. Express.js Lessons. Templating with EJS: Layout, Block, Partials

      In real life we generally have more than one template. Moreover, if we create a website with several pages, it usually happens that a number of them are of the same design. The template systems should consider this aspect. Unfortunately, ejs doesn’t deal very well with this task. That’s why we are going to install a different templating system named ejs-locals(let us add it to app.js):

      If Trello became too small for you.

      September 30, 2016

      Роль Менеджера Продуктов

      June 1, 2016

      23. Уроки Node.js. Домены, “асинхронный try..catch”. Часть 2.

      November 16, 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

      Create Simple POS With React, Node and MongoDB #4: Optimize App and Setup Deployment Workflow

      JavaScript February 17, 2020

      Maximizing LinkedIn: Strategic Lead Generation for Real Estate

      LinkedIn December 1, 2024

      5 Best Tools for Managing Your Web Developer’s Salary

      Remote Job January 30, 2019

      Optimizing LinkedIn Lead Generation: Seamless CRM Integration

      LinkedIn December 7, 2024

      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

      TOP 11 JavaScript Machine Learning & Data Science Libraries

      Events

      Full List of JavaScript Conferences 2020 [41 Events] Updated 28.08.2020

      Events

      Running Remote Announcement: Early Bird Ticket Sale [Save up to $500]

      Most Popular

      How to Run API Tests Automatically Every Time Your App Is Deployed using Loadmill

      JavaScript

      Exploring Modern JavaScript: A Comprehensive Guide to ES6 and Beyond

      JavaScript

      RxJS Methods. Part2

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

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