« first day (3799 days earlier)      last day (1027 days later) » 

9:10 PM
Capes!? No capes!
 
We need a challenge titled "Caps!? No caps!" about avoiding capital letters :P
 
There are loads of BF interpreters on TIO. Do you guys know if any of them have a flag to print the final state?
The regular 'brainfuck' one doesn't seem to
 
Do they have to be strictly bf?
 
No, any superset is great!
So long as it'll interpret the subset of normal BF as BF
 
Cause I have Bitwise Fuckery which is a superset of brainfuck, that has -d and -t flags (debug and show tape)
 
9:14 PM
Oh awesome, thanks!
 
I think it works, I've had bugs with [ and ] before, so let me know if something's broken
 
Oh wait, but:
> In addition to this, the while loops are modified so that the condition depends on the final bit of the tape head.
I have so much code at this point, it'll be a huge pain to flip all of that
 
Those are (...) loops, not [...] loops
ಠ_ಠ Ignore me, the TIO version isn't the version with the fixed loops, sorry :(
 
Oh no!! Close though!
Just found this, which is the best I have so far
That's on TIO and it has:
> Debug Commands (enabled with -d):
# - print out coordinates and value of current cell
? - print out current coordinates
I just wish one of the debug commands was "print the whole tape." Whyyyyy
 
might be interested in copy.sh/brainfuck ?
 
9:21 PM
Most of the TIO bf languages are implemented by Dennis, so don't have any special features by design
 
It's true, that's what I'm realizing
I just went through every search result
That 'brainfuck' pulls up
And the hyper-dimensional above is the only one with any debugging capabilites while being backwards compatible
@rak1507 Thanks, I have been using it! Just a bit uncomfortable
 
fair enough
 
It's interesting that the interpreters are actually transpilers to C, written in bash :P
 
I'm really hoping for a special debugging character you can use midprogram that will print the current tape
Does anyone know of any downloadable BF interpreters with that functionality, maybe?
>++>+++#
<+++<+#
 
I don't know of any downloadable BF interpreters tbh, is that a thing??
 
9:25 PM
Would output:
 
well, BF not doing anything on any other characters is actually sort of important for some things
like polyglots specifically :p
 
0 2 3
1 5 3
 
It can;t be difficult to write your own interpreter with that
 
I know...
 
yea that's what I was going to say, just add that in to an existing one
should be straightforward
 
9:26 PM
@hyper-neutrino It could be enabled only with -d
 
I'm just so over this answer I'm writing, but I've sunk soooo much time into it
So I was just hoping to be done, haha
If I was still enjoying this, playing around with interpreters would be way fun
But I'm not
 
gimme a few minutes or more and i'll try something
 
Now I just feel like a lazy bastard, haha, but thanks! I'll keep working on it in the meantime, and I'll credit you in the answer
 
That's the TIO bf interpreter, if anyone knows bash/C enough to extend it
 
9:29 PM
Oh, thanks! That's a great idea
 
Looks like adding \#) echo 'puts(t);';; or similar should work (I can never remember how to output arrays in C), but it isn't ಠ_ಠ
 
outputting arrays typically doesn't work with built-ins
you'd have to loop yourself
passing an array into a function in C actually usually doesn't really work because arrays don't have a length
 
Stupid C, not having basic array support :P
 
I was looking through CR questions and all of the questions are so long compared to the TIO source. However a bf previewer was posted
 
This might work:
Added a #define LIM 10
\#) echo 'for(int i=0; i<LIM; i++) {putchar(t[i]); putchar(' ');}';;
Can you run it in TIO like this in 'input'?
Because it isn't working for me, but I'll try downloading
 
9:36 PM
That's a hack, I have no idea how you'd get input for ,
 
No way!!!! Thanks!
 
@AviFS Your ' are messing with the bash, I'd suggest replacing ' ' with 32
 
Thanks, will do!
Also, it's printing the ASCII, not the number
 
Yeah, I thought puts instead of putchar would work, but I got a segfault :/
 
of course it's a segfault lmao
 
Guys, we did it!!!
@cairdcoinheringaahing ... Did you literally do the same I did?
Seconds apart
I figured there'd be some difference, haha
 
Looks like it :P
 
Only difference is our sample input
 
