Code Monkey home page Code Monkey logo

kolakoski-kurve's Introduction

Kolakoski Kurve

Try it online @ catseye.tc | See also: Maze Clouds โˆ˜ Latcarf โˆ˜ Erratic Turtle Graphics

screenshot screenshot of XOR version

The Kolakoski sequence (Wikipedia), also called the "see and say" sequence, is an unbounded sequence of 1's and 2's which starts

1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 1, 2, 1, 1, ...

An interesting property of this sequence is that is describes its own run lengths: there is one 1's, followed by two 2's, followed by two 1's, followed by one 2, and so forth.

Kolakoski Kurve is a 2-dimensional visualization of the Kolakoski sequence that I devised circa 2016. It can be thought of as combining the sequence with turtle graphics, by the following method: Read the sequence left to right; whenever you see a 1, go forward some fixed distance, and whenever you see a 2, turn right 90 degrees.

Because the sequence itself is irregular, this process produces irregular shapes which are, to my mind, aesthetically pleasing.

The path does fold back on itself quite often (whenever two 2's appear in the sequence), so drawing the path with an XOR pen (which inverts any existing pixels on the line) instead of simply laying down black pixels results in another interesting drawing.

kolakoski-kurve's People

Contributors

cpressey avatar

Stargazers

 avatar

Watchers

 avatar  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.