Content-Length: 109222 | pFad | https://ig.wikipedia.org/wiki/Brainfuck

Brainfuck - Wikipedia, Njikotá édémédé nke onyobulạ Jump to content

Brainfuck

Shí Wikipedia, njikotá édémédé nke onyobulạ

  Page Templeeti:Multiple issues/styles.css has no content.[1]Brainfuck bụ asụsụ mmemme esoteric nke Urban Müller mepụtara na 1993.[1] Ihe ama ama maka oke minimalism ya, asụsụ ahụ nwere naanị iwu asatọ dị mfe, ihe nrịbama data na ntụzịaka ntuziaka.

Brainfuck bụ ihe atụ nke ihe a na-akpọ Turing tarpit: enwere ike iji ya dee mmemme ọ bụla, mana ọ bụghị ihe bara uru ime nke ahụ, n'ihi na Brainfuck na-enye ntakịrị abstraction nke na mmemme na-adị ogologo ma ọ bụ mgbagwoju anya. Ọ bụ ezie na Brainfuck zuru ezu na Turing, echereghị ya maka iji ya eme ihe, kama ọ na-ama ndị na-eme ihe nkiri na-atọ ọchị.[3][4] Brainfuck chọrọ ka mmadụ mebie iwu n'ime usoro ihe omimi.

Aha asụsụ a na-ezo aka n'okwu slang brainfuck, nke na-ezo aka n'ihe ndị gbagwojuru anya ma ọ bụ ihe na-adịghị ahụkebe nke na ha gafere oke nghọta mmadụ, n'ihi na e bughi ya ma ọ bụ mee ya maka ịmepụta ngwa ngwa n'ezie kama ọ na-agbagha ókè nke mmemme kọmputa.

[2]'ihi na aha asụsụ ahụ nwere okwu mkparị, a na-eji ọtụtụ ihe dochie anya ya, dị ka brainfsck, branflakes, brainoof, brainfrick, BrainF, na BF.

Akụkọ ihe mere

[dezie | dezie ebe o si]

Müller chepụtara Brainfuck na ebumnuche nke imejuputa mkpokọta kacha nta,[6] sitere n'ike mmụọ nsọ 1024-byte maka asụsụ mmemme FALSE.[7] Emebere ihe nchịkọta mbụ nke Müller n'asụsụ igwe wee chịkọta ya na ọnụọgụ abụọ nwere nha 296 bytes. Ọ bulitere onye nchịkọta Brainfuck nke mbụ na Anet na 1993. Ihe mmemme ahụ nwere faịlụ "Readme", nke kọwara asụsụ ahụ nkenke, wee maa onye na-agụ akwụkwọ aka "Ònye nwere ike iji ya hazie ihe ọ bụla bara uru? :)". Müller tinyekwara onye ntụgharị okwu na ụfọdụ ọmụmaatụ. Ụdị nke abụọ nke mkpokọta ejiri naanị 240 bytes.[3]

Ewezuga iwu I/O abụọ ya, Brainfuck bụ obere mgbanwe nke asụsụ mmemme P′′ nke Corrado Böhm mepụtara na 1964, nke dabere na igwe Turing. N'ezie, iji akara isii dabara na iwu Brainfuck dị iche iche +, -, <,>, [,], Böhm nyere mmemme doro anya maka ọrụ ọ bụla bụ isi nke jikọtara ọnụ na-agbakọ ọrụ mgbako ọ bụla. Ya mere mmemme "Brainfuck" mbụ pụtara na akwụkwọ Böhm's 1964 - na ha zuru ezu iji gosi na Turing zuru oke.

Nhazi asụsụ

[dezie | dezie ebe o si]