@AviFS if you want one that displays the pointer address and collapses runs of equal elements a bit: tinyurl.com/4fjcrbtf
input in input, code in argument #1, use ! to print the current value and its left and right neighbor, # to print the whole tape
 
That's a better interpreter :P
 
9:44 PM
Thanks @hyper-neutrino & @cairdcoinheringaahing, I'll credit both of you guys!
It'll be interesting to see whether explicitly optimized Python or naive C is faster
You think the Python will be better, hyper?
 
no way
it's not optimized
just the output collapses some long runs if there are too many of the same element in a row, though that shouldn't often happen
 
Note: -d flag still not implemented, so you'll have to comment out that line if you want expected behavior
 
@AviFS you'd have to write extremely naive C for it to be slower than python
 
Haha, alright!
I take back my question, then
 
this C isn't particularly naive; BF is... not very difficult to do in sane languages :P
 
there isn't too much more you can do with it other than maybe run-length encode things for hyper-optimization and that'll maybe save you a couple nanoseconds here and there
 
HN's interpreter with a -d flag
 
nice
how did you get that message to send
 
magic
(it's a multiline message, shift-enter at the end)
 
it even says the message is too long and won't let me update if i try to edit your message
@cairdcoinheringaahing oh ಠ_ಠ doesn't appear like that when i open the edit box on it tho
lol
 
9:49 PM
I'm more powerful than a mod :P
 
@dzaima Not a problem for me :P
 
@dzaima I use Python over C, because although C is faster to run, it's a lot slower for me to code :P
 
@user I highly doubt it.
 
@dzaima It was mostly a joke. If I managed to get a C program to run, it'd probably faster than the Python one, but it's unlikely I can actually get it to work without segfaulting or something
 
well, an instant segfault would make it finish running pretty quickly
 
9:52 PM
@hyper-neutrino @cairdcoinheringaahing Hyper's interpreter showing the current element is a great addition. Here's the final Bash interpreter with that implemented!
 
well, yeah, you'd have some hiccups while writing it, but you'd have to be doing absolutely crazy things to end up slower than python
 
If this is a rickroll, I commend the dedication :P
@AviFS https://
 
Hahaha, I swear it isn't
@cairdcoinheringaahing Beatcha!
Ah, shoot
 
(if you want a fast BF interpreter, just transpile the characters to some C expressions and clang -O3 or whatever)
 
9:53 PM
Wrong link, smh
 
@dzaima yeah, that's exactly what the one on TIO does :p
idk about the clang -O3 tho
 
@hyper-neutrino oh right, i thought i saw it somewhere. Didn't even read the code posted here ಠ_ಠ
 
In case that expires and we want to use it:
#define LIM 10
...
\#) echo 'for(int i=0; i<LIM; i++) {(p==i)? printf("[%d]", t[i]) : printf(" %d ", t[i]);} putchar(10);';;
 
it's golfier and easier to understand if you inline the ternary into the format string like printf(p == i ? "[%d]" : " %d ", t[i]);, at least IMHO
 
@hyper-neutrino it's gcc -O3, close enough (and there's precisely zero way a python program is beating that)
 
9:56 PM
ah
 
WOWOOWOW
I've never coded in C tbh
Good to know, thanks!
 
converts brainfuck to machine code in memory
and executes it
 
Ouchy...
 
x=>x - compiles brainfuck code to brainfuck
 
