« first day (4120 days earlier)      last day (568 days later) » 

12:00 AM
BitCycle works for me. Any opposed?
Ah, classic dupneg bomb :P
Welcome to the eighteenth Learn You A Lang for Great Good! Today, we'll be learning BitCycle, a minimalist language that involves moving bits around a 2D playfield. During the event, feel free to post CMCs to practice BitCycle (BCMCs), ask questions about the language, and so on.
ok cool so how does it work
Online BitCycle interpreters: TIO | JS interpreter with visualization
How does signed/unsigned int output work?
@DLosc @JoKing pin?
12:06 AM
@AidenChow So the basic concept is that you've got a playfield and you've got bits. Bits move around the playfield. At each step, all the bits move one space simultaneously.
Bits are either 1 or 0.
i have to refamiliarise myself, but i believe signed has a zero prepended to indicate negative, and unsigned will just be n bits
They can interact with various devices, which can change their direction, duplicate them, output them, and so forth.
um ok... so where do the bits start
either a source (input) or the ones and zeros that start on the playfield
...this whole time i had bitcycle mixed up with bitwise cyclic tag
i was fucking dreading this lyal
12:08 AM
and confused as to how it got votes in the first place
@AidenChow You can put bits onto the starting playfield by putting a 1 or 0 in the program, or you can use the ? device for input.
@DLosc oh ok u should prob put that first on the github docs, i assume bits are important in this lang ??
to get rid of them, you direct them out of the playfield or put them in a sink (output)
@AidenChow So here's a simple example showing how the bits move (try the Step button if Run is too fast to see what's going on).
Green diamonds are 1 bits, blue circles are 0 bits
And here's a simple example with input. The input 10 comes out of the ? source one bit at a time. Note how the splitter / is used to split off the first bit and make it go a different direction.
12:13 AM
so confused already but ok
It's gonna be confusing ^_^
so can i input anything other than bits
There are two modes that let you input numbers
by converting the numbers to streams of bits
ah ok that cool
12:16 AM
-u lets you input a list of unsigned integers. It converts the integers to unary and uses 0 to separate them. For example, an input of 1,2,3 is converted to 10110111.
! is output right
but like its not outputting anything?
oh nvm
actually blind
BCMC: infinitely print the powers of 2
This one was kinda fun
Hint: It uses a dupneg bomb
ok so how do ! work if it is num instead of bit
12:18 AM
It does the same conversion in reverse.
what is dupneg bomb
First question is, what is dupneg
dupneg is that ~ thing right
cant really understand what it doing tho
Yep. When a bit goes into it, two bits come out: a duplicated version and a negated version.
The copy turns right, the negative copy turns left.
If you feed the outputs of a dupneg back into the dupneg, each of the two bits will get duplicated again, so you'll have four bits. Then if you feed those four back in, you'll get eight... and so on with exponential growth. This is very similar to how a fork bomb works, so when emanresu A posted one tonight, I called it a dupneg bomb.
what, why is there out1 and out2
12:27 AM
You've got two sinks. Each of them represents a separate output.
:| so the bits have to go to same one to output once
@emanresuA 14 bytes definitely could be shorter
-3 bytes with an extra 0,1 at the front
BCMC: Given a stream of bits, output the first two bits and discard the rest.
@DLosc i can do one bit but not two :((((
12:31 AM
What's your one bit code?
what chat formatting is weird
not really sure how it works but it works
not complaining tho :D
Yep, good. Now what could you do to split a second bit off?
idk, not even too sure how it works
For simple programs, it often helps if you add a bunch of spaces and blank lines (making sure everything still lines up) and step through it.
i think the \ change direction or smth
like it bounce one way but now it bounce another way, idk
12:34 AM
It's a splitter: the first bit to hit it bounces off as if it were a diagonal wall, but all the bits after that pass straight through.
@DLosc not really helping, it kinda looks like they all disappear somewhere
@DLosc oh wait rly
oh ok i got it then
i think
@AidenChow Yeah, I can see how that'd be confusing. They disappear because they go off the edge of the playfield.
@AidenChow Bingo!
BCMC: Given two unsigned integers (using the -u flag), output their sum.
@DLosc lol i was just working on that
wait whats the difference between unsign and sign integers
^ i think this works???
12:39 AM
@AidenChow Yes--that's actually the answer to what was gonna be my next BCMC, which is "Sum a list of unsigned integers"
oh right, i was thinking with two sources lol
wait u can have two ? too
how does that work
@AidenChow In signed mode, it's still unary, but any non-positive number has a 0 on the front. 3 is 111, -3 is 0111, 0 is 0
12:41 AM
wait how do u input with two source
You put the inputs on separate lines
@DLosc oh, that seem a lot more complicated to sum
not sure how to approach that one :\
@AidenChow No kidding.
i dont understand collectors at all
what do they do
I was just about to start on those ;)
So collectors store all the bits that run into them, in order.
When there are no more bits on the playfield, a set of collectors opens and releases its stored bits, one at a time.
12:45 AM
oh ok that is interesting
Is there anyone willing to share which country they are from and their COVID status? For me, I am from China and my neiborhood is in lockdown.
so all collector are closed at beginning right
* I'm not 100% sure of implementation details if you put a lowercase letter in your code
so just don't do that :P
huh, i thought u made the lang??
how u not know what happen
Anyone can give me some advice? esolangs.org/wiki/BrainFuck%2B
12:48 AM
@NumberBasher in US, and nothing much honestly. my school district recently removed mask mandate at schools
China has serious problems now
@NumberBasher i think joking is pretty good at it if im not mistaken
oh wait
theres a +
nvm idk
Especially Shanghai which is me
Which collectors come open first depends on alphabetical order. So for example, the A collectors always open if they have any bits in them. But if no A collectors have bits, then the B collectors open. If neither A nor B has bits, then C opens, etc. For example.
Like 70% neiborhoods are lockdown in SHanghai
some arent even permitted to leave their room
12:49 AM
@DLosc ohh thats nice, not too sure when i would use this tho lol
@AidenChow There's a fair amount of undefined behavior, and I don't remember how I implemented it exactly. The JavaScript implementation does some things differently from the Python implementation.
seem very situational to me
@NumberBasher Ouch
Not me
but i mean why risk it
@AidenChow Well I made that language and based it on bf
@AidenChow This is actually very foundational to nontrivial programming in BitCycle, because it allows you to create loops and handle arbitrarily long streams of bits.
12:51 AM
yet another brainfuck derivative
I think there's at least 50+ bf "derivatives" like Oops! just substitution
@NumberBasher eh theres a lot of brainfuck spinoffs already, what makes urs different from the rest
you can stack lists/arays
@NumberBasher your table is kinda messed up
maybe adding example programs would help too
12:52 AM
just kinda
yah i didnt fix that up joking
@DLosc how so
so technically if you want to you can make it 100 dimensional
how to make conditional loop anyways
But I don't see any use there
12:53 AM
@AidenChow \`s and =`s reset when the collector closes
@JoKing when all collector close or just one ??
Technically, when a set of collectors open.
^, sorry
I think looking at the interpreter is sometimes
the best way to learn an
so my interpreter is here
12:56 AM
BCMC: Given a stream of bits, output every second bit and discard the others.
@NumberBasher i would much rather look at documentation than the actual interpreter
cannot tell what is going on in there at all
maybe comment the code a little
to show what its doing
@AidenChow Yah I mean I would probably look at the doc and then
if i dont understand it
i'll check the interpreter
(or if there's some stuff it didnt talk about, implementation details
@DLosc man that seem very hard to do
remember to use two collectors to avoid bits entering a collector that's still open
Are URLs case sensitive?
1:01 AM
@AidenChow Start from the example loop I gave and find a way to modify it.
@NumberBasher i'm pretty sure the non-domain part is
uh could u check if this is correct: dloscutoff.github.io/Esolangs/BitCycle/…
I mean, it's a bit overkill, but it works ^_^
that seems to do the first bit and every bit after technically
1:04 AM
@JoKing hm i think i could change it to do the other way around (hopefully)
@AidenChow My version
i think that works
13 bytes?!?!
what am i doing wrong
not gonna look at the solution yet
One thing you'll learn quickly is that Jo King is an absolute wizard at this language. Routinely outgolfs me.
1:06 AM
man i got it down to 18 bytes
not even close to 13
i like 2D langs, you can do usually do a lot of rearranging to remove whitespace
@JoKing BCMC: Given a list of unsigned integers, output their mean (rounded down).
Hmm, can someone check the formatting now? esolangs.org/wiki/BrainFuck%2B
oh boy, division
1:08 AM
holy, how do u even start with that
division ???
but round down
:\ that sounds impossible
I have some ideas, but it's gonna be a bit complex, which is why I gave it to Jo King specifically. ;)
round down makes it seem possible...
is there neg numbers support
is there a way to check neg nums?
29 mins ago, by DLosc
@AidenChow In signed mode, it's still unary, but any non-positive number has a 0 on the front. 3 is 111, -3 is 0111, 0 is 0
1:10 AM
@NumberBasher uhhhh, u can output negative numbers...
the numbers are represented as bits (1 and 0) flowing through 2d map so it a little different from regular langs
i mean
holy shit
> a little different
what you have to do:
A little understatement ^_^
* func to check non-pos actually
* func to subtract
* func to add 1
* func to sum
* func to input
* func to output
1:12 AM
i think u have to check if num of bits u r subtracting from is smaller than or equal to the thing u r dividing by, which idk how to do
unsign make it simpler of course
what i have in mind
you subtract
and then check if it is neg
but i've never seen that lang so I cant give anything useufl
there are no negative bits if thats what u r suggesting
its only 1 and 0
Well, since we're talking about signs...
BCMC: Output the sign of an input number: -1 if negative, 1 if positive, 0 if zero.
I'm pretty sure i can do it in brainfuck
What is bcmc
BitCycle Mini Challenge
1:13 AM
* chat mini challenge
Usually we post CMCs, Chat Mini Challenges. During the language learning event every other week, we post challenges that are specific to the language we're learning.
oh u combine b and c to bitcycle lol
CMC: make a python interpreter in brainf*ck
Because most of the challenges that are reasonably doable in BitCycle would be far too easy in most languages.
@JoKing ok i give up, im looking at this
bruh wtf
1:15 AM
what is going on
same logic, just rearranged
you can still follow the arrows and make sense of it all
@JoKing what
I was thinking
wait how come it go to the right after B
@AidenChow Try it with the Expand with Spaces checkbox ticked--that helps you see which way the bits are flowing.
1:17 AM
i thought it would just flow out, what am i missing
@AidenChow it always exits right from collectors
ohhh, that makes sense
CMC: print "Hello, World! " with only "H", "e", ..., "!", " ". To make it even harder, case sensitive and you cannot use HQ9+ :-)
please don't spam CMCs, especially when we're in the middle of an lang-specific event
HQ9++: H
1:19 AM
@JoKing Ok
For your language is the only input method BITS???
@DLosc not sure how to go about this tbh :|
@NumberBasher u can input nums too
Which programming language
wait -1 is 00 right
@AidenChow Think about what bits you need to output in each case, and where you can get those bits from the input.
@AidenChow 01
The 0 is basically a - sign
oh oops ye, meant to put 1
1:21 AM
which language
@NumberBasher bitcycle
look on starboard
its the first pinned msg
wait for +, does it turn based on what direction it going or just right and left on the board
@AidenChow Based on what direction it's going.
like if facing down, if it turn right then is it actually going left
ah ok got it
i didnt miss anything hopefully
i did miss smth
ok idrk then
only messes up for 1 i think
everything else works
1:31 AM
Yep, very close
idk how to deal with that :(
I have faith in you :)
shoot i got smth that outputs 2 for positive, this is sad
oh wait theres this switch thing that might be useful, didnt see it before
I think it's doable with or without switch, but I will say my golfed solution uses a switch.
1:44 AM
@DLosc I THINK I GOT SMTH THAT WORKS: dloscutoff.github.io/Esolangs/BitCycle/…
oh yay bitcycle
works for 0 and 1
CMC: Infinitely print fibonacci numbers
This should be fun
@emanresuA :| idk
@AidenChow Very nice!
1:46 AM
seem very hard to do
@DLosc is that the same solution u got ?
@AidenChow It's a task very well suited to BitCycle, actually: add two unsigned integers repeatedly in a loop.
oh wait i think i can golf that down a little more
@AidenChow It's the same logic, but mine is arranged differently and is therefore 1 byte shorter.
I also found a 9-byte solution without a switch.
i mean 9
how u get in 6 :\
That's 8 bytes, and my solution is the same 8 bytes, just upside-down. :)
1:49 AM
oh lolol
BCMC: Given a signed integer, divide it by 2 (truncating toward 0).
hmmmmmmmmmmm what how to divide in bitcycle lol
Hint: dividing by 2 is almost identical to a program you've written already ;)
really? i dont see it
oh u mean the one where u take out every other bit
@DLosc ungolfed, but i believe this should work
1:57 AM
@JoKing dang what is going on in there?!?!
more importantly how did u implement division
@JoKing Hmm... using undefined behavior I see :P
@AidenChow separate the 0s and 1s from the input into different stacks, interweave them, Whenever you see a 0, discard the next bit, if you see a 1, print a 1 and interweave the zeroes again
@DLosc undefined behaviour is best behaviour
wats the undefined behavior
i think you can flip the interweaving anyway by adding a newline
pushing two bits into a collector at the same time
It's undefined which of them comes out first if they both enter the collector on the same tick.
2:02 AM
so which one comes out first :P
Depends :P
shows up, waves, then runs in the background quietly
@ThomasWard hello diamond mod!
@emanresuA i have no idea whats going on but i like to watch the bits flow around :)
2:04 AM
Neither do I, really
@emanresuA watching bitflow is fun but if you let it run it eventually just is like watching paint dry I think... :P
Yeah :P
@JoKing Looks like it also works on TIO, so you're in luck ;)
@emanresuA even at 10mil ticks per second it gets slow after 233 xD
It's probably not actually running 10mil tps
2:07 AM
no probably not but it gets exponentially slower over time so :0
@JoKing Why do you need to add 1 to the total?
it only outputs a 1 after it exhausts the 0s, but there's none left if it's exactly divisible
@DLosc i think this works for u divide by 2 cmc: dloscutoff.github.io/Esolangs/BitCycle/…
ah shoot nope
not working for negative even nums for some reason
Ooh, close though. The "take off the sign bit, discard a 1, and put the sign bit back" strategy is an interesting idea.
A: Fibonacci function or sequence

emanresu ABitCycle -u, 67 bytes v < v1< v1< Bv>CAv v~~ v< > Cv> ! v~~ > ^ \ 101^ Try it online! It's beautiful... I have some idea of how this works. The A, B and C are collectors. when the field is empty, the first non-empty collector (sorting in alphabetical order) has all collectors ...

2:18 AM
@emanresuA close enough? i can't figure out how to initialise this
oh, i've already answered this lol
@JoKing Lol, what? Interesting sequence
@JoKing Oh :P
@JoKing 0,1,1,1,1,2,2,3,8... close
keep going
Works fine, the start is just fricked up
@AidenChow -4 => 01111 => 0111 => outputs 01 = -1
2:25 AM
BCMC: Subtract two unsigned numbers. the one you want to be larger will be larger.
ah shoot i made some changes now its not working on positive even nums
cant seem to figure this one out
When in doubt, just handle them separately
> Your class has receive one extra day to present, because the class is half again as large as my other classes.
This is supposed to be my english teacher
@emanresuA idk how to differentiate between even and odd :\
I mean between positive and negative
2:37 AM
I'm sure it can be golfed
I'm trying to learn from Jo King's techniques, such as storing two numbers in the same collector using 1s for one and 0s for the other, and interleaving two numbers using undefined behavior. ;)
A: Sandbox for Proposed Challenges

Number BasherPalindromic Powers Powers We define an important power as a number that can be represented as \$ x^y \$ where \$ x >= 2 \$ and \$ y>=2 \$. Palindrome We define an important palindrome as a number that is the same written forwards and backward, and is greater than 10. Thus, the last digit must not...

bcmc: factorial of unsigned integer
oh no
2:47 AM
oh no oh no
BCMC: Multiply unsigned integers
i dont understand bitcycle
@emanresuA lol that would probably be simpler, but idek how to do this :(
@emanresuA 14 bytes presuming they can't be equal
@Steffan me too
the specs are pretty simple, but very hard to code in
wut u guys confused about?
2:57 AM
Frick app inventor again
To give you an idea of how programming is, I trhrew an error by gettting the .5th character of an (error message) string because setting it up to halt properly would be worse

« first day (4120 days earlier)      last day (568 days later) »