Giter Site home page Giter Site logo

brainfuck's Introduction

txt2rb.rb

Convert a chunk of text to a stylish Brainfuck code with an embedded ascii-art logo (you'll need figlet for that though!). The result may be as cool as this:

++++++++++[>+++++++>++++++++++>+++>++++++++++++>++++++++><<>+++>+++++++++++>+++>++++++++++<<<<<<<<-]>+++.>++.>++.>+.>+.>
+++++++.>+++++++++.>.>++++++++++[>+++>++++++++++>++++++++++>++++++++++>++++++++++>+++>+++++++++++>+++++++++++<<<<<<<<-]>
++.>++++++++.>+++++.>+++++++.>+.>++.>++++++.>+.>++++++++++[>+++>++++++++++>++++++++++>+++++++++++>++++++++++>+++>+++++++
+++>+++++++<>+++<<<<<<<<-]>++.>++++.>+++++.-+>++++.>+.>++.>+++++++++-+.>+.>++++++++++[>+++>+++++++++>++><+++++++++>+++++
++++++>+++++++++++>+++++++++>+++++++++>+++++++++++<<<<<<<<-]>++.>+++++++++.>+.>.>++++++.>+++++++.>+++++++++.>++++++.>+++
+++++++[>+++>++++++++++>++++++++++>+++>+++++++++>++++++++-+++++>+++>++++++++++<<<<<<<<-]>++.>+++++++++.>+.>++.>++++++++.
>+.>++.>+.>++++++++++[>++++++++++>+++++++++>++++++++++>++++++++++>+++>+++++++++>+++++++++++>+++<<<<<<<<-]>+++++++++.>+++
++++.>+++++.>++++++++.>++.>+++++++.>++++++.>++.>++++++++++[>+++++++++++>++++>+++++++++++>+++++++++++>+++++++++>+++++++++
++>++++<>++++++++>++++++++++<<<<<<<<-]>++.>++++++.>+++++.>++><++++.>+++++++.>+++++.>++.>+.>++++++++++[>+++++++++++>+++++
++++++>++++++++++>++++++++++>++++++>++++++++++>++++++++++>+++++++++<<<<<<<<-]>+++><++++++.>+++++.>+++><++++.>+++++.>++++
.>+++.+->+++++++++.>+++++++.>++++++++++[>++++++++++>++++++++++>++++>+++++++++>+++++++++++>++++++++++>++++>+++<<<<<<<<-]>
+++++.>++++++++.>++++++.>+++++++++.>+.>+++++++++.>++++.>++.>++++++++++[>+++++++++++>+++++++++++>+++>+++++++++>+++++++++>
++++++++++-  ++>+++  +<>+++++>++++++++++<<<<<<<<-]>+.  >++++.>++.>><<>+++++<>++++.>  +++++++.>++++++.>+++++++++.>++++<>.
>++++++++++[>+++>++      ++++++      ++>+      +<>+++      ++++  +>    +++>      ++++++      +++>        +++++++++++>+++
>+++++++<<<  <<<<<-  ]>++  .>  ++++  ++    +++.>+.>++  .>++  ++    +++.>+  ++++  +.  >+  +.>+  ++.>++  ++++++++[>+++++++
+>++++++>++  +++++>  ++++  ++  ++++  >+++++    ++++++  >+++  >+  ++++++++  ++>+  ++  ++  ++++  ++<<  +-<<<<<<-]>++.>++++
+++.>++++++  ++.>+.  >+++  +++.      >+      +.>+.>++      ++.>  ++++++++++      [>  ++  +>++  ++        +++>+++++++++++
>++++<>++++++>++++++++++>+++++++>+++++++++++>++++++++++<<<<<<<<-]>++.>.>++++.>+.>+.>++++++++.>+.>.>++++++++++[-+>+++++++
+++>++++>+++>+++++++++++>++    --++++++++++>+++++++++>+++  +++++++>  +++++<<<<<<<<-]>+.>+++  +.>++.>.>+++++.>+++++++++.>
+++++++.>++++++++.>++++++  ++++[>++    +>++  ++    ++++++      >+++++++  +>    ++++    ++++  +>+++-+++++++++->+++++++>++
++>+++<<<<<<<<-]>+-++.>        .>  ++.>  ++    ++++++.>++  +++.  >+  .>    ++++++        .>  ++.>++++++++++[>++++++++>++
++++++++>++++++++++>+<>++  >+++++  ++++  ++  >+++++++++++  >+++  ++  ++  ++++>+++  ++++++++<<<<<<<<-]>++++.>++++.>+.>++.
>+++++.>+.>+++++++.>++++.  >+++++++    +++[  >+++++++++>+  ++++  ++  ++  +>+++>++++      ++  +++++>++++++++++>+++>++++++
++++-++>++++++++++<<<+-<<<<<-]>+++++++++.>+.>++.>+.+->++.>++.>++++++.>++++.>++++++++++[>++++++++++>+++++++++++>+++>+++++
++++>+++++++++>+++++++++++>+-++++++++++>+++<<<<<<<<-]>+++++.>+++++.>++.>+++++++++.>+++++++.>++++.>.>++.>++++++++++[>++++
+++++<>+>++++++++++>+++++++++++>++++++++++>+++++++++++>+++++++++>+++++++++++>+++++++++++<<<<<<<<-]>+++.>+.>.>+.>++++.>++
+++++.>+++-++++.>+.>++++++++++[>+++++++++++>+++>++++++++++>+++++++++++>+++>+++++++++>+++++++++++>+++<<<<<<<<-]>++++.>++.
>+++++.>+++++.>++.>+++++++.>++++++.>+-++.>++++++++++[>++++++++++>+++++++++++>+++++++++++>+++++++++++>+++++++++++>+++++>+
+++>++++<<<<<<<<-]>++++.>++++++.>++++++.>++.>+++++.>++++++++.>+++++++.>+++++++.>+++++++<>+++[>++-+++++++++>++++++++++>++
+++++++++>++++++++++>+++++++++++>+++++++++>++++>+++++++++<<<<<<-+<<-]>+++.>+++++.>++++++.>++++.>+++++++.>++++++++.>+++++
+.>+++++++++.>++<>++++++++[>+++++++++++>++++++++++>++++>++++++++++>+++++++++++>+++++++++>++++++++++>++++++++++<<<<<<<<-]
>+.>+++++++++.>+++++++.>.>++++.>++++++++.>+++++.>+++.>++++++++++[>+++-++>+++++++-+++>+++++++++++>+++++++++>++++++++++>++
+++++++++>++++++++++>+++++++++++<<<<<<<<-]>+-+++++++.>++++++++.>++++.>+++++++.>+++++.>.>++.>+++++++.>++++++><++++[>+++++
++++>+++++++><+++>-+-+++++>+++++++++>++++++++++>+++++++-+++++>+++++++++>++++<<<<<<<<-]>+++++++++.>+++++++.>+++++++.>++++
++++.>++++++++.>+.>++++++++.>+++++++.>++++++++++[>++++++++++>+++++++++>+++++++++++>+++++++++++>++++++++++>+++++++++++>++
++>+++++++++++<<<<<<<<-]>+++++++++.>+++++++.>+++++.>++++++.>+.>++++.>+++++++.>++++++.>++++++++++[>++++++++++++>+++++++++
++>+++++>+++++++++>++++++++++>++++>+++++++++++>+++++++++<<<><<<<<<-]>.>++++++.>.>++++++++.>++.>++++++.>++++.>++++++++.>>

2021 out of the blue update

Came across a language that tickles me in all the right ways so for fun first project I implemented the core functionality in Vlang. It's blazing fast! Also in the spirit of "static binary, no deps, run anywhere!" I'm consciously leaving out all the figlet and logo-placing stuff.

How to use it

Without any arguments you'll get some help:

> ./txt2bf.rb
Usage: ./txt2bf.rb <chunk_size:int> <width:int> <font:str> <logo:str>

You can run it like this:

> ./txt2bf.rb 8 120 block "i has brainz for hire!" > card.bf

Then you should write what you want and hit Ctrl-D. Note: I don't care if it handles newlines as it should (note: it's open source, you can add it).

The code

It's ugly.

Motivation

Why not?

Contact

Visit my website - though after reading this you're cheating.

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.