Asụsụ ahụ nwere iwu asatọ. Usoro ihe omume brainfuck bụ usoro nke iwu ndị a, ikekwe na-agwakọta ya na ihe odide ndị ọzọ (nke a na-eleghara anya). A na-eme iwu ndị ahụ n'usoro, ma e wezụga ụfọdụ: ntụziaka ntụziaka na-amalite na iwu mbụ, na iwu ọ bụla ọ na-ezo aka na ya na-eme, mgbe nke ahụ gasịrị ọ na-aga n'ihu na iwu ọzọ. Usoro ihe omume ahụ na-akwụsị mgbe ntụziaka ntụziaka gafere iwu ikpeazụ.

Asụsụ brainfuck na-eji ihe nlereanya igwe dị mfe nke nwere usoro ihe omume na ntụziaka ntụziaka, yana usoro otu akụkụ nke ọ dịkarịa ala mkpụrụ ndụ byte 30,000 malitere na efu; ihe ngosi data a na-ebugharị (nke a malitere iji gosipụta na byte aka ekpe nke usoro ahụ); na iyi abụọ nke bytes maka ntinye na mmepụta (nke a na-ejikọkarị na keyboard na nyocha, yana iji koodu ASCII).

Iwu asụsụ asatọ nke ọ bụla nwere otu onye:

Omume Ihe ọ pụtara
> Bụbawanye ihe ngosi data site na otu (iji gosi mkpụrụ ndụ na-esote n'aka nri).
< Wepụ ihe ngosi data site na otu (iji gosi mkpụrụ ndụ na-esote n'aka ekpe).
+ Bụbawanye byte na data pointer site na otu.
- Wepụ byte na data pointer site na otu.
. Wepụta byte na data pointer.
, Nweta otu byte nke ntinye, na-echekwa uru ya na byte na pointer data.
[ Ọ bụrụ na byte na akara data bụ efu, mgbe ahụ kama ịkwaga akara ntụziaka n'ihu na iwu ọzọ, bulie ya n'ihu gaa na iwu ahụ mgbe iwu ahụ kwekọrọ.
] Ọ bụrụ na byte na data pointer bụ nonzero, mgbe ahụ kama ịkwaga ntụziaka pointer gaa n'ihu na iwu ọzọ, tụgharịa ya na iwu mgbe iwu ahụ kwekọrọ.[lower-alpha 1]

kwekọrọ dị ka parentheses na-emekarị: nke ọ bụla [ kwekọrọ kpọmkwem otu ] na vice versa, [ na-ebu ụzọ, ọ nweghịkwa ike ịbụ [ ma ọ bụ ] na-enweghị atụ n'etiti abụọ ahụ.[ and ][ or ]

Dị ka aha ahụ na-egosi, mmemme Brainfuck na-esikarị ike ịghọta. Nke a bụ n'otu akụkụ n'ihi na ọrụ ọ bụla dị mgbagwoju anya chọrọ usoro iwu dị ogologo na n'otu n'ihi nde ederede mmemme ahụ enyeghị ihe ngosi kpọmkwem nke ọnọdụ mmemme ahụ. Ndị a, yana adịghị arụ ọrụ nke Brainfuck na ikike ntinye / mmepụta ya, bụ ụfọdụ n'ime ihe kpatara na anaghị eji ya eme ihe maka mmemme siri ike. Ka o sina dị, dị ka asụsụ Turing ọ bụla zuru ezu, Brainfuck nwere ike ịkọwapụta ọrụ ọ bụla a na-agbakọ ma ọ bụ mepụta ụdị mgbakọ ọ bụla ọzọ, ma ọ bụrụ na enyere ohere ịnweta ebe nchekwa na-akparaghị ókè.[4] Edere usoro mmemme Brainfuck dịgasị iche iche.[5] Ọ bụ ezie na mmemme Brainfuck, ọkachasị ndị dị mgbagwoju anya, siri ike ide, ọ bụ ihe na-enweghị isi ide onye ntụgharị maka Brainfuck n'asụsụ dị ka C n'ihi ịdị mfe ya. E nwere ọbụna ndị ntụgharị Brainfuck e dere n'asụsụ Brainfuck n'onwe ya.[6][7]

Ihe Nlereanya

[dezie | dezie ebe o si]

Ịgbakwunye ụkpụrụ abụọ

[dezie | dezie ebe o si]

Dị ka ihe atụ mbụ, nke dị mfe, koodu koodu na-esonụ ga-agbakwunye uru nke mkpụrụ ndụ dị ugbu a na mkpụrụ ndụ na-esote: Oge ọ bụla a na-eme loop, a na-ebelata mkpụrụ ndụ dị iche iche, ihe ngosi data na-aga n'aka nri, na mkpụrụ ndụ ọzọ na-abawanye, na ihe ngosi data ahụ na-agagharị n'aka ekpe ọzọ. A na-ekwughachi usoro a ruo mgbe mkpụrụ ndụ mmalite bụ 0.

[->+<]

Enwere ike itinye nke a n'ime usoro mgbakwunye dị mfe dị ka ndị a:

++       Cell c0 = 2
> +++++  Cell c1 = 5

[        Start your loops with your cell pointer on the loop counter (c1 in our case)
< +      Add 1 to c0
> -      Subtract 1 from c1
]        End your loops with the cell pointer on the loop counter

At this point our program has added 5 to 2 leaving 7 in c0 and 0 in c1
but we cannot output this value to the terminal since it is not ASCII encoded

To display the ASCII character "7" we must add 48 to the value 7
We use a loop to compute 48 = 6 * 8

++++ ++++  c1 = 8 and this will be our loop counter again
[
< +++ +++  Add 6 to c0
> -        Subtract 1 from c1
]
< .        Print out c0 which has the value 55 which translates to "7"!

Hello World!

[dezie | dezie ebe o si]
[ This program prints "Hello World!" and a newline to the screen; its
  length is 106 active command characters. [It is not the shortest.]

  This loop is an "initial comment loop", a simple way of adding a comment
  to a BF program such that you don't have to worry about any command
  characters. Any ".", ",", "+", "-", "<" and ">" characters are simply
  ignored, the "[" and "]" characters just have to be balanced. This
  loop and the commands it contains are ignored because the current cell
  defaults to a value of 0; the 0 value causes this loop to be skipped.
]
++++++++                Set Cell #0 to 8
[
    >++++               Add 4 to Cell #1; this will always set Cell #1 to 4
    [                   as the cell will be cleared by the loop
        >++             Add 2 to Cell #2
        >+++            Add 3 to Cell #3
        >+++            Add 3 to Cell #4
        >+              Add 1 to Cell #5
        <<<<-           Decrement the loop counter in Cell #1
    ]                   Loop until Cell #1 is zero; number of iterations is 4
    >+                  Add 1 to Cell #2
    >+                  Add 1 to Cell #3
    >-                  Subtract 1 from Cell #4
    >>+                 Add 1 to Cell #6
    [<]                 Move back to the first zero cell you find; this will
                        be Cell #1 which was cleared by the previous loop
    <-                  Decrement the loop Counter in Cell #0
]                       Loop until Cell #0 is zero; number of iterations is 8

The result of this is:
Cell no :   0   1   2   3   4   5   6
Contents:   0   0  72 104  88  32   8
Pointer :   ^

>>.                     Cell #2 has value 72 which is 'H'
>---.                   Subtract 3 from Cell #3 to get 101 which is 'e'
+++++++..+++.           Likewise for 'llo' from Cell #3
>>.                     Cell #5 is 32 for the space
<-.                     Subtract 1 from Cell #4 for 87 to give a 'W'
<.                      Cell #3 was set to 'o' from the end of 'Hello'
+++.------.--------.    Cell #3 for 'rl' and 'd'
>>+.                    Add 1 to Cell #5 gives us an exclamation point
>++.                    And finally a newline from Cell #6
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

Usoro ihe omume a na-eji ROT13 cipher edepụta ntinye ya. Iji mee nke a, ọ ga-egosipụta mkpụrụedemede A-M (ASCII 65-77) na N-Z (78-90), na vice versa. Ọzọkwa ọ ga-eme map a-m (97-109) na n-z (110-122) na vice versa. Ọ ga-akọwa ihe odide ndị ọzọ niile n'onwe ha; ọ na-agụ ihe odide otu n'otu ma na-ewepụta ihe ha na-edepụta ruo mgbe ọ na-agụrụ EOF (ebe a na-eche na a ga-anọchite anya ya dị ka -1 ma ọ bụ "enweghị mgbanwe"), ebe mmemme ahụ kwụsịrị.

-,+[                         Read first character and start outer character reading loop
    -[                       Skip forward if character is 0
        >>++++[>++++++++<-]  Set up divisor (32) for division loop
                               (MEMORY LAYOUT: dividend copy remainder divisor quotient zero zero)
        <+<-[                Set up dividend (x minus 1) and enter division loop
            >+>+>-[>>>]      Increase copy and remainder / reduce divisor / Normal case: skip forward
            <[[>+<-]>>+>]    Special case: move remainder back to divisor and increase quotient
            <<<<<-           Decrement dividend
        ]                    End division loop
    ]>>>[-]+                 End skip loop; zero former divisor and reuse space for a flag
    >--[-[<->+++[-]]]<[         Zero that flag unless quotient was 2 or 3; zero quotient; check flag
        ++++++++++++<[       If flag then set up divisor (13) for second division loop
                               (MEMORY LAYOUT: zero copy dividend divisor remainder quotient zero zero)
            >-[>+>>]         Reduce divisor; Normal case: increase remainder
            >[+[<+>-]>+>>]   Special case: increase remainder / move it back to divisor / increase quotient
            <<<<<-           Decrease dividend
        ]                    End division loop
        >>[<+>-]             Add remainder back to divisor to get a useful 13
        >[                   Skip forward if quotient was 0
            -[               Decrement quotient and skip forward if quotient was 1
                -<<[-]>>     Zero quotient and divisor if quotient was 2
            ]<<[<<->>-]>>    Zero divisor and subtract 13 from copy if quotient was 1
        ]<<[<<+>>-]          Zero divisor and add 13 to copy if quotient was 0
    ]                        End outer skip loop (jump to here if ((character minus 1)/32) was not 2 or 3)
    <[-]                     Clear remainder from first division if second division was skipped
    <.[-]                    Output ROT13ed character from copy and clear it
    <-,+                     Read next character
]                            End character reading loop
  • JSFuck - akụkụ dị omimi nke asụsụ mmemme Javascript nke nwere obere ihe odide

Ihe edeturu

[dezie | dezie ebe o si]

.mw-parser-output .reflist{font-size:90%;margin-bottom:0.5em;list-style-type:decimal}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}

Ebensidee

[dezie | dezie ebe o si]
  1. Easter (2020-04-02). "Fully Human, Fully Machine: Rhetorics of Digital Disembodiment in Programming". Rhetoric Review 39 (2): 202–215. DOI:10.1080/07350198.2020.1727096. ISSN 0735-0198. 
  2. brainfuck - Esolang. esolangs.org. Retrieved on 2024-02-07.
  3. Aminet - dev/lang/brainfuck-2.lha. Aminet. Retrieved on 2023-04-30.
  4. BF is Turing-complete. Iwriteiam.nl. Retrieved on 2023-04-30.
  5. Index of /esoteric/brainfuck/bf-source/prog. sange.fi (2002-01-22). Retrieved on 2023-04-30.
  6. BF interpreter written in BF. Iwriteiam.nl. Retrieved on 2023-04-30.
  7. brainfuck interpreter. Daniel B. Cristofani.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://ig.wikipedia.org/wiki/Brainfuck

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy