Brainfuckconsole74

From Esolang
Jump to navigation Jump to search

BrainFuckConsole74 is a fantasy console. It extends the brainfuck language in a minimalistic way to create interactive content.

BrainfuckConsole74 - Game, Painting Software ...

Webseite.png

You find the console online at www.brainfuckconsole74.ch.

How to make brainfuck interactive?

There are new commands for rendering the first 256 cells (16x16 pixels) to the screen (!), reading inputs (;), a command for playing notes (#), two commands for simpler going forward / backward ( '( ) '256x < > ) and a optional debug command (?).

Screenshot.png

Existing software

Animated Cat.png
Swiss Alpine Racing.png

Missing software

  • Music Tracker

Cells

Cell can be 0-2048. Dec on 0 > 2047. Inc 2047 > 0

Screen

First 256 cells are also video memory. You can render the memory to the screen with command Render-Command !

Colors & Chars

  • 0-16: Colors
  • 16+: Default ASCII chars

Commands

  • +- <> [] ,. (All default brainfuck commands)
  • ! Renders the actual first 256 cells to the screen. Waits for next Sync (25/sec) or if sync is there, renders it immediatly.
  • ; Reads devices
    • read 0: keydown index clicked
    • 1: action key clicked
    • 2: down key clicked
    • 3: up key clicked
    • 4: left key clicked
    • 5: right clicked
    • 6: mouseposition 0-256
    • 7: mousebutton pressed
    • 8: mousebutton clicked
    • 9: random no: 0||1
    • 10-15: second joystick
  • # Plays notes (0: C-B)
  • < > Goes 256 cells forward or backward
  • ? Prints index and value of the cursor.

Implementation

The whole thing is implemented online in 2 Threads. The visual loops waits for rendering (25/sec) and the processing loop is processing the code and filing in the inputs.

Coding

Pixel based application are a real 'brainfuck'. The worst are games with variable positions. Therefore you have to go x-steps forward show something and back again. It is even worse than coding on an atari 2600, because you don't know where you are.
Here some examples first one with interactivity and than the real problem. (There are more online)

Interactivity

{wait for click or button}

)+[>
 [-]+++++++;[<->[-]] 
 // action 
 [-]+;[<->[-]]
 < 
](
?

Pixel at position y

The following script 8-pixel goes forward (plain brainfuck). And than renders it with  !. Of course you don't want to overwrite the existing pixels, so have to do this in the offscreen (cells > 255). Therefore you would use the ( ) -commands.

++++++++
[>[->+<]<-[->+<]>]
!

For more information look at the PATTERN-Area online.

Metagame

The whole thing is of course a meta-game. How complex can applications and game get in this environment and of course in brainfuck.

Compilers

The game has embeded a compiler for Pseudo code and for Processing. You can create various variantes in optimising size of the code (Java accepts only max 65k code size and brainfuck needs a lot of commands as you know)

Options:

  • Pseudocode
  • Processing
  • Processing small
  • Processing minimalistic (packed)
BrainfuckConsole running as a compilation on processing.png