9:58 PM
@EliteDaMyth gcc -O3 will do that, but also apply a ton of regular optimizations (i've seen it optimize the fancy BF constant calculations to just mov rax, 85 or whatever)
 
I imagine the C is faster though, since I'm sure it optimizes a lot before converting to machine code
 
iirc, code.golf uses the one i linked
 
you could probably manually do a crap ton of pre-processing and optimizing on the brainfuck code itself
 
@hyper-neutrino bf, 0 bytes. Takes input via concatenation to the source code, transpiles bf to bash, then C then bf :P
 
10:12 PM
(Last change for now, this pads to make sure 3 digit numbers [0..255] don't ruin the spacing)
\#) echo 'for(int i=0; i<LIM; i++) {printf((p==i)? " %3d*": " %3d ", t[i]);} putchar(10);';;
 
11:06 PM
Searching for burn yields an awful lot of messages posted by me (and that search doesn't seem to include a couple more with the characters "burn" in them)
 
@pxeger The more interesting thing in that document to me: they've finally caved and are adding (a more powerful version of) a case statement! :^0 I always understood that was something Python was never ever going to do.
 
iirc the reason it took so long was because they wanted to do it right
 
[still reading] I'll be the judge of that! (jk)
 
Well, it does seem to lack custom extractors, which is another reason Python is bad and everyone should use Scala, which totally doesn't have any weird features
 
I haven't heard of custom extractors. Got an example?
 
val customer2ID = CustomerID("Nico")
val CustomerID(name) = customer2ID
println(name)  // prints Nico
Okay, that's pretty cool.
Well, maybe Python will see fit to stea to adapt that feature in a future version.
 
@DLosc Here
 
11:37 PM
I'm going to post it when I get back, but I just finished a BF answer to this question
The shortest Python and JS as of now are 24 & 22 bytes, respectively. With some answers in those langs going up into the 40s. Does anyone have a guess for how long the BF answer is?
 
200 ish?
There's going to be some way to isolate the second input byte, then there's various different hashes from that that'll be fairly long in bf
 
second byte would just be ,,
 
..oh yeah, I'm dumb
 
Haha, you've correctly guessed the first two bytes of my program!
@cairdcoinheringaahing 200 chars or 200 bytes?
 
Aren't they the same for bf?
 
11:45 PM
(I'm dividing by 3 to get bytes)
 
Do you have an interpreter that accepts octal-encoded bf?
 
Given the confusion, I'm guessing you meant chars
 
I read about this in the meta, I thought there was, but now I got myself confused bc 8^3=/256
Wait, or are there 6
 
But if you don't have an interpreter which can accept the specific byte stream you're claiming as the length, then you can't claim that length
 
11:47 PM
FYI, the optimally (uniformly) compressed BF variant is this
 
Yeah, nevermind that piece
 
@Bubbler Is that proven optimal, or just the current best?
 
@Bubbler Interesting thanks
But sorry, back to chars. Curious what you guys would expect for a BF program
Remember you can't just calculate the number and print it
You have to print each digit
 
Each BF command can be encoded in 3 bits, which can make exactly 3/8 length of original BF code
 
Oh yeah, that's how it works, thanks!
I knew it was something to do with 8 & 3, but it was 2^3==8, haha
Not 8^3==256, which it doesn't
 
11:50 PM
@AviFS You can output integers as characters by default
 
@AviFS You can print single number in BF, we allow it in the default rules
 
.......................
I swear to ..........
 
Does that save ~50% of your chars? :P
 
Darn, haha
I spent over a day on this, not proud of it
 
Of course the number you want to print should be within the bound of the BF cell
but there's always a BF interpreter that supports 32-bit cells and such
 
11:51 PM
I searched 'output brainfuck' in meta in different ways and couldn't find anything
 
We're too general for that :P
 
Because it's not specific to brainfuck
 
Oh...
Well now I know!
But I'm still pretty happy with it
 
yesterday, by caird coinheringaahing
@xash You may be thinking of this, which allows numbers to be input/output as characters, not the other way around
 
The hash function is optimized for BF
 
11:52 PM
I recommend to dig through the entirety of Default I/O post at least once
 
It calculates the digits of the number
Rather than the number itself
 
to get the hang of how we're generous in I/O formats
 
@cairdcoinheringaahing So it doesn't really save a single bit, haha
But it's pretty cool; it's case insensitive
 
@AviFS That definitely makes your code interesting
 
@Bubbler That's a really good idea, thanks
And the case-insensitive part too, I think
 
11:54 PM
@AviFS Yeah, that's a very interesting approach, I think that's unique of the answers
 
It said we could take titlecase, lowercase or uppercase, but it can do anything
Phew!!
@cairdcoinheringaahing Thanks for thinking so, haha
 
I#m guessing it doesn't rely on a hashing algorithm then? :P
 
It still does...
But two of them
The first digit is always 1
And it does two iterative hash functions on the input
To get the second two digits
 
Cool
@cairdcoinheringaahing More well-compressed BF variant would probably be Sesos
 

« first day (3799 days earlier)      last day (1027 days later) »