Skip to main content
Commonmark migration
Source Link

#Answer 14, Del|m|t, 15

Answer 14, Del|m|t, 15

#Explanation

Explanation

###How it works at the low level

How it works at the low level

###How it works at the high level

How it works at the high level

##Progress Towards Brain-Flak

Progress Towards Brain-Flak

#Answer 14, Del|m|t, 15

#Explanation

###How it works at the low level

###How it works at the high level

##Progress Towards Brain-Flak

Answer 14, Del|m|t, 15

Explanation

How it works at the low level

How it works at the high level

Progress Towards Brain-Flak

added 1160 characters in body
Source Link
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661

Explanation to come ###How it works at the low level

To start we have O R ^ V this serves to take input on the first loop and works as a no-op all other times.

We then use O to make a copy of the input for later.

@ A K T recalls the variable stored in memory position -1 (at the beginning of the program this is 0) and A J increments it. O @ A K U Stores the now incremented value back in memory position -1 for our next loop around.

N calculates the mod of the copy of the input we made a while back and the value just recalled from memory and R negates it.

Together N R create a boolean that indicates whether or not the our input is divisible by the TOS.

We store a copy of this boolean to memory space -2 using O @ B K U and recall the value from memory space -2 using @ A K T.

We swap the top two elements with Q to ensure that the boolean is on top and output the value if the boolean is true using ^ X.

If the boolean was false we have an extra value that needs to be eradicated so we recall the boolean we stored in space -2 with @ B K T and pop a value if it is false R ^ P.

We duplicate the input value with O and subtract the value at memory -1 with @ A K T K. If this is zero we exit R ^ _.

Lastly we have @ ^ this skips whatever the next value is. We need this because there is a bunch of junk (actually only a @ symbol) generated by the visible portion of the code.

Once it reaches the end it loops back to the beginnning.

###How it works at the high level

The basic idea is that we have a value primarily stored at memory location -1 that is incremented each time we loop. If that value divides our input we output it and when the two are equal we end execution.

Explanation to come

###How it works at the low level

To start we have O R ^ V this serves to take input on the first loop and works as a no-op all other times.

We then use O to make a copy of the input for later.

@ A K T recalls the variable stored in memory position -1 (at the beginning of the program this is 0) and A J increments it. O @ A K U Stores the now incremented value back in memory position -1 for our next loop around.

N calculates the mod of the copy of the input we made a while back and the value just recalled from memory and R negates it.

Together N R create a boolean that indicates whether or not the our input is divisible by the TOS.

We store a copy of this boolean to memory space -2 using O @ B K U and recall the value from memory space -2 using @ A K T.

We swap the top two elements with Q to ensure that the boolean is on top and output the value if the boolean is true using ^ X.

If the boolean was false we have an extra value that needs to be eradicated so we recall the boolean we stored in space -2 with @ B K T and pop a value if it is false R ^ P.

We duplicate the input value with O and subtract the value at memory -1 with @ A K T K. If this is zero we exit R ^ _.

Lastly we have @ ^ this skips whatever the next value is. We need this because there is a bunch of junk (actually only a @ symbol) generated by the visible portion of the code.

Once it reaches the end it loops back to the beginnning.

###How it works at the high level

The basic idea is that we have a value primarily stored at memory location -1 that is incremented each time we loop. If that value divides our input we output it and when the two are equal we end execution.

added 1160 characters in body
Source Link
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661

#Answer 14, Del|m|t, 15

                                                f!%QTS|Q"@░┼_¥f!vUGw((({})<>)){((({}[()]<n=int(input({})(<>))><>)<{i=1div=while(({})){({}<>)){ifn%i==0div.append(i)i=i+1}printdiv)}#R{}T.eX╜R;`;╜%Y*`M∩

Try it online!

#Explanation

I am really starting to abuse the fact that whitespace is not counted towards the difference here. Del|m|t doesn't really care all that much what characters you you so the vast majority of the code is a sequence of spaces and carriage returns at the beginning of the program. The actual visible parts of the code are not executed at all.

Here is the code transcribed into a more "reasonable" fashion:

O R ^ V O @ A K T A J O @ A K U N R O @ B K U @ A K T Q ^ X @ B K T R ^ P O @ A K T K R ^ _ @ ^ @

Try it online!

Explanation to come

##Progress Towards Brain-Flak

Because whitespace does not count towards the difference I was able to change the code without spending any of my 15 points and thus all of them were invested into the Brain-Flak code.

Here is our current standing.

((({})<>)){((({}[()]<(({})(<>))><>)<{(({})){({}     <>                 )   )  {(          )  })}{}
((({})<>)){((({}[()]<(({})(<>))><>)<{(({})){({}[()])<>}{}}{}<>([{}()]{})><>)<>{(<{}<>{}<>>)}{})}{}

#Answer 14, Del|m|t, 15

                                                f!%QTS|Q"@░┼_¥f!vUGw((({})<>)){((({}[()]<n=int(input({})(<>))><>)<{i=1div=while(({})){({}<>)){ifn%i==0div.append(i)i=i+1}printdiv)}#R{}T.eX╜R;`;╜%Y*`M∩

Try it online!

#Answer 14, Del|m|t, 15

                                                f!%QTS|Q"@░┼_¥f!vUGw((({})<>)){((({}[()]<n=int(input({})(<>))><>)<{i=1div=while(({})){({}<>)){ifn%i==0div.append(i)i=i+1}printdiv)}#R{}T.eX╜R;`;╜%Y*`M∩

Try it online!

#Explanation

I am really starting to abuse the fact that whitespace is not counted towards the difference here. Del|m|t doesn't really care all that much what characters you you so the vast majority of the code is a sequence of spaces and carriage returns at the beginning of the program. The actual visible parts of the code are not executed at all.

Here is the code transcribed into a more "reasonable" fashion:

O R ^ V O @ A K T A J O @ A K U N R O @ B K U @ A K T Q ^ X @ B K T R ^ P O @ A K T K R ^ _ @ ^ @

Try it online!

Explanation to come

##Progress Towards Brain-Flak

Because whitespace does not count towards the difference I was able to change the code without spending any of my 15 points and thus all of them were invested into the Brain-Flak code.

Here is our current standing.

((({})<>)){((({}[()]<(({})(<>))><>)<{(({})){({}     <>                 )   )  {(          )  })}{}
((({})<>)){((({}[()]<(({})(<>))><>)<{(({})){({}[()])<>}{}}{}<>([{}()]{})><>)<>{(<{}<>{}<>>)}{})}{}
Source Link
Wheat Wizard
  • 100k
  • 22
  • 282
  • 661
Loading