0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

brainfuck 0の時だけ実行するコード #2

Last updated at Posted at 2025-01-10

コード

0の時だけ実行するコードをjsで書いてみる

if(input == 0){
    //コード
}

brainf*ckには、0ではない時に実行できるコードがあります
,[[-]#コード#]
なので、==0を!=0に変えて、コードを書いてみます。

let j = false;
if(, !== 0){
    j = true;
}
if(!j){
    //コード
}

このままbrainfuckに変えます

+        let j = false;
>,[      if(, !== 0){
<->          j = true;
[-]]     }
<[[-]>      if(j){
コード
<]    }

最終的に>,[<+>[-]]<[[-]>コード<]
とすることで0なら実行するコードができます!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?