<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Lor.Dal.Col.blog</title>
	
	<link>http://www.lordalcol.com/blog</link>
	<description>code, design, thoughts...</description>
	<pubDate>Thu, 11 Jun 2009 14:53:50 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/lordalcol" /><feedburner:info uri="lordalcol" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Quelle Passion</title>
		<link>http://feedproxy.google.com/~r/lordalcol/~3/NaAtSR5xMio/</link>
		<comments>http://www.lordalcol.com/blog/2009/06/11/quelle-passion/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 14:52:56 +0000</pubDate>
		<dc:creator>Lorenzo Dal Col</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lordalcol.com/blog/?p=52</guid>
		<description><![CDATA[
Ho finalmente terminato la prima fase di un grosso lavoro iniziato a gennaio 2009.
Si chiama Quelle Passion e ha sede a Bruxelles, in Belgio. Ecco in poche parole di cosa si tratta:

Restaurants Quelle Passion
è la guida di Bruxelles che propone una serie di ristoranti selezionati sia per la qualità della loro cucina che per gli [...]]]></description>
			<content:encoded><![CDATA[<div style="margin: 0px; padding: 0.6em; color: #000000; background-color: #ffffff; font-family: 'Lucida Grande','Lucida Sans Unicode',Tahoma,Verdana,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-size-adjust: none; font-stretch: normal; -x-system-font: none;">
<p>Ho finalmente terminato la prima fase di un grosso lavoro iniziato a gennaio 2009.</p>
<p>Si chiama Quelle Passion e ha sede a Bruxelles, in Belgio. Ecco in poche parole di cosa si tratta:</p>
<blockquote>
<h3 style="font-size: 1.17em;"><a title="Restaurants Quelle Passion a Brussels" href="http://www.quellepassion.eu" target="_blank">Restaurants Quelle Passion</a></span></h3>
<p>è la guida di Bruxelles che propone una serie di ristoranti selezionati sia per la qualità della loro cucina che per gli ambienti proposti e il servizio offerto.</p>
<p>Prenotando un tavolo per due persone con la tua membership card QUELLE<span class="red">PASSION</span><span class="Apple-converted-space"> </span>riceverai la promozione offerta da tutti i ristoranti che fanno parte del network e potrai risparmiare fino al <span class="red">40%</span><span class="Apple-converted-space"> </span>su un conto di due persone.</p></blockquote>
<p>Presto scriverò qualcosa sulle tecnologie che ho utilizzato.</p>
<p><strong class="Apple-style-span" style="font-weight: bold;">Screenshot:</strong></p>
<p><a title="Quelle Passion Restaurants in Bruxelles" href="http://www.quellepassion.eu" target="_blank"><img class="alignnone" src="http://www.evernote.com/shard/s4/res/eb141044-6b5a-408e-8da3-3b1a3caabfe8.png" alt="Quelle Passion Site" /></a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.lordalcol.com/blog/2009/06/11/quelle-passion/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.lordalcol.com/blog/2009/06/11/quelle-passion/</feedburner:origLink></item>
		<item>
		<title>1 anno, 22000 visite, e migliaia di maiali nello schermo</title>
		<link>http://feedproxy.google.com/~r/lordalcol/~3/FXeal_DhCr8/</link>
		<comments>http://www.lordalcol.com/blog/2008/11/01/1-anno-22000-visite-e-migliaia-di-maiali-nello-schermo/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 08:35:27 +0000</pubDate>
		<dc:creator>Lorenzo Dal Col</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lordalcol.com/blog/?p=49</guid>
		<description><![CDATA[Dopo esattamente 1 anno di vita tiro le somme del mio primo sito web personale che è durato più di qualche mese.
So di non aver fatto molti post, anzi proprio pochini confrontandomi con il &#8220;blogger perfetto&#8221; che scrive una volta al giorno, partecipa ai blog camp, blog bar, blog dinner, facebook, twitter, myspace, e tutto [...]]]></description>
			<content:encoded><![CDATA[<p>Dopo esattamente <strong>1 anno di vita</strong> tiro le somme del mio primo sito web personale che è durato più di qualche mese.</p>
<p>So di non aver fatto molti post, anzi proprio pochini confrontandomi con il &#8220;blogger perfetto&#8221; che scrive una volta al giorno, partecipa ai blog camp, blog bar, blog dinner, facebook, twitter, myspace, e tutto il resto, non annoia i visitatori, mette un sacco di link interni tra i post, o addirittura non mette alcun link in un post sperando che i visitori clicchino la pubblicità&#8230; (sono tutte cose vere e lette in giro).</p>
<p><a href="http://www.lordalcol.com/blog/wp-content/uploads/2008/11/blog2008.gif"><img class="alignright alignnone size-medium wp-image-50" style="float: right;" title="blog2008" src="http://www.lordalcol.com/blog/wp-content/uploads/2008/11/blog2008-300x180.gif" alt="" width="300" height="180" /></a></p>
<p>In ogni caso pochi ma buoni, nel senso che ho scritto solamente i post ritenuti necessari da me, per pubblicare un po&#8217; dei <strong>miei lavori</strong> fatti negli ultimi tempi, qualche scoperta/aiuto che potrebbe venire in aiuto a qualche visitatore (inizio a saldare il debito che ho nei confronti della Rete), e pure qualche <a href="http://www.lordalcol.com/blog/spider-pork-widget/">porkata</a>&#8230;</p>
<p>I risultati sono in ogni caso più che soddisfacenti, poichè ho ricevuto in anno più di <strong>20000 visite uniche</strong>.</p>
<p>Il merito di tutto questo traffico ce l&#8217;ha principalmente il <em>maiale che cammina sullo schermo</em>, come ho visto scrivere in un forum un po&#8217; di tempo fa. Ci sono centinaia di blog con lo &#8220;spider pork widget&#8221; e la cosa mi stupisce&#8230; grazie a tutti! <img src='http://www.lordalcol.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Qualche altro migliaio di persone cerca una soluzione a problemi noti: bug css in internet exporer, assoluta impossibilità di accedere a windows xp in modalità amministratore (<em>grazie microsoft&#8230;</em>), problemi con le coordinate di google maps&#8230;</p>
<p><strong>Della gente è riuscita ad arrivare nel mio blog cercando le seguenti parole in google:</strong></p>
<blockquote><p>widget simpatici, col of diuty 4, aprire attivita commerciali all&#8217;estero, non ho mai inserito password amministratore per console di ripristino,  alieni, call of duty rilanciare granate, casse per munizioni in legno ww2, clip animate alcolismo, donatori di fondi, femo etimologia greca, gif animata maiale che cammina, interventi blog msn non ci capisco + nulla, maiale pork bolg, november svezia rock, programmazione esoterica, stream live donne nude, powerballtabs maps, password administrator acer è&#8230;</p></blockquote>
<p>Mi dispiace per coloro che saranno rimasti delusi non trovando donne nude in streaming, casse di legno e gli alieni.</p>
<p><a href="http://www.lordalcol.com/blog/wp-content/uploads/2008/11/blog2008.gif"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lordalcol.com/blog/2008/11/01/1-anno-22000-visite-e-migliaia-di-maiali-nello-schermo/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.lordalcol.com/blog/2008/11/01/1-anno-22000-visite-e-migliaia-di-maiali-nello-schermo/</feedburner:origLink></item>
		<item>
		<title>Brainfuck Tutorial</title>
		<link>http://feedproxy.google.com/~r/lordalcol/~3/Nc5c-kTH2F8/</link>
		<comments>http://www.lordalcol.com/blog/2008/10/11/brainfuck-tutorial/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 12:21:04 +0000</pubDate>
		<dc:creator>Lorenzo Dal Col</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lordalcol.com/blog/?p=48</guid>
		<description><![CDATA[Brainfuck Tutorial
This document may be distributed freely if unchanged.
If anything in this tutorial is incorrect then let me know.
Contents

Prologue
The operators
Data, pointers &#38; bytes
Legend of notations
Brainfuck interpreter
Your first steps
&#8216;[&#8217; and &#8216;]&#8217;
Dividing
Moving &#38; copying
If then
Logical ports
Signatures
Just something extra
Epilogue



Prologue
Brainfuck is a so-called esoteric programming language, meaning it&#8217;s &#8220;intentionally unusual&#8221; (Chris Pressey). Brainfuck was invented by Urban Müller, whose [...]]]></description>
			<content:encoded><![CDATA[<h1>Brainfuck Tutorial</h1>
<p>This document may be distributed freely if unchanged.</p>
<p>If anything in this tutorial is incorrect then let me know.</p>
<h2>Contents</h2>
<ul>
<li><a href="http://www.nieko.net/bf.php#Prologue">Prologue</a></li>
<li><a href="http://www.nieko.net/bf.php#The%20operators">The operators</a></li>
<li><a href="http://www.nieko.net/bf.php#Data,%20pointers%20&amp;%20bytes">Data, pointers &amp; bytes</a></li>
<li><a href="http://www.nieko.net/bf.php#Legend%20of%20notations">Legend of notations</a></li>
<li><a href="http://www.nieko.net/bf.php#Brainfuck%20interpreter">Brainfuck interpreter</a></li>
<li><a href="http://www.nieko.net/bf.php#Your%20first%20steps">Your first steps</a></li>
<li><a href="http://www.nieko.net/bf.php#%27%5B%27%20and%20%27%5D%27">&#8216;[&#8217; and &#8216;]&#8217;</a></li>
<li><a href="http://www.nieko.net/bf.php#Dividing">Dividing</a></li>
<li><a href="http://www.nieko.net/bf.php#Moving%20&amp;%20copying">Moving &amp; copying</a></li>
<li><a href="http://www.nieko.net/bf.php#If%20then">If then</a></li>
<li><a href="http://www.nieko.net/bf.php#Logical%20ports">Logical ports</a></li>
<li><a href="http://www.nieko.net/bf.php#Signatures">Signatures</a></li>
<li><a href="http://www.nieko.net/bf.php#Just%20something%20extra">Just something extra</a></li>
<li><a href="http://www.nieko.net/bf.php#Epilogue">Epilogue</a></li>
</ul>
<p><a name="Prologue"></a></p>
<h2><a name="Prologue"><span id="more-48"></span></a></h2>
<h2><a name="Prologue">Prologue</a></h2>
<p>Brainfuck is a so-called esoteric programming language, meaning it&#8217;s &#8220;intentionally unusual&#8221; (Chris Pressey). Brainfuck was invented by Urban Müller, whose goal was to create the smallest possible compiler. The second version of this compiler was 240 bytes in size (compiled ASM)! Urban Müller also wrote an interpreter in C:</p>
<pre>char m[9999],*n[99],*r=m,*p=m+5000,**s=n,d,c;main(){for(read(0,r,4000);c=*r;
r++)c-']'||(d&gt;1||(r=*p?*s:(--s,r)),!d||d--),c-'['||d++||(*++s=r),d||(*p+=c==
'+',*p-=c=='-',p+=c=='&gt;',p-=c=='&lt;',c-'.'||write(2,p,1),c-','||read(2,p,1));}</pre>
<p>A few years later, an even smaller compiler was made by Raiter, but this time in binary form. It was 171 bytes in size and ran under Linux. There was a compiler for DOS as well, which was 136 bytes in size!</p>
<p>While brainfuck is a very restrictive language (only 8 operators can be used, no variable names, etc.), it&#8217;s still Turing Complete, i.e. any computational task can be performed.<br />
<a name="The operators"></a></p>
<h2><a name="The operators">The operators</a></h2>
<p>Brainfuck only has 8 operators that are all written as a single character, but despite its restrictiveness, any program that can be written in pure C can be written in brainfuck too.</p>
<p>The 8 operators are: +-&lt;&gt;[].,</p>
<ul class="normal">
<li>+  increase byte under pointer</li>
<li>-  decrease byte under pointer</li>
<li>&gt;  increase pointer</li>
<li>&lt;  decrease pointer</li>
<li>[  start a loop if byte under pointer is not 0</li>
<li>]  return to matching [</li>
<li>.  print byte under pointer to standard output (often screen)</li>
<li>,  read input from standard input (often keyboard) to byte under pointer</li>
</ul>
<p><a name="Data, pointers &amp; bytes"></a></p>
<h2><a name="Data, pointers &amp; bytes">Data, pointers &amp; bytes</a></h2>
<p>To store and read data, an array of 30,000 bytes is used. This array is like an array of cells, where each cell represents a byte:</p>
<pre>[0]  [3]  [1]  [24]  [123]  [2]  [1]  [5]  [3]  [8]
^</pre>
<p>Above are the first 10 bytes, the pointer points to byte 2.  Initially, all bytes are set to 0 and the pointer points to the first byte:</p>
<pre>[0]  [0]  [0]  [0]  [0]  [0]  [0]  [0]  [0]  [0]
^</pre>
<p>From now on, I&#8217;ll refer to bytes as pn (pointer-n) and to its value as vn (value-n). So when I write p2v5 I mean that the pointer points to byte 2 and that byte 2 has a value of 5:</p>
<pre>[ ]  [5]  [ ]  [ ]  [ ]  [ ]  [ ]  [ ]  [ ]  [ ]
^</pre>
<p>The values of the other bytes are not displayed, because they aren&#8217;t known, I only mentioned p2v5, so other values are unknown. For further notations, see LEGEND OF NOTATIONS (below). Since the array consists of bytes, the maximum value a pointer can have is 255. If p1v255 is increased by 1 it&#8217;ll become p1v0. Likewise, if p1v0 is decreased by 1 it&#8217;ll become p1v255.  <a name="Legend of notations"></a></p>
<h2><a name="Legend of notations">Legend of notations</a></h2>
<table border="0">
<tbody>
<tr>
<td>p3</td>
<td>pointer 3, value unknown</td>
</tr>
<tr>
<td>v25</td>
<td>last mentioned pointer has value 25</td>
</tr>
<tr>
<td>p2v5</td>
<td>pointer 2 has a value of 5</td>
</tr>
<tr>
<td>p1v/3</td>
<td>pointer 1&#8217;s value is increased by 3</td>
</tr>
<tr>
<td>p5v\2</td>
<td>pointer 5&#8217;s value is decreased by 2</td>
</tr>
<tr>
<td>p8v!0</td>
<td>pointer 8 has a non-zero value</td>
</tr>
<tr>
<td>p6v!13</td>
<td>pointer 6 has a value that is not 13</td>
</tr>
</tbody>
</table>
<p>Instead of + and -, / and \ are used, since +&#8217;s and -&#8217;s shouldn&#8217;t be used in comments (the interpreter will not ignore them!) This notation is useful when a byte&#8217;s value is unknown, but its value is changed anyway.</p>
<p>Mnemonic: / leads upwards=increasing and \ leads downwards=decreasing.</p>
<p>N.B.: pointer = byte = position in array  <a name="Brainfuck interpreter"></a></p>
<h2><a name="Brainfuck interpreter">Brainfuck interpreter</a></h2>
<p>Before you start programming, you should make sure you have a brainfuck Interpreter. A brainfuck Interpreter executes your code and takes care of input and output. My interpreter can be downloaded from the previous page, or you can write your own!</p>
<p>N.B.: brainfuck source code can contain non-brainfuck characters like ;(*:=1!@#$ since the interpreter will just ignore them. Therefore, my examples can be copied to the interpreter with comments. However, some people have added their own operators to the original brainfuck language, like # (statusdump IIRC). My interpreter will ignore these characters, but some other interpreters might not!  <a name="Your first steps"></a></p>
<h2><a name="Your first steps">Your first steps</a></h2>
<p>Let&#8217;s start with the following program (&#8221;Hello World&#8221; will come later):</p>
<pre>,                       ;reads character from standard input to byte
under pointer
.                       ;print byte under pointer to screen</pre>
<p>Now let&#8217;s start manipulating the input:</p>
<pre>,                       ;read character
+                       ;increase byte
.                       ;print byte</pre>
<p>So, if input was &#8216;e&#8217;, then the output will be &#8216;f&#8217;.  Next, let&#8217;s change a lowercase letter to an uppercase letter:</p>
<pre>,                       ;read character
----------------
----------------        ;decrease byte by 32
.                       ;print byte</pre>
<p>The ASCII value of a lowercase letter is always 32 higher than its matching uppercase letter, so to print an uppercase letter, the value read from input has to be decreased by 32.  Next two letters are read, one is stored in p1 and the other in p2:</p>
<pre>,                       ;read character and store it in p1
&gt;                       ;move pointer to p2 (second byte)
,                       ;read character and store it in p2
&lt;                       ;move pointer back to p1 (first byte)
.                       ;print p1 (first byte)
&gt;                       ;move pointer to p2
.                       ;print p2 (second byte)</pre>
<p><a name="'[' and ']'"></a></p>
<h2><a name="'[' and ']'">&#8216;[&#8217; and &#8216;]&#8217;</a></h2>
<p>Now that you know how to work with +-&lt;&gt;,. Let&#8217;s switch over to &#8216;[&#8217; and &#8216;]&#8217;. &#8216;[&#8217; and &#8216;]&#8217; basically act as a loop, while the byte under pointer has a non-zero value the loop gets executed.</p>
<pre>++++                    ;p1v4
[                       ;execute loop if p1 has non-zero value
-                     ;decrease p1; p1v3 p1v2 p1v1 and p1v0
]                       ;look for matching counterpart
;p1v0</pre>
<p>With these brackets a multiplication can be performed:</p>
<pre>++++                    ;p1v4
[                       ;enter loop
&gt;                      ;p2
+++                    ;p2v/3
&lt;                      ;p1
-                      ;p1v\1
]                       ;end loop
&gt;                       ;p2v12</pre>
<p>First, p1v4. When the loop is entered, p2v/3, and p1v\1. This pattern is repeated until p1v0, so the loop is gone through four times. p2 is increased by 3 4 times, so eventually p2v12. Voilà, you&#8217;ve multiplied 4 and 3.</p>
<p>And finally, the moment you&#8217;ve all been waiting for, &#8220;Hello World!&#8221; This one requires a little introduction though. In brainfuck, output is given as text, and not as a number (value):</p>
<pre>+++++++++++             ;p1v11
[&gt;++++++++++&lt;-]&gt;+.      ;p1v111; display 'o'</pre>
<p>p2v111, and since &#8216;o&#8217; has value 111, &#8216;o&#8217; is displayed. Likewise, any other letter can be displayed. An ASCII chart can be found here:<br />
<a href="http://www.jelks.nu/XML/ASCIIchart.html">http://www.jelks.nu/XML/ASCIIchart.html</a><br />
Hello World!</p>
<pre>++++++++[&gt;+++++++++&lt;-]&gt;.;p1v0 p2v72    72=H
&lt;+++++[&gt;++++++&lt;-]&gt;-.    ;p1v0 p2v101  101=e
+++++++..               ;p2v108       108=l
+++.                    ;p2v111       111=o
&lt;++++++++[&gt;&gt;++++&lt;&lt;-]&gt;&gt;. ;p1v0 p3v32    32=&lt;space&gt;
&lt;&lt;++++[&gt;------&lt;-]&gt;.     ;p2v87         87=W
&lt;++++[&gt;++++++&lt;-]&gt;.      ;p2v111       111=o
+++.                    ;p2v114       114=r
------.                 ;p2v108       108=l
--------.               ;p2v100       100=d
&gt;+.                     ;p3v33         33=!</pre>
<p>I hope you now understand why &#8220;Hello World&#8221; shouldn&#8217;t be your first brainfuck program, it&#8217;s way too difficult.  <a name="Dividing"></a></p>
<h2><a name="Dividing">Dividing</a></h2>
<p>You already know how to add, subtract and multiply, so dividing remains. The following program divides 15 by 3:</p>
<pre>+++++++++++++++         ;p1v15
[                       ;loop
&gt;+&lt;---                 ;p2v/1 p1v\3
]                       ;end of loop</pre>
<p>During every loop 3 gets substracted from 15, and eventually p1v0. The answer (15/3=5) is stored in p2.</p>
<p>There is however one problem regarding division: the result must be an integer, i.e. not a fraction. Here is why: if you would try to divide 15 by 6, then during every loop 6 would be substracted from 15, resulting in 15, 9, 3, -3=253! The result will never be 0, so the program will get stuck in an infinite loop. Notice that this is not a limitation of brainfuck as a language, but of this particular method in general.  <a name="Moving &amp; copying"></a></p>
<h2><a name="Moving &amp; copying">Moving &amp; copying</a></h2>
<p>Use the following program to move data from one cell to another:</p>
<pre>[                       ;loop
&gt;+&lt;-                   ;p2v/1 p1v\1
]</pre>
<p>Say, p1v5. The loop will be executed five times, p2v5, and p1v0.  You can also use this construction to multiply a byte with a fixed amount:</p>
<pre>[                       ;loop
&gt;+++&lt;-                 ;p2v/3 p1v\1
]</pre>
<p>Say, p1v5. The loop will be executed five times, and p2v15. But if you want p1 to be multiplied to itself, you&#8217;ll have to move p2 to p1 afterwards.</p>
<p>N.B.: Make sure that p2v0 so that p2 will indeed get the value you want it to get. If p2 already has a non-zero value then something like this might happen:</p>
<pre>&gt;+++&lt;                   ;p2v3 p1
+++++                   ;p1v5
[
&gt;+++&lt;-                 ;p2v/3 p1v\1
]</pre>
<p>Instead of p2v15, p2v18 will apply, which is not 3 * 5. To prevent this, you should empty the byte first:</p>
<pre>&gt;                       ;p2
[                       ;loop
-                      ;execute loop until byte is empty
]                       ;exit loop</pre>
<p>Or, in short, [-]</p>
<p>Copying is almost like moving, but to copy p1 to p2, an extra byte is needed as workspace. First, p1 is moved to p3, where p3 is the workspace:</p>
<pre>[&gt;&gt;+&lt;&lt;-]                ;move p1 to p3</pre>
<p>Now p3 is moved to p2 and p1:</p>
<pre>&gt;&gt;                      ;p3
[
&lt;+                     ;p2v/1
&lt;+                     ;p1v/1
&gt;&gt;                     ;p3
-                      ;p3v\1
]</pre>
<p>Voilà, p1 is copied to p2, and p3 is emptied.</p>
<p>N.B.: always make sure that at the beginning of a loop the pointer points to the same byte as at the end, because after reaching &#8216;]&#8217; the interpreter will return to the matching &#8216;[&#8217;, and the loop might be executed again. The pointer should then point to the same byte as at the start of the previous loop. (Notice that this is a beginner&#8217;s rule of thumb, when you&#8217;re an advanced brainfuck-programmer, you might want to ignore this rule (and you should too ;).)</p>
<p>Next is a program that reads two numbers from keyboard and multiplies them:</p>
<pre>&gt;,                      ;input p2
&gt;++++++[&lt;--------&gt;-]    ;p2v\48   input 0 has value 48
,                       ;input p3
&gt;++++++[&lt;--------&gt;-]    ;p3v\48   input 5 has value 53

&lt;&lt;                      ;p2
[                       ;loop
&gt;[&gt;&gt;+&lt;&lt;-]&gt;&gt;[&lt;+&lt;+&gt;&gt;-]&lt;  ;copy p3 to p4
[&lt;&lt;&lt;+&gt;&gt;&gt;-]&lt;&lt;           ;move p4 to p1
-                      ;p2v\1
]
&lt;                       ;p1</pre>
<p><a name="If then"></a></p>
<h2><a name="If then">If then</a></h2>
<p>A programming language is nothing without IF-THEN-constructions. Luckily, IF-THEN-constructions can be made in brainfuck, using [ and ]. A [ ]-loop is only entered _IF_ the value under pointer has a non-zero value:</p>
<pre>[                       ;enter loop if p1 has non-zero value
&gt;++++++++              ;p2v8
[&gt;+++++++++&lt;-]        ;p3v72
&gt;.                     ;display p3
&lt;&lt;                     ;p1
[-]                    ;p1v0 so that the loop only gets executed once
]</pre>
<p>Say, p1v3, the loop is entered and &#8216;H&#8217; (value 48h=72d) is displayed. But if p1v0, the loop will not be entered and nothing is displayed, so only IF p1 has a non-zero value the loop gets executed.</p>
<p>N.B.: p1v0 after the loop, so if you want to use the value again, you should have backed it up (by copying) in another byte.</p>
<p>It&#8217;s nice to be able to display something if a byte is not 0, but it would be even nicer to display something if a byte has a certain value, including 0! To do this, first, the value of the byte has to be reduced by number you want to compare it with. Let&#8217;s test p1 to see if its value is 64:</p>
<pre>,                       ;read input
----------------
----------------        ;p1v\64
----------------
----------------</pre>
<p>If p1 was v64, then now p1v0. If you program a loop that displays something right now, it would only be entered if p1v!0, but you want the exact opposite. Therefore, a so-called NOT-port can be used, and p2 is a temporary byte. Change p2 to p2v1:</p>
<pre>&gt;[-]+&lt;                  ;p2v1 p1</pre>
<p>Next you program a loop that does nothing more than empty p2, but only if p1v!0:</p>
<pre>[                       ;enter loop if p1v!0
&gt;                      ;p2
[-]                   ;p2v0
&lt;                      ;p1
[-]                    ;p1v0 so you can exit the loop
]</pre>
<p>The above loop is the NOT-port: if p1v0 then p2v1 and if p1v!0 then p2v0. As you can see, p2v1 if p1 was v64, but p2v0 if p1 was v!64.  Next, the part that displays something:</p>
<pre>&gt;                       ;p2
[                       ;enter loop if p2v!0 and p1 was v64
&gt;++++++++              ;p3v8
[&gt;++++++++&lt;-]          ;p4v64
&gt;.                     ;display '@'
&lt;&lt;                     ;p2
[-]                    ;p2v0 so you can exit the loop
]</pre>
<p>The &#8216;@&#8217; is only displayed if p1 was v64, so you&#8217;ve just programmed your first real IF-construction! The program as a whole:</p>
<pre>,                       ;read input
----------------
----------------        ;p1v\64        you can change this value to anything
----------------                       you want; 64 is the value you compare
----------------                       p1 with
&gt;[-]+&lt;                  ;p2v1 p1
[                       ;enter loop if p1v!0
&gt;                      ;p2
[-]                   ;p2v0
&lt;                      ;p1
[-]                    ;p1v0 so you can exit the loop
]
&gt;                       ;p2
[                       ;enter loop if p1 was v64
&gt;++++++++              ;p3v8
[&gt;++++++++&lt;-]          ;p4v64
&gt;.                     ;display '@'
&lt;&lt;                     ;p2
[-]                    ;p2v0 so the loop gets executed only once
]</pre>
<p>Now it&#8217;s also really easy to check whether a byte has a value other than e.g. 64:</p>
<pre>,                       ;read input
----------------
----------------        ;p1v\64
----------------
----------------
[                       ;enter loop if p1 was v!64
&gt;++++++++              ;p2v8
[&gt;++++++++&lt;-]          ;p3v64
&gt;.                     ;display '@'
&lt;&lt;                     ;p1
[-]                    ;p1v0 so you can exit the loop
]</pre>
<p>Besides IF-THEN-constructions, it is also possible to create IF-THEN-ELSE- constructions:</p>
<pre>,                       ;read input
----------------
----------------        ;p1v\64
----------------
----------------
&gt;&gt;&gt;+&lt;&lt;&lt;                 ;p4v1 since p1 through p3 are used
[                       ;enter loop if p1 was v!64          \
&gt;+++++++++++++         ;p2v13                              |
[&gt;++++++&lt;-]            ;p3v78                              |
&gt;.                     ;display 'N'                        | ELSE part
&gt;-                     ;p4v0                               |
&lt;&lt;&lt;                    ;p1                                 |
[-]                    ;p1v0 so you can exit the loop      /
]
&gt;&gt;&gt;                     ;p4
[                       ;enter loop if p4v1 and p1 was v64  \
&lt;&lt;                     ;p2                                 |
++++++++               ;p2v8                               |
[&gt;++++++++&lt;-]          ;p3v64                              | IF part
&gt;.                     ;display '@'                        |
&gt;                      ;p4                                 |
[-]                    ;p4v0 so you can exit the loop      /
]</pre>
<p>If the input was an &#8216;@&#8217; (value 40h=64d), an &#8216;@&#8217; will be displayed, otherwise a &#8216;N&#8217; (Not) will be displayed.  <a name="Logical ports"></a></p>
<h2><a name="Logical ports">Logical ports</a></h2>
<p>Although there are twelve (some might argue twenty, whatever logical ports), only AND, OR, XOR and NOT will be discussed here.</p>
<p>For those unfamiliar with logical ports, here&#8217;s a short introduction: A logical port is an information manipulator. AND, OR and XOR ports receive two inputs, while a NOT port receives only one input. The output of a logical port is either 0 or 1, depending on the value(s) of the input(s). 0 is called &#8216;false&#8217;, and !0 (non-zero) is called &#8216;true&#8217;.</p>
<ul class="normal">
<li>An AND port will only give 1 as output if both input1 AND input2 are true,   i.e. have non-zero values, the output will be 0 in all other cases, e.g.   input1 = true (!0) and input2 = false (0).</li>
<li>An OR port will give 1 as output if input1 OR input2 OR both are true, the   only case in which the output is 0 is when both inputs are 0.   This port is called an Inclusive OR, or just OR.</li>
<li>A XOR port will give 1 as output if input1 or input2 is true, but not if   both are true. The output will be 0 if both inputs are true or both inputs   are non-true.   This port is called an eXclusive OR, or XOR.</li>
<li>A NOT port will give 1 as output if input1 is false, and 0 as output if   input1 is true.</li>
</ul>
<p>Overview:</p>
<pre>  AND:                OR:                XOR:                NOT:
IN1  0 0 1 1        IN1  0 0 1 1       IN1  0 0 1 1        IN1  0 1
IN2  0 1 0 1        IN2  0 1 0 1       IN2  0 1 0 1        --------
------------        ------------       ------------        OUT  1 0
OUT  0 0 0 1        OUT  0 1 1 1       OUT  0 1 1 0</pre>
<p>Anyway, back to brainfuck&#8230;</p>
<p>AND:<br />
Output is 1 if both inputs are true. p1 is output, p2 and p3 are inputs:</p>
<pre> [-]                    ;p1v0
&gt;                      ;p2
[                      ;enter loop if p2 is true
&gt;                     ;p3
[                     ;enter loop if p3 is also true
&lt;&lt;+&gt;&gt;                ;p1v1
[-]                  ;empty p3
]
&lt;                     ;empty p2
[-]
]
&lt;                      ;p1</pre>
<p>p1v1 only if p2v!0 AND p3v!0, else p1v0</p>
<p>OR:<br />
Output is 1 if at least one input is true. p1 is output, p2 and p3 are inputs, p4 is temporary byte:</p>
<pre> [-]                    ;p1v0
&gt;                      ;p2
[&gt;&gt;+&lt;&lt;[-]]             ;p4v/1 if p2v!0
&gt;                      ;p3
[&gt;+&lt;[-]]               ;p4v/1 if p3v!0
&gt;                      ;p4
[&lt;&lt;&lt;+&gt;&gt;&gt;[-]]           ;p1v1 if p4v!0</pre>
<p>p1v1 only if p2v!0 OR p3v!0, else p1v0. The last line is necessary to make sure p1v1 and not p1v2 (if both inputs are true).</p>
<p>XOR:<br />
Output should only be 1 if sum of inputs is 1. p1 is output, p2 and p3 are inputs, p4 is temporary byte:</p>
<pre> [-]                    ;p1v0
&gt;&gt;&gt;[-]&lt;&lt;               ;p4v0 p2
[&gt;&gt;+&lt;&lt;[-]]             ;p4v/1
&gt;                      ;p3
[&gt;+&lt;[-]]               ;p4v/1
&gt;-                     ;p4v\1 p4v0 if XOR is true
&lt;&lt;&lt;+&gt;&gt;&gt;                ;p1v1 p4
[&lt;&lt;&lt;-&gt;&gt;&gt;[-]]           ;p1v\1
&lt;&lt;&lt;                    ;p1</pre>
<p>p1v1 only if p2v!0 XOR p3v!0, else p1v0</p>
<p>NOT:<br />
Output should be 1 if input is 0. p1 is output, p2 is input:</p>
<pre> [-]+                   ;p1v1
&gt;[&lt;-&gt;[-]]&lt;             ;p1v0 if p2v!0</pre>
<p>p1v1 only if p2v!0</p>
<p>Of course, you can also combine these ports to create ports such as IN1 AND NOT(IN2), or IN1 NAND IN2.  <a name="Signatures"></a></p>
<h2><a name="Signatures">Signatures</a></h2>
<p>If you&#8217;re all crazy about brainfuck or just like it really much, you can try to make your own sig that has a &#8216;hidden&#8217; brainfuck message in it. Below is mine (try compiling it, but don&#8217;t feel offended <img src='http://www.lordalcol.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre>++++++++++[&gt;+++++++++&gt;+++&gt;+++++&gt;+++++++++++&lt;&lt;&lt;&lt;-]&gt;-.&gt;++&gt;----&gt;+.++++++.&gt;
|          Nieko Maatjes | nieko.m @ gmx.net | www.nieko.net          |
|                   Improve your Internet-behaviour                   |
|                    www.nieko.net/misc_learn.php                     |
&lt;&lt;&lt;&lt;++++++++.&gt;&gt;&gt;---.&lt;&lt;&lt;++++.&gt;.......&lt;-.&gt;&gt;&gt;+++.--------.&lt;&lt;&lt;--.&gt;&gt;.[-]&lt;[-]</pre>
<p><a name="Just something extra"></a></p>
<h2><a name="Just something extra">Just something extra</a></h2>
<p>As something extra, I&#8217;ll show you one of the most difficult brainfuck programs I&#8217;ve written so far. This program displays whether your input is even or odd. Say, input is &#8216;@&#8217; (value 40h=64d), then the output will be &#8216;@&#8217;s value is even.&#8217;</p>
<pre>++++++++++[&gt;+++++++&lt;-]&gt;-.&lt;+
+++++++[&gt;+++++&lt;-]&gt;+.++++++.
&lt;+++[&gt;-----&lt;-]&gt;.&lt;+++[&gt;++++&lt;
-]&gt;+.&lt;++++++++[&gt;&gt;++++&lt;&lt;-]&gt;&gt;    display 'Enter input: '
.&lt;---------.+++++.++.+++++.
-.&lt;++++[&gt;&gt;++++++&lt;&lt;-]&gt;&gt;++.&lt;&lt;
++++[&gt;&gt;------&lt;&lt;-]&gt;&gt;--.

&gt;,.&lt;&lt;&lt;+++++++++++++.---.[-]    p4vINPUT chr$(13) chr$(10)

&gt;&gt;&gt;.&lt;+++++++.&lt;-.&gt;-------.&lt;
+++.&lt;++++[&gt;-----&lt;-]&gt;-.+++++
++++++.+++++++++.&lt;++++[&gt;---    display '@'s value is'
-&lt;-]&gt;.&gt;.&lt;++++.++++++++++.&gt;.

&lt;[-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;[-]             p4 moved to p2; p3v0; only p2v!0

&lt;&lt;+                            don't stop until p1v0; p1
[
&gt;[&gt;&gt;+&lt;&lt;-]&gt;&gt;[&lt;+&lt;+&gt;&gt;-]&lt;         p2 copied to p3; p3
&gt;[-]+&lt;                        p4v1
[&gt;-&lt; [-] ]                    p4v1 if p3v!0; p3v0 to exit loop
&gt;[                            if p4v1 then p3 was v0 and loop will be entered
p3v0 and p4v0 so they can be used to print text
&lt;++++++++++                p3v10
[&gt;++++++++++&lt;-]&gt;.         p3v101='e' \
&lt;++++++[&gt;+++&lt;-]&gt;-.        p3v118='v' | display 'even'
&lt;++++++[&gt;---&lt;-]&gt;+.        p3v101='e' |
+++++++++.                p3v110='n' /
&lt;&lt;&lt;[-]&gt;&gt;&gt;    p1v0 so that main loop is closed
[-]                       exit loop
]

&lt;&lt;[&gt;&gt;+&lt;&lt;-]&gt;&gt;[&lt;+&lt;+&gt;&gt;-]&lt;-      p2 copied to p3; p3v\1

&gt;[-]+&lt;                        p4v1
[&gt;-&lt; [-] ]                    p4v1 if p3 was v!!; p3v0 to exit loop
&gt;[                            if p4v1 then p3 was v0 and loop will be entered
p3v0 and p4v0 so they can be used to print text
&lt;+++++++++++               p3v11
[&gt;++++++++++&lt;-]&gt;.         p3v111='o' \ display 'odd'
-----------..             p3v100='d' /
&lt;&lt;&lt;[-]&gt;&gt;&gt;    p1v0 so that main loop is closed
[-]                       exit loop
]
&lt;&lt;--&lt;                        p2v\2; p1

]
&gt;[-]&lt;
++++++[&gt;++++++++&lt;-]&gt;--.        display a dot</pre>
<p>Or, without comments:</p>
<pre>++++++++++[&gt;+++++++&lt;-]&gt;-.&lt;++++++++[&gt;+++++&lt;-]&gt;+.++++++.&lt;+++[&gt;-----&lt;-]&gt;.&lt;+++
[&gt;++++&lt;-]&gt;+.&lt;++++++++[&gt;&gt;++++&lt;&lt;-]&gt;&gt;.&lt;---------.+++++.++.+++++.-.&lt;++++[&gt;&gt;+++
+++&lt;&lt;-]&gt;&gt;++.&lt;&lt;++++[&gt;&gt;------&lt;&lt;-]&gt;&gt;--.&gt;,.&lt;&lt;&lt;+++++++++++++.---.[-]&gt;&gt;&gt;.&lt;++++++
+.&lt;-.&gt;-------.&lt;+++.&lt;++++[&gt;-----&lt;-]&gt;-.+++++++++++.+++++++++.&lt;++++[&gt;----&lt;-]&gt;
.&gt;.&lt;++++.++++++++++.&gt;.&lt;[-]&gt;&gt;[&lt;&lt;+&gt;&gt;-]&lt;[-]&lt;&lt;+[&gt;[&gt;&gt;+&lt;&lt;-]&gt;&gt;[&lt;+&lt;+&gt;&gt;-]&lt;&gt;[-]+&lt;[&gt;-
&lt;[-]]&gt;[&lt;++++++++++[&gt;++++++++++&lt;-]&gt;.&lt;++++++[&gt;+++&lt;-]&gt;-.&lt;++++++[&gt;---&lt;-]&gt;+.+++
++++++.&lt;&lt;&lt;[-]&gt;&gt;&gt;[-]]&lt;&lt;[&gt;&gt;+&lt;&lt;-]&gt;&gt;[&lt;+&lt;+&gt;&gt;-]&lt;-&gt;[-]+&lt;[&gt;-&lt;[-]]&gt;[&lt;+++++++++++[&gt;+
+++++++++&lt;-]&gt;.-----------..&lt;&lt;&lt;[-]&gt;&gt;&gt;[-]]&lt;&lt;--&lt;]&gt;[-]&lt;++++++[&gt;++++++++&lt;-]&gt;--.</pre>
<p><a name="Epilogue"></a></p>
<h2><a name="Epilogue">Epilogue</a></h2>
<p>Credits go to:<br />
Frans Faase for showing how to use IF-THEN-statements<br />
Erdal Karaca for writing a real good tutorial (albeit in German)<br />
Eelco Lempsink for introducing me to the language<br />
Daniel Cristofani for giving lots of suggestions to improve this tutorial</p>
<p>Links:<br />
<a href="http://home.planet.nl/%7Efaase009/Ha_BF.html">http://home.planet.nl/~faase009/Ha_BF.html (english)</a><br />
<a href="http://home.t-online.de/home/erdalkaraca/html/bf2.htm">http://home.t-online.de/home/erdalkaraca/html/bf2.htm (german)</a></p>
<p>Copyright © 2002 Nieko Maatjes</p>
<p><!--more--></p>
<h2>Resources</h2>
<p><a href="http://www.lordalcol.com/brainfuckjs">Brainfuck Interpreter &amp; Debugger</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lordalcol.com/blog/2008/10/11/brainfuck-tutorial/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.lordalcol.com/blog/2008/10/11/brainfuck-tutorial/</feedburner:origLink></item>
		<item>
		<title>The Diggers - l’ultimo concerto</title>
		<link>http://feedproxy.google.com/~r/lordalcol/~3/Wi6py95_t2g/</link>
		<comments>http://www.lordalcol.com/blog/2008/08/27/the-diggers-lultimo-concerto/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 12:46:32 +0000</pubDate>
		<dc:creator>Lorenzo Dal Col</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lordalcol.com/blog/?p=47</guid>
		<description><![CDATA[Ringrazio i &#8220;The Diggers&#8221; per averci salutati con l&#8217;ultimo concerto.
Li ringrazio per aver concentrato il meglio degli ultimi 30 anni di musica rock-metal-prog in 6 anni di fantastici concerti.
Grazie per l&#8217;impegno che hanno messo ad imparare ed eseguire le canzoni così bene, sebbene credo di averli sentiti soddisfatti di come avevano suonato solamente una o [...]]]></description>
			<content:encoded><![CDATA[<p>Ringrazio i &#8220;The Diggers&#8221; per averci salutati con l&#8217;ultimo concerto.<br />
Li ringrazio per aver concentrato il meglio degli ultimi 30 anni di musica rock-metal-prog in 6 anni di fantastici concerti.<br />
Grazie per l&#8217;impegno che hanno messo ad imparare ed eseguire le canzoni così bene, sebbene credo di averli sentiti soddisfatti di come avevano suonato solamente una o due volte.<br />
In bocca al lupo per il futuro, spumeggiante e trepidante come sempre!</strong></p>
<p>Eccovi un po&#8217; di fotografie e di video dell&#8217;ultimo concerto:</p>
<div style="position: absolute; z-index: 999;"><div class="ngg-galleryoverview"><div class="slideshowlink"><a class="slideshowlink" href="/blog/feed/?show=gallery">[Show picture list]</a></div>
<div class="slideshow" id="ngg_slideshow3"><p>The <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> and <a href="http://www.mozilla.com/firefox/">a browser with Javascript support</a> are needed..</p></div>
	<script type="text/javascript" defer="defer">
		var so3550 = new SWFObject("http://www.lordalcol.com/blog/wp-content/plugins/nextgen-gallery/imagerotator.swf", "ngg_slideshow3", "800", "600", "7", "#000000");
		so3550.addParam("wmode", "opaque");
		so3550.addVariable("file", "http://www.lordalcol.com/blog/wp-content/plugins/nextgen-gallery/nggextractXML.php?gid=3");
		so3550.addVariable("linkfromdisplay", "true");
		so3550.addVariable("shownavigation", "true");
		so3550.addVariable("showicons", "true");
		so3550.addVariable("overstretch", "false");
		so3550.addVariable("backcolor", "0x000000");
		so3550.addVariable("frontcolor", "0xFFFFFF");
		so3550.addVariable("lightcolor", "0xCC0000");
		so3550.addVariable("rotatetime", "10");
		so3550.addVariable("transition", "fade");
		so3550.addVariable("width", "800");
		so3550.addVariable("height", "600");
		so3550.write("ngg_slideshow3");
	</script></div>
<div class="ngg-clear"></div>
</div>
<div style="height: 650px;"> </div>
<p><strong>Queen - I want to break free</strong></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/GFFI5wgxzos&#038;hl=it&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/GFFI5wgxzos&#038;hl=it&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><strong>Dream Theater - Ytsejam  </strong></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/YTbW-vp3PwM&#038;hl=it&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/YTbW-vp3PwM&#038;hl=it&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lordalcol.com/blog/2008/08/27/the-diggers-lultimo-concerto/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.lordalcol.com/blog/2008/08/27/the-diggers-lultimo-concerto/</feedburner:origLink></item>
		<item>
		<title>Brainfuck JS (interpreter &amp; debugger)</title>
		<link>http://feedproxy.google.com/~r/lordalcol/~3/0lW1mtJ8Au0/</link>
		<comments>http://www.lordalcol.com/blog/2008/03/07/brainfuck-js-interpreter-debugger/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 10:15:50 +0000</pubDate>
		<dc:creator>Lorenzo Dal Col</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[pensieri]]></category>

		<category><![CDATA[progetti personali]]></category>

		<guid isPermaLink="false">http://www.lordalcol.com/blog/2008/03/07/brainfuck-js-interpreter-debugger/</guid>
		<description><![CDATA[Negli ultimi giorni mi sono dilettato con il linguaggio di programmazione più &#8220;esoterico&#8221; e minimale che esista, il Brainfuck.  Ho creato un piccolo IDE in Javascript che gira su Firefox e Safari con le seguenti caratteristiche:


interprete di Brainfuck


debugger con play/pause/stop/step-by-step


inserimento di breakpoint


numerosi programmi già pronti di esempio


esecuzione in pseudo-thread che non blocca il browser [...]]]></description>
			<content:encoded><![CDATA[<p>Negli ultimi giorni mi sono dilettato con il linguaggio di programmazione più &#8220;esoterico&#8221; e minimale che esista, il <strong>Brainfuck</strong>.  Ho creato un piccolo <strong>IDE in Javascript</strong> che gira su <strong>Firefox e Safari</strong> con le seguenti caratteristiche:<a href="http://www.lordalcol.com/brainfuckjs" title="Brainfuck JS (interpreter &amp; debugger)" target="_blank"><img src="http://www.lordalcol.com/blog/wp-content/uploads/2008/03/brainfuckcover.jpg" alt="Brainfuck cover" align="right" /></a></p>
<ul>
<li>
<p align="left"><strong>interprete </strong>di Brainfuck</p>
</li>
<li>
<p align="left"><strong>debugger </strong>con play/pause/stop/step-by-step</p>
</li>
<li>
<p align="left">inserimento di <strong>breakpoint</strong></p>
</li>
<li>
<p align="left">numerosi programmi già pronti di <strong>esempio</strong></p>
</li>
<li>
<p align="left">esecuzione in pseudo-<strong>thread </strong>che non blocca il browser in caso di cicli infiniti</p>
</li>
</ul>
<h3 align="center"><a href="http://www.lordalcol.com/brainfuckjs" title="Brainfuck JS (interpreter &amp; debugger)" target="_blank">Apri Brainfuck JS (interpreter &amp; debugger)</a></h3>
<p><code>++[&gt;+++++++++++++++++++++++&lt;-]  &gt;&lt;+++[&gt;++++++++++++++++++++++++&lt;-] &gt;+. . . &lt;+++[&gt;------------------------&lt;-] &gt;-. &lt;+++++++++++++++++++++++++++++++[&gt;++&lt;-] &gt;. &lt;++[&gt;+&lt;-] &gt;+. &lt;++[&gt;+&lt;-] &gt;+. &lt;+++++++[&gt;--&lt;-] &gt;. &lt;++[&gt;-&lt;-] &gt;-. &lt;+++++[&gt;++&lt;-] &gt;+. &lt;+++[&gt;---&lt;-] &gt;. &lt;+++[&gt;++++&lt;-] &gt;. &lt;++[&gt;-&lt;-] &gt;-. &lt;+++++++++++++++++++++++++++++++[&gt;--&lt;-] &gt;. &lt;+++++++++++++[&gt;++++&lt;-] &gt;+. &lt;+++[&gt;++++&lt;-] &gt;. &lt;+[&gt;-&lt;-] &gt;-.<br />
</code></p>
<p align="left"><span id="more-42"></span></p>
<p align="left">Da <a href="http://it.wikipedia.org/wiki/Brainfuck" title="Brainfuck - Wikipedia">wikipedia</a>:</p>
<blockquote><p> <strong>Brainfuck</strong> è un <a href="http://it.wikipedia.org/wiki/Linguaggio_di_programmazione" title="Linguaggio di programmazione">linguaggio di programmazione</a> per <a href="http://it.wikipedia.org/wiki/Computer" title="Computer">computer</a>, di tipo minimalista, creato da <a href="http://it.wikipedia.org/wiki/Urban_M%C3%BCller" title="Urban Müller">Urban Müller</a> intorno al <a href="http://it.wikipedia.org/wiki/1993" title="1993">1993</a>. [&#8230;]  L&#8217;obiettivo di Müller era di creare un semplice linguaggio di programmazione completo per una <a href="http://it.wikipedia.org/wiki/Macchina_di_Turing" title="Macchina di Turing">macchina di Turing</a> che potesse essere implementato con il <a href="http://it.wikipedia.org/wiki/Compilatore" title="Compilatore">compilatore</a> più piccolo possibile. Il linguaggio consiste di otto istruzioni. La versione 2 del compilatore originale, scritta per l&#8217;<a href="http://it.wikipedia.org/wiki/Amiga" title="Amiga">Amiga</a>, occupa soltanto 240 <a href="http://it.wikipedia.org/wiki/Byte" title="Byte">byte</a>. È stato ispirato dal linguaggio <a href="http://it.wikipedia.org/wiki/FALSE" title="FALSE">FALSE</a>, un altro <a href="http://it.wikipedia.org/w/index.php?title=Linguaggio_di_programmazione_esoterico&amp;action=edit" class="new" title="Linguaggio di programmazione esoterico">linguaggio di programmazione esoterico</a>, il cui compilatore occupava 1024 byte.  Come il nome suggerisce, i programmi scritti in Brainfuck tendono ad essere difficili da comprendere. Tuttavia Brainfuck è un linguaggio Turing-completo, e si può utilizzare per implementare qualunque algoritmo eseguibile con una <a href="http://it.wikipedia.org/wiki/Macchina_di_Turing" title="Macchina di Turing">macchina di Turing</a>. Trascurando l&#8217;enorme difficoltà nella programmazione di certi algoritmi con Brainfuck, è certamente possibile scrivere il relativo codice.  Il linguaggio è basato su un modello molto semplice consistente in un array di byte inizializzato a zero, un <a href="http://it.wikipedia.org/wiki/Puntatore_%28programmazione%29" title="Puntatore (programmazione)">puntatore</a> all&#8217;array (inizializzato per puntare al primo byte dell&#8217;array) e due <a href="http://it.wikipedia.org/w/index.php?title=Stream_%28informatica%29&amp;action=edit" class="new" title="Stream (informatica)">stream</a> di byte per l&#8217;input e l&#8217;output.</p>
<h4> <span class="mw-headline">Istruzioni</span> <span style="font-size: x-small; font-weight: normal; float: none" class="editsection"></span></h4>
<p>Le istruzioni del linguaggio sono otto, ciascuna consiste in un singolo carattere e sono:</p>
<table style="text-align: left">
<tr>
<td><strong>Carattere</strong></td>
<td><strong>Significato</strong></td>
</tr>
<tr>
<td>&gt;</td>
<td>incrementa il puntatore</td>
</tr>
<tr>
<td>&lt;</td>
<td>decrementa il puntatore</td>
</tr>
<tr>
<td>+</td>
<td>incrementa il byte al puntatore</td>
</tr>
<tr>
<td>-</td>
<td>decrementa il byte al puntatore</td>
</tr>
<tr>
<td>.</td>
<td>output dal byte al puntatore (ASCII)</td>
</tr>
<tr>
<td>,</td>
<td>input al byte al puntatore (ASCII)</td>
</tr>
<tr>
<td>[</td>
<td>salta in avanti all&#8217;istruzione dopo il corrispondente ] se il byte al puntatore è zero</td>
</tr>
<tr>
<td>]</td>
<td>salta indietro all&#8217;istruzione dopo il corrispondente [ se il byte al puntatore non è zero</td>
</tr>
</table>
</blockquote>
<h3>Il mio interprete</h3>
<p style="text-align: center"><img src="http://www.lordalcol.com/blog/wp-content/uploads/2008/03/brainfucksrc.gif" alt="Brainfuck JS source" /></p>
<p>Ho creato un <strong>interprete </strong>scritto in <strong>Javascript </strong>che è in grado di eseguire qualsiasi programma scritto in <strong>Brainfuck</strong>, e addirittura di debuggarlo step-by-step.  Diversamente da altri interpreti scritti in giro il mio esegue il programma Brainfuck in uno <strong>pseudo thread in javascript</strong>, in questo modo si possono eseguire tranquillamente programmi molto lunghi o addirittura cicli infiniti senza bloccare definitivamente il browser.  Con un apposito pulsante si può bloccare l&#8217;esecuzione del programma in brainfuck ed evitare blocchi disastrosi.</p>
<h3>Il mio debugger</h3>
<p>E&#8217; possibile attivare il debugger ed eseguire il proprio programma in Brainfuck in modalità rallentata, metterlo in pausa, ed avanzare di <strong>un istruzione alla volta (step-by-step)</strong>.  Inoltre con il carattere # si possono impostare dei breakpoint, che fermano l&#8217;esecuzione in quel punto per poi proseguire di un passo alla volta.  Nel pannello di debug viene visualizzato il <strong>buffer </strong>del programma e la posizione del <strong>puntatore</strong>, mentre nel codice sorgente viene evidenziata il punto di esecuzione corrente.</p>
<p style="text-align: center"><img src="http://www.lordalcol.com/blog/wp-content/uploads/2008/03/brainfuckdebug.gif" alt="Brainfuck JS debugger" /></p>
<h3>Programmi Brainfuck di esempio</h3>
<p>Sono già preparati (caricabili in un sol colpo di mouse) parecchi <strong>programmi Brainfuck</strong>, tra cui: <em>Hello world!, Addition, Multiplication, Division, Uppercase a string, Brainfuck to C translator, Brainfuck interpreter, Factorial, Number graphic display, Square numbers from 1 to 10000, ecc</em></p>
<h3>L&#8217;interprete Brainfuck scritto in Brainfuck</h3>
<p>Incredibile ma vero (e soprattutto: funziona sul serio!): tra gli esempi proposti c&#8217;è anche <strong>Brainfuck interpreter</strong>, che è un programma scritto in Brainfuck che riesce a interpretare ed eseguire un altro programma in brainfuck passato come stringa di input&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lordalcol.com/blog/2008/03/07/brainfuck-js-interpreter-debugger/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.lordalcol.com/blog/2008/03/07/brainfuck-js-interpreter-debugger/</feedburner:origLink></item>
		<item>
		<title>Avviso speciale per gli alieni che guardano la terra dallo spazio</title>
		<link>http://feedproxy.google.com/~r/lordalcol/~3/3GQUB81KPsw/</link>
		<comments>http://www.lordalcol.com/blog/2008/02/21/avviso-speciale-per-gli-alieni-che-guardano-la-terra-dallo-spazio/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 18:48:51 +0000</pubDate>
		<dc:creator>Lorenzo Dal Col</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.lordalcol.com/blog/2008/02/21/avviso-speciale-per-gli-alieni-che-guardano-la-terra-dallo-spazio/</guid>
		<description><![CDATA[Faccio fatica a crederci (grazie a FLAK88 per la dritta  )
Visualizzazione ingrandita della mappa
]]></description>
			<content:encoded><![CDATA[<p>Faccio fatica a crederci (grazie a FLAK88 per la dritta <img src='http://www.lordalcol.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</p>
<p><iframe width="525" height="550" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.it/maps?f=q&amp;hl=it&amp;geocode=&amp;q=45%C2%B054'38.11''N%2F13%C2%B030'26.94''E+&amp;ie=UTF8&amp;t=h&amp;s=AARTsJpm5carkmLuTRD_T2GZBEuzoAhB7w&amp;ll=45.910869,13.507476&amp;spn=0.004106,0.005633&amp;z=17&amp;iwloc=addr&amp;output=embed"></iframe><br /><small><a href="http://maps.google.it/maps?f=q&amp;hl=it&amp;geocode=&amp;q=45%C2%B054'38.11''N%2F13%C2%B030'26.94''E+&amp;ie=UTF8&amp;t=h&amp;ll=45.910869,13.507476&amp;spn=0.004106,0.005633&amp;z=17&amp;iwloc=addr&amp;source=embed" style="color:#0000FF;text-align:left">Visualizzazione ingrandita della mappa</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lordalcol.com/blog/2008/02/21/avviso-speciale-per-gli-alieni-che-guardano-la-terra-dallo-spazio/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.lordalcol.com/blog/2008/02/21/avviso-speciale-per-gli-alieni-che-guardano-la-terra-dallo-spazio/</feedburner:origLink></item>
		<item>
		<title>La pagina non trovata più costosa del web (italia.it)</title>
		<link>http://feedproxy.google.com/~r/lordalcol/~3/xdsgGx1PV7Y/</link>
		<comments>http://www.lordalcol.com/blog/2008/02/20/la-pagina-non-trovata-piu-costosa-del-web-italiait/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 08:15:52 +0000</pubDate>
		<dc:creator>Lorenzo Dal Col</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[pensieri]]></category>

		<category><![CDATA[italia.it]]></category>

		<guid isPermaLink="false">http://www.lordalcol.com/blog/2008/02/20/la-pagina-non-trovata-piu-costosa-del-web-italiait/</guid>
		<description><![CDATA[Oggi credo di aver avuto l&#8217;esperienza di vedere la pagina non trovata più costosa del web.
7 milioni di euro per un server che non risponde
Credo inoltre che sia un ottima rappresentazione dello stato italiano di internet:

]]></description>
			<content:encoded><![CDATA[<p>Oggi credo di aver avuto l&#8217;esperienza di vedere la pagina non trovata più costosa del web.</p>
<p><a href="http://www.repubblica.it/2008/01/sezioni/scienza_e_tecnologia/italia-punto-it/italia-punto-it/italia-punto-it.html">7 milioni di euro</a> per un server che non risponde</p>
<p>Credo inoltre che sia un ottima rappresentazione dello stato italiano di internet:</p>
<p><a href="http://www.italia.it/" target="_blank" title="Italia.it"><img src="http://www.lordalcol.com/blog/wp-content/uploads/2008/02/italiait.gif" alt="Italia.it" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lordalcol.com/blog/2008/02/20/la-pagina-non-trovata-piu-costosa-del-web-italiait/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.lordalcol.com/blog/2008/02/20/la-pagina-non-trovata-piu-costosa-del-web-italiait/</feedburner:origLink></item>
	</channel>
</rss>
