Giter Site home page Giter Site logo

brainfuckge's Introduction

Simple Brainfuck Game Engine

An engine where the logic is written in brainfuck.

Notice

Due to the language's specifics the only available colors are black and white. A value may go as high as 255, but for the canvas, the only accepted values are 0 - black and >1 - white.

This is a feature, not a bug.

Also, in order to get input, you use ',LetterOfYourChoice', for instance

,w

In this code, if 'w' was clicked between globs (aka if 'w' was clicked between canvas update) the selected value will become 'w''s ascii code.

Setup

Here is what you need to do to use this engine.

git clone https://github.com/ImRanThereforeHail/BrainfuckGE.git
cd BrainfuckGe
cargo run --release main.bf

A "Hello world!" message should appear.

First steps

Head on to any file of your choice

The inner workings of the engine are very simple. You have an array of size 1024 which acts as a 32 x 32 grid in the canvas. (In future versions you should be able to adjust the size). If a value inside the array is greater than 0 its corresponding pixel will be white; else, the corresponding pixel will be black.

The brainfuck code runs in a loop;

Answering questions

  • Can I have objects? You can! So long as said object isn't invisible (which is not supported) just assign a number from 0 to 255 as an alias to said object, and in the next iteration of the loop you'll know what pixel represents what.

Examples

This code paints the whole canvas white

+>*

This is because the code runs in a loop, so, in english:

add 1 to the current value, change to the value in the right, update screen, return to the beginning 

Thus, if you want to paint, for instance, 2 cells, it would have to be:

+>+*-<-

TODO

  • Be able to change grid size (CAN'T DUE TO UNKNOWN GLITCH)

Done

  • File to be used goes an argument, rather than always the main.bf
  • Use '*' to update canvas
  • Rewrite front-end (all in src/main.rs)

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.