Add tags

Add tags to the following comment
Brainf*ck入門しました。もう頭の中がカオスです。
割り算と if ~ else 構造がもっと簡単に使えたらいいのになぁ。。。

コメントは参考サイトに習ってつけてみました。出鱈目英語でごめんなさい。コメントの中に、つい「-」などを入れてしまい嵌ること多々。

実行結果(4桁の数字を入力し、閏年だったら1を出力)
19000
20001
20081
21000
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
●コメント版(#以降の文字と、空白・改行はコメントです。)
# {3} = input two-digit number
>> ,.<++++++[->--------<]> [->++++++++++<] ,.<++++++[->--------<]> [->+<]
<<
# {2} = input two-digit number
> ,.<++++++[->--------<]> [->++++++++++<] ,.<++++++[->--------<]> [->+<]
<
# if ( {2} not zero ) then {3} = !{2} ; pointer moves to {3}.
>> [>[-]<[->+<]]
>
# subtract 4 from {3} while ( {3} != 0 ), and if remainder exists then {5} is not 0.
>++++<                     # {4} = 4
[>                         # while ({3}) {
  [->+>+>+<<<]             #   {5:6:7} = !{4}
  >>
    >[-<<<+>>>]<           #   {4} = !{7}
    [                      #   while ({6}) {
      <<< [->>>>+<<<<]     #     {7} = !{3}
      >>>>[                #     if ({7} not zero) {
        -[-<<<<+>>>>]<<->> #       {3} = !{7} minus 1 ; decr({5})
      ]<                   #     }
      -                    #     decr({6})
    ]                      #   }
  <<
<]                         # }
# show result
<+++++++[->+++++++<]>      # {3} = 49
>>[[-]<<->>]<<             # if ({5} not zero) then decr({3})
.                          # putchar({3})


●コメントなし版
>>,.<++++++[->--------<]>[->++++++++++<],.<++++++[->--------<]>[->+<]<<>,.<++++++[->--------<]>[->++++++++++<],.<++++++[->--------<]>[->+<]<>>[>[-]<[->+<]]>>++++<[>[->+>+>+<<<]>>>[-<<<+>>>]<[<<<[->>>>+<<<<]>>>>[-[-<<<<+>>>>]<<->>]<-]<<<]<+++++++[->+++++++<]>>>[[-]<<->>]<<.

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...