oftn-oswg / oftn-bot

State of the art IRC bot library & bot for Node.js
http://wg.oftn.org/#projects
Other
90 stars 29 forks source link

Implement brainfuck language support #9

Open devyn opened 12 years ago

devyn commented 12 years ago
< devyn> bf> ++++++++++[>++++++++++<-]+++[>>++++++++++<<-]>++++.+.>++.<----.---.+++++++++++++.++++++++++. 
< oftn-bot> devyn: [0, 32, (121)] hi eboy

Not really sure how input would work. Maybe just give it the next thing they say if it's hanging on a ',' command.

mathiasbynens commented 12 years ago

Brainfuck programs get big really quickly. Aren't we gonna hit the IRC message length?

FireyFly commented 12 years ago

Doesn't matter; has brainfuck.

Really though, you can do enough interesting things in a single IRC-line of brainfuck for it to be a fun (although gimmicky) feature.

prophile commented 12 years ago

Hi chaps-

Doesn't matter; has brainfuck.

What about the inevitable infinite loops? +[]?

Alistair

FireyFly commented 12 years ago

Re. infinite loops, just limit the execution to, say, 100 000 brainfuck instructions.

Not really sure how input would work.

IIRC what fungot (another IRC bot) does is to separate code and input by a '!'.

emberian commented 12 years ago

Separating code and input by a ! is something a bunch of things do, especially self-interpreters.

devyn commented 12 years ago

We already have multiline execution support:

|> +++[>
|>   ++++++++++
|> <]
bf> ++.

This works for all languages.

As for input, yes, ! seems the best way to go. I had forgotten about that.