Git Product home page Git Product logo

evolutionary-pixel-patterns's Introduction

Evolutionary Pixel Patterns

Overview

Evolutionary Pixel Patterns is a personal coding project that employs a genetic algorithm as a heuristic search to generate optimal solutions for drawing patterns on a 2D grid of pixels. The algorithm mimics natural selection and genetics, creating a population of potential solutions represented as individuals with randomly generated patterns. Each individual's fitness is assessed based on how well its pattern adheres to given constraints. Through successive generations, individuals are selected, undergo crossover and mutation, and create offspring with potentially improved fitness. The algorithm iteratively refines the population, guiding the evolution towards patterns that increasingly satisfy the specified constraints, ultimately producing aesthetically pleasing and constraint-compliant visual compositions on the pixel grid.

Features

  • Genetic Algorithm: Utilizes a genetic algorithm to evolve pixel patterns over multiple generations.
  • 2D Grid: Represents the canvas on which pixel patterns are generated and evolved.
  • Fitness Function: Evaluates the quality of each pixel pattern based on predefined criteria.
  • Mutation and Crossover: Implements mutation and crossover operators to introduce variation in pixel patterns and promote diversity in the population.

Requirements

  • Web browser with JavaScript enabled
  • Text editor for editing HTML and JavaScript files

Since the project only uses vanilla JavaScript and HTML, there are no additional dependencies or requirements beyond a web browser and a text editor for code editing.

Getting Started

  1. Clone this repository to your local machine.
  2. Open the repository folder in Visual Studio Code (VS Code).
  3. Install the Live Server extension by searching for "Live Server" in the VS Code Extensions marketplace and clicking Install.
  4. Right-click on the index.html file in VS Code, then select "Open with Live Server" to host the site locally.
  5. The browser should automatically open with the hosted site. If not, you can access it at http://127.0.0.1:5500/index.html.
  6. You can now interact with the application and generate pixel patterns.

This setup allows you to make changes to the code in VS Code and see the updates in real-time by refreshing the browser window.

Usage

  • Click on the "Generate Patterns" button to start the evolutionary algorithm.
  • View the evolving pixel patterns on the 2D grid.
  • Adjust the parameters in the HTML file to customize the behavior of the algorithm.

Examples

Below are some examples of pixel patterns generated using this project:

Example 1

Example 2

Example 3

Example 4

Contributing

Contributions are welcome! If you'd like to contribute to this project, feel free to fork the repository and submit a pull request. Adding new constraints, could lead to generating more interesting patterns!

p.s.

some ideas: tesalation constraint, symmetry constraint, force cyclic constraint...

Acknowledgements

evolutionary-pixel-patterns's People

Watchers

Griffin Koontz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.