<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2994292646876077363</id><updated>2012-01-29T19:40:02.610-05:00</updated><category term='ruby'/><category term='tetris'/><category term='J2ME'/><category term='flash'/><category term='spanish'/><category term='math'/><category term='simulator'/><category term='programming fonts'/><category term='programming'/><category term='klotski'/><category term='AS3'/><category term='perl'/><category term='games'/><category term='puzzle'/><category term='algorithms'/><category term='game'/><category term='flex'/><category term='hiring'/><category term='pascal'/><category term='primes'/><category term='problems'/><category term='euler'/><category term='opinion'/><category term='flash as3 flex basic interpreter'/><category term='layton'/><category term='minimax'/><category term='computer'/><category term='puzzles'/><category term='code'/><category term='chess'/><category term='c++'/><category term='recursion'/><category term='unity'/><title type='text'>El rincon de ex</title><subtitle type='html'>Random amusing things I waste my time!</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-6188426392974631746</id><published>2011-10-09T14:18:00.002-05:00</published><updated>2011-10-09T15:19:59.180-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unity'/><category scheme='http://www.blogger.com/atom/ns#' term='games'/><category scheme='http://www.blogger.com/atom/ns#' term='tetris'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>Tetris clone in Unity</title><content type='html'>I have been working with Unity lately and decided to use it for a a 3D version of my &lt;a href="http://code.google.com/p/simple-tetris-clone/"&gt;simple-tetris-clone&lt;/a&gt;.&lt;br /&gt;Unity great strengths are the easiness to go from concept to implementation and its support for deployment in multiple platforms. It's not that easy, I can tell, after finishing a project with iOS and Android support but once you get it right, it works.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="480" src="http://1.bp.blogspot.com/-OO1--I_6bFY/TpHlg5MFNqI/AAAAAAAAAG4/XsBDmopwhv8/s1600/stc_unity.png" width="720" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You can play it online if you have the Unity plugin installed.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;object classid="clsid:444785F1-DE89-4295-863A-D46C3A781394" codebase="http://webplayer.unity3d.com/download_webplayer/UnityWebPlayer.cab#version=3,0,0,0" height="500" id="UnityObject" width="750"&gt;     &lt;param name="http://sites.google.com/site/exeqtor/WebPlayer.unity3d" value="WebPlayer" /&gt;&lt;embed id="UnityEmbed" src="http://sites.google.com/site/exeqtor/WebPlayer.unity3d" width="750" height="500"        type="application/vnd.unity" pluginspage="http://www.unity3d.com/unity-web-player-3.x" /&gt; &lt;/object&gt;&lt;/div&gt;&lt;br /&gt;The source is in my &lt;a href="http://code.google.com/p/simple-tetris-clone/source/browse/#svn%2Fbranches%2Funity"&gt;repository&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Right now this port is missing the HUD (and for a demo this size stock Unity GUI support would be somehow OK) but I better don't bother because the GUI system is one of the Unity weakest points and it really sucks big time. Due to &lt;a href="http://forum.unity3d.com/threads/60217-Garbage-collector-spikes-because-of-GUI?highlight=OnGui+problems"&gt;performance issues&lt;/a&gt; is plainly unusable for mobile devices and it's pretty archaic and limited for everything else. You'll need to buy expensive third party plugins or use (and probably modify) the nice and free &lt;a href="http://forum.unity3d.com/threads/87917-Prime31-UIToolkit-Multi-Resolution-GUI-Solution-Ready-for-Use...and-it-s-free"&gt;UIToolkit&lt;/a&gt; for sane and usable interfaces in your games, but even then you still will miss support for advanced containers and scrolling. Sight. The good news is that Unity 3.5 will have a brand new GUI system. I really really hope they fix it for then.&lt;br /&gt;So please forgive my laziness but my fingers chucked and rebelled against me when I was trying to type OnGUI(), and using old fashioned GUIText is not my thing :D&lt;br /&gt;&lt;br /&gt;Forgetting the GUI, Unity is an awesome and very fun engine to play with, and it's FREE.&lt;br /&gt;Programming in C# with Visual Studio C# is also a pleasure.&lt;br /&gt;&lt;br /&gt;Have fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-6188426392974631746?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/6188426392974631746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2011/10/tetris-clone-in-unity.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/6188426392974631746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/6188426392974631746'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2011/10/tetris-clone-in-unity.html' title='Tetris clone in Unity'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-OO1--I_6bFY/TpHlg5MFNqI/AAAAAAAAAG4/XsBDmopwhv8/s72-c/stc_unity.png' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-1323091957494003837</id><published>2011-02-09T22:51:00.007-05:00</published><updated>2011-11-05T21:51:39.288-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='games'/><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='AS3'/><category scheme='http://www.blogger.com/atom/ns#' term='minimax'/><title type='text'>Solving the Tic-Tac-Toe game, finally...</title><content type='html'>The simple game that has been always after me laughing at my programming incompetence.&lt;br /&gt;&lt;br /&gt;The very first time I tried to make a program that could play perfectly the game was in the university, after taking my very first course in Programming Languages (I learned Pascal). It was holidays and I was visiting my cousin and got the nice surprise of him getting a personal computer. It was a powerful 286 with a monochrome amber monitor. I couldn't find anything similar but for you to get the idea, games were played like this in those computers:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="296" src="http://1.bp.blogspot.com/_uHZQUuxM0oo/TVIpuPYkGfI/AAAAAAAAAGY/r5Yj8QvX-4w/s1600/hercules.png" width="442" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;My cousin was the first lucky one in getting a computer in our family and he was learning Turbo Pascal by himself. We decided to celebrate our reunion programing the ultimate and invincible "Michi" (that is how the TicTacToe game is called over here). It was the morning and I had to return to my city at the afternoon, so we had only some hours to get it working. He was going to do the main menu and the game board, and I was going to implement the game logic. He started programming while I was writing on paper my part. This is just a bunch of ifs and a 3x3 matrix, How difficult can it be?. I thought. I recall he did a beautiful work, our graphics looked great (all in black and amber of course) but after typing my part the game really bombed, it played awfully, losing idiotically. Without more time to debug my program I had to leave with the bitter taste of defeat on my mouth.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="350" src="http://3.bp.blogspot.com/_uHZQUuxM0oo/TVIvPNGEgBI/AAAAAAAAAGg/oC0R-vjMkyo/s1600/casio+fx7700.JPG" width="500" /&gt;&lt;/div&gt;&lt;br /&gt;The second time I tried to solve the game was after getting my programmable calculator Casio FX-7700, a powerful beast of 4K of memory. This calculator only accepted some kind of primitive BASIC but it gave me some moments of solace programming it. In every sense it was my first "computer", because before that I only could test my programs after getting laboratory time on my university laboratory, and that place was always full of people waiting, I had to awake early to sign-in the notebook for reserving a place. I remember using all the 4K of my calculator for my TicTacToe game, it draw the board not only with "X" and "O" but also with different icons that I had diligently drawn pixel by pixel. This time the game logic worked fine. Or that I thought. One of the reasons my first attempt failed so miserably was that I didn't want a "boring" adversary. I know this is ridiculous when the game is boring for starters, but it was very very boring if the computer always played in the center first, or in some corner first. I knew that the computer could play in any place if it was first and indeed had high chances of confusing the casual adversary playing that way, so my game logic must choose randomly from a valid set of possible movements. I have see some TicTacToe game solvers cutting corners starting always in the &lt;a href="http://en.wikipedia.org/wiki/Tictactoe"&gt;center&lt;/a&gt; or in &lt;a href="http://en.wikipedia.org/wiki/File:Tictactoe-X.svg"&gt;some corner&lt;/a&gt;. My game seemed to play randomly and even so never to lose. Some day I needed the memory of my calculator for useful stuff, and I had to delete my TicTacToe program so I decided to play the little thing for the last time... and I found a bug I have never seen before! even worse, due to the randomness I couldn't reproduce it later. No time to debug, like the first time, TicTacToe laughing again at me.&lt;br /&gt;&lt;br /&gt;This year I saw again the little monster thanks to a friend, and I decided to settle things once for all with it. This time I didn't want to use a greedy approach to the problem, like before. This time I would generate all the game tree once for all and decide the best move using the &lt;a href="http://www.fierz.ch/strategy1.htm"&gt;MiniMax algorithm&lt;/a&gt;. You can see the result below (flash):&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;object data="http://sites.google.com/site/exeqtor/TicTacToe.swf" height="500" type="application/x-shockwave-flash" width="500"&gt; &lt;param value="http://sites.google.com/site/exeqtor/TicTacToe.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;Left click for doing a move, and clicking while pressing [shift] or [control] undo the last move. The valid moves for the next player are show in black. About the statistics printed on every cell: the first 3 numbers (from top to bottom) are the number of possible games that are won by any part or are drawn (in ascending order). Next is the total of games and finally comes the MiniMax score of that cell. That score is used by the program to show the best moves for the next player. Positive scores are a secure win for the "X" player, negative scores are a secure win for the "O" player, a zero score means a draw.&lt;br /&gt;So TicTacToe in resume looks like this:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-XUrnpBxCh4U/TVNRCzh9kKI/AAAAAAAAAGk/0H1u9cOdgmU/s1600/ttt+01.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;The area in blue is proportional to the possible games than "X" can win, the red area is proportional to the number of wins for "O" and the area in yellow are the draws. You can see that there are 255168 games with "X" wining 51% of them, "O" wins only 30% and the rest is a draw. Clearly "X" has an advantage. This is the distribution for the first move:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="494" src="http://1.bp.blogspot.com/-uBPtlzsxmAw/TVNSHal2WrI/AAAAAAAAAGo/WMijCMG4zi8/s1600/ttt+02.pn" width="492" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;You can play in any cell (and like everybody knows) the best you can get is a draw (all the cells have zero for MiniMax score). Playing in the center gives you 60% chances of winning, in any corner a 52% percent of winning and playing in the side 48%. If you play in the corner, you'll get this:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-4lt0Gcg5itU/TVNVUW7zVUI/AAAAAAAAAGs/-g2PzC5cNY4/s1600/ttt+03.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now the interesting bit is that for the "O" player there is only one valid possible answer for drawing (playing in the center) playing in any other place is a secure win for the "X" player. If "X" plays in the center first:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-2_Gsy0KlqQ8/TVNWGq4dNdI/AAAAAAAAAGw/SoLkStw8a0k/s1600/ttt+04.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;the only valid answers for "O" is playing in some corner, and if "X" plays in the side:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-sDa2o7f2Ks0/TVNZLNj98ZI/AAAAAAAAAG0/qu9Ihr42z4U/s1600/ttt+05.png" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;there are only 4 cells that are valid for the "O" player now (I really liked that opening).&lt;br /&gt;&lt;br /&gt;Play with the flash thing and convince yourself that it's unbeatable. I hope I didn't do a mistake again! :D. Source code &lt;a href="http://wonderfl.net/c/2qkP"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-1323091957494003837?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/1323091957494003837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2011/02/solving-tictactoe-game-finally.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/1323091957494003837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/1323091957494003837'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2011/02/solving-tictactoe-game-finally.html' title='Solving the Tic-Tac-Toe game, finally...'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_uHZQUuxM0oo/TVIpuPYkGfI/AAAAAAAAAGY/r5Yj8QvX-4w/s72-c/hercules.png' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-4943229579491250650</id><published>2011-01-15T17:51:00.002-05:00</published><updated>2011-02-09T22:53:53.364-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flash as3 flex basic interpreter'/><title type='text'>Flasic: a very simple BASIC interpreter for Flash</title><content type='html'>I just found this very little cute BASIC interpreter: &lt;a href="http://journal.stuffwithstuff.com/2010/07/18/jasic-a-complete-interpreter-in-one-java-file/"&gt;Jasic&lt;/a&gt; and I decided to make a port to Flash in order to add basic graphics commands (just "setcolor" and "putpixel" actually) so I could see the little thing drawing a colored Mandelbrot fractal. It was very easy, thanks to the profusely commented code of the original author (Bob Nystrom). You can select the program demos from the drop-down menu and press the [Run] button to start the interpreter. So without further ado, Flasic:&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;object data="http://sites.google.com/site/exeqtor/flasic.swf" height="600" type="application/x-shockwave-flash" width="800"&gt; &lt;param value="http://sites.google.com/site/exeqtor/flasic.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;It's not that slowly, but being a BASIC interpreter inside a Flex interpreter inside a Flash bytecode interpreter surely takes his toll, oh the irony... :D&lt;br /&gt;The code is my &lt;a href="https://bitbucket.org/ex/flasic"&gt;repo&lt;/a&gt;, many thanks to the original author for releasing his original version, it was fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-4943229579491250650?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/4943229579491250650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2011/01/flasic-very-simple-basic-interpreter.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/4943229579491250650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/4943229579491250650'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2011/01/flasic-very-simple-basic-interpreter.html' title='Flasic: a very simple BASIC interpreter for Flash'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-8050370821771680395</id><published>2010-08-08T16:37:00.007-05:00</published><updated>2012-01-08T15:30:57.019-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='algorithms'/><category scheme='http://www.blogger.com/atom/ns#' term='puzzles'/><title type='text'>Solving the Princess in a Box Puzzle</title><content type='html'>We can solve the puzzle of my last post using a &lt;a href="http://en.wikipedia.org/wiki/Breadth-first_search"&gt;Breadth-first search (BFS)&lt;/a&gt; algorithm. The key idea is to realize than the problem is just a Shortest Path problem where the graph, even when it is not completely known at the beginning (because we don't have the graph's adjacency list or adjacency matrix), can be built joining the states the board takes after every movement. The image below can help to understand this. It shows some of the states the board cab take after some movements starting from the beginning.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="462" src="http://3.bp.blogspot.com/_uHZQUuxM0oo/TF78YSO59LI/AAAAAAAAAFk/7I8UBgZ33BQ/s1600/tree.png" width="592" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So we are going to work over the graph of all the states the board can take by moving the pieces around. A nice thing is that the BFS algorithm assures us that if we reach our target we would reach it in the minimum number of steps, and if we can't reach our target the problem is indeed impossible to solve. BFS in seudocode looks like this:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="474" src="http://2.bp.blogspot.com/_uHZQUuxM0oo/TF7_m4WqsJI/AAAAAAAAAFs/In7enly1jM4/s1600/algo1.png" width="614" /&gt;&lt;/div&gt;But we'll need to modify some parts of this algorithm in order to solve our problem. See the highlighted lines below:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="475" src="http://4.bp.blogspot.com/_uHZQUuxM0oo/TF8AC1rjheI/AAAAAAAAAF0/hYhcxeoN25s/s1600/algo2.png" width="614" /&gt;&lt;/div&gt;&lt;br /&gt;Lines 1-4 are no longer necessary (or possible) because we don't have the adjacency list or adjacency matrix. We don't even know the number of nodes our graph has!. Line 5 need to change because the above restriction forces us to attach the &lt;i&gt;State &lt;/i&gt;property into our node, the same applies to lines 12-16. Line 11 and 18 would be ignored here because we don't need any special process after discovering a graph edge, there are other interesting problems with graphs that can be solved using these steps but not our problem at hand. So our algorithm ends like this:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="475" src="http://1.bp.blogspot.com/_uHZQUuxM0oo/TF8Bzc2q9sI/AAAAAAAAAF8/BS70v46761Q/s1600/algo3.png" width="615" /&gt;&lt;/div&gt;&lt;br /&gt;In line 4 we have introduced a &lt;i&gt;Discovered&lt;/i&gt; data structure, this object stores all the discovered nodes and can be a Set or Hash Table because we need to insert nodes and check their existence fast. This change is required because we don't know all the nodes at the beginning so we can't use a simple Array. As always everything is easy until you have to do it, and here the simple and innocent line 10 can give us a bit of trouble implementing it, but after a bit of code modifications we'll end with this:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;object data="http://sites.google.com/site/exeqtor/Solver.swf" height="400" type="application/x-shockwave-flash" width="420"&gt; &lt;param value="http://sites.google.com/site/exeqtor/Solver.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;This can solve the puzzle in less than 3 seconds (in my desktop with Windows7 and a Pentium D at 2.8 GHz) pretty nice if we are talking about Flash here, I have seen some native applications taking similar or longer times.&lt;br /&gt;But some optimizations were required to obtain that speed. Also in order to don't freeze the browser I had to split the process along some frames, but that was easy because in a BFS process there is no recursion involved. It's a shame than Flash still doesn't have threading support despite the fact that HTML5 already got web workers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-8050370821771680395?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/8050370821771680395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/08/solving-princess-in-box-puzzle.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/8050370821771680395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/8050370821771680395'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/08/solving-princess-in-box-puzzle.html' title='Solving the Princess in a Box Puzzle'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_uHZQUuxM0oo/TF78YSO59LI/AAAAAAAAAFk/7I8UBgZ33BQ/s72-c/tree.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-1985517587784897405</id><published>2010-07-29T23:38:00.005-05:00</published><updated>2010-08-08T16:43:48.038-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='puzzle'/><category scheme='http://www.blogger.com/atom/ns#' term='klotski'/><category scheme='http://www.blogger.com/atom/ns#' term='layton'/><category scheme='http://www.blogger.com/atom/ns#' term='AS3'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>The Princess in a Box puzzle</title><content type='html'>Today was holidays here (national day) so I finally could finish the &lt;a href="http://en.wikipedia.org/wiki/Professor_Layton_and_the_Curious_Village"&gt;Professor Layton and the Curious Village&lt;/a&gt; cute little game. If you like puzzles there are no better games than the Professor Layton series. I really recommend them if you own a Nintendo DS. However I don't play games much, so take my advice with a bit of salt: the only games I ever finished were&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Star_Control_II"&gt;StarControl II&lt;/a&gt;, Starcraft and &lt;a href="http://en.wikipedia.org/wiki/Jeanne_d%27Arc_%28video_game%29"&gt;Jeanne d'Arc&lt;/a&gt;. That reminds me that the only time I went to Buenos Aires I brought with me a little box with a similar puzzle.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_uHZQUuxM0oo/TFJOeOJXv1I/AAAAAAAAAFU/ZN4mrvCg9d4/s320/DSC01391.JPG" /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;I totally forgot about it until I saw again a similar puzzle in the DS game.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="383" src="http://4.bp.blogspot.com/_uHZQUuxM0oo/TFJOlhrx1yI/AAAAAAAAAFc/Gqd_GbQT0yI/s1600/097T.png" width="256" /&gt;&lt;/div&gt;&lt;br /&gt;This puzzle has been a long time around us as a member of the family of &lt;a href="http://en.wikipedia.org/wiki/Sliding_puzzle"&gt;sliding puzzles&lt;/a&gt; and is better known as the &lt;a href="http://en.wikipedia.org/wiki/Klotski"&gt;Klotski puzzle&lt;/a&gt;, but I'm going to name it here &lt;a href="http://professorlaytonwalkthrough.blogspot.com/2008/02/puzzle097.html"&gt;The Princess in a Box&lt;/a&gt; puzzle because is the name that it has in the Professor Layton's game. I did this Flash demo if you want to play it:&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;object data="http://sites.google.com/site/exeqtor/PrincessSimple.swf" height="350" type="application/x-shockwave-flash" width="400"&gt; &lt;param value="http://sites.google.com/site/exeqtor/PrincessSimple.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;object data="http://sites.google.com/site/exeqtor/Princess.swf" height="350" type="application/x-shockwave-flash" width="400"&gt; &lt;param value="http://sites.google.com/site/exeqtor/Princess.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;The source code is in &lt;a href="http://github.com/ex/flash/tree/master/princess/"&gt;my repository&lt;/a&gt;, if you like that kind of things.&lt;br /&gt;So that's it for now, have fun. I'll solve the puzzle in my next post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-1985517587784897405?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/1985517587784897405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/07/princess-in-box-puzzle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/1985517587784897405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/1985517587784897405'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/07/princess-in-box-puzzle.html' title='The Princess in a Box puzzle'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_uHZQUuxM0oo/TFJOeOJXv1I/AAAAAAAAAFU/ZN4mrvCg9d4/s72-c/DSC01391.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-7823325793194103811</id><published>2010-04-11T23:43:00.009-05:00</published><updated>2011-01-17T20:52:46.008-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming fonts'/><title type='text'>My very own programming font</title><content type='html'>I think fonts are the second best friends of programmers.&lt;br /&gt;&lt;br /&gt;When I was a kid I used only Lucida Console, it was easy to find on every Windows installation and had a nice monospace feel. After some time I found the &lt;a href="http://www.proggyfonts.com/index.php?menu=download"&gt;Proggy&lt;/a&gt; font family and I never looked back. Proggy was my only font for ages. It was very compact and it let me see more lines of code in those small CRT monitors of the time without losing clarity. &lt;br /&gt;&lt;br /&gt;A good programming font makes easy for you to distinguish a zero '0' from a capital letter 'O'; a number '1' from a letter 'l'; and render all the operators and common programming symbols in a way that is very easy to distinguish one from another. (an exclamation '!' from a vertical bar '|', a parenthesis '(' from a bracket '[', etc) But even the good times come to an end.&lt;br /&gt;&lt;br /&gt;And the end came with the advent of bigger monitors and bigger screen resolutions. The problem with Proggy was that it never looked good with sizes bigger than the default (11), and that was very small for me to see in the new resolutions. I did my best effort, but I already use heavy glasses to allow me the strain of small fonts all the day, it was overkill.&lt;br /&gt;&lt;br /&gt;So I sadly had to look for a replacement. I surfed the web looking at all the other programming fonts ever created, nothing caught my attention. I tested many of them but all the time I found myself missing something. After a long time, and because I had to work, I ended with &lt;a href="http://en.wikipedia.org/wiki/Consolas"&gt;Consolas&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;But it never was love. I had to said every time I started my editor 'I really like this font', I was making my best effort but deep root I knew it was only because I couldn't find anything better.&lt;br /&gt;&lt;br /&gt;This night I changed again monitors and looking at some code of mine I finally realized that Consolas was definitively not my font, so I decided to create my very own font: &lt;a href="http://sites.google.com/site/exeqtor/luconex.ttf?attredirects=0&amp;amp;d=1"&gt;Lucida Console Ex&lt;/a&gt;. Yes I'm returning to my origins, maybe I'm already old.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_uHZQUuxM0oo/TFDpZb9ho6I/AAAAAAAAAFM/bWzGzhrrwns/s1600/lucidaconsoleex.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="864" src="http://1.bp.blogspot.com/_uHZQUuxM0oo/TFDpZb9ho6I/AAAAAAAAAFM/bWzGzhrrwns/s1600/lucidaconsoleex.pn" width="820" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;I'm not really sure if I would end liking this font, maybe creating a bigger Proggy font could be the only acceptable solution. And to clarify, I just modified the default Lucida Console font adding the  things I missed the most.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-7823325793194103811?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/7823325793194103811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/04/my-very-own-font-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/7823325793194103811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/7823325793194103811'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/04/my-very-own-font-programming.html' title='My very own programming font'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_uHZQUuxM0oo/TFDpZb9ho6I/AAAAAAAAAFM/bWzGzhrrwns/s72-c/lucidaconsoleex.pn' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-3088304982835792313</id><published>2010-02-07T14:21:00.008-05:00</published><updated>2010-09-12T22:40:04.736-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='tetris'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='game'/><title type='text'>Simple Tetris Clone (FLEX version)</title><content type='html'>I added to my Tetris clone a &lt;a href="http://code.google.com/p/simple-tetris-clone/source/browse/#svn/branches/flex"&gt;FLEX branch&lt;/a&gt;, it only uses the compiler and not the FLEX class containers (unnecessary for this little game). The point is you can use the free API tools to make a simple game like this, without needing the Flash IDE at all.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;object data="https://sites.google.com/site/exeqtor/fstc.swf" height="272" type="application/x-shockwave-flash" width="480"&gt; &lt;param value="https://sites.google.com/site/exeqtor/fstc.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;It's cool these days to bash anything Adobe related (and the bloated PDF reader or the security holes in the Flash player of course doesn't help). Just for the record &lt;a href="http://flashcrash.dempsky.org/"&gt;this page&lt;/a&gt; &lt;span style="color: #990000;"&gt;can crash your browser&lt;/span&gt; (Click on it only if you feel lucky and don't have something to lose). That is a bug that has not been fixed since &lt;a href="http://www.securityfocus.com/archive/1/archive/1/496929/100/0/threaded"&gt;2008&lt;/a&gt;, and there are many others out there (but with a less spectacular failure outcome). The sad truth is that anybody working (and I mean earning his bread) with Flash technology can tell you scary stories about classes refusing to compile, library assets getting mysteriously corrupted, different movie behavior under different player versions, etc. And if you are angry today I can assure you the bugs were a lot uglier in the AS2 times.&lt;br /&gt;&lt;br /&gt;However, in all honesty, I don't dislike Flash technology, of course hitting a Flash bug makes you feel angry until you find the workaround, but you would learn from your experiences and you would start avoiding the things that don't work, after some time you would have earned an impressive list of best-practices and things to avoid, following that path, working with Flash can be actually a nice experience. I personally like their API design, at the very least they have invested a lot of time and thinking in that.&lt;br /&gt;&lt;br /&gt;Playing with pure Javascript would be the other option (the canvas element seems very promising, I hope the 3D capability goes mainstream) but it's not an option for practical games right now (I mean this year). I have worked in big web game projects and I can't think of another tool that artists can use to recreate Flash animations, making them all sprite-based would make the game bigger in size while losing their vector appeal (easy scaling). Also there is nothing that can run at comparable speed in older browsers today. And don't let me start with the audio... So for making games (not your simple square and circle muted games) I suspect Flash is still going to survive for at least a couple of years. Even if it totally loses the video battle that has already started with the HTML5 video tag.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-3088304982835792313?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/3088304982835792313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/02/simple-tetris-clone-flex-version.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/3088304982835792313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/3088304982835792313'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/02/simple-tetris-clone-flex-version.html' title='Simple Tetris Clone (FLEX version)'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-7521154668094870374</id><published>2010-02-01T23:59:00.001-05:00</published><updated>2010-02-07T17:39:25.038-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='primes'/><category scheme='http://www.blogger.com/atom/ns#' term='pascal'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>The Pascal's triangle</title><content type='html'>It was already time to change the animation for this blog, (the little thing at the right, now with a chess board), so I would do a very short description of the previous one here:&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;object data="http://sites.google.com/site/exeqtor/nazca.swf" height="501" type="application/x-shockwave-flash" width="501"&gt; &lt;param value="http://sites.google.com/site/exeqtor/nazca.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;This animation is just a &lt;a href="http://en.wikipedia.org/wiki/Pascal_triangle"&gt;Pascal's Triangle&lt;/a&gt; (reflected in the four quadrants) with different colors for cells accordingly to their modules with some random prime number that changes in every iteration. The triangle for the next iteration is drawn row by row, while the previous one is faded. Empty spaces are cells that are divisible by the selected prime number.&lt;br /&gt;&lt;br /&gt;If you feel more interested, you could check the section 2.3 of the book &lt;a href="http://www.springer.com/math/dyn.+systems/book/978-0-387-20229-7"&gt;Chaos and Fractals (Springer)&lt;/a&gt; that gave me the inspiration for this.&lt;br /&gt;Browse the &lt;a href="http://wonderfl.net/code/93deb92acf8af31b40f2912d7ddc4c070e562706"&gt;source code&lt;/a&gt; if you feel brave. That code has zero re-usability, I suspect. :P&lt;br /&gt;&lt;br /&gt;Have a nice night!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-7521154668094870374?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/7521154668094870374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/02/pascals-triangle.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/7521154668094870374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/7521154668094870374'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/02/pascals-triangle.html' title='The Pascal&apos;s triangle'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-5859598684550301926</id><published>2010-01-07T15:45:00.003-05:00</published><updated>2010-02-01T22:09:39.123-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='simulator'/><category scheme='http://www.blogger.com/atom/ns#' term='computer'/><title type='text'>Simulator for a basic computer</title><content type='html'>This is simple simulator for the basic computer described in the book of Morris Mano "Computer System Architecture". &lt;a href="http://calab.kaist.ac.kr/%7Ehyoon/courses/cs311/classnote_2006.html"&gt;Here&lt;/a&gt; professor Hyunsoo Yoo maintains a succinct but complete description of this computer, check it if you can't find the book. In special look for the lectures 5 (&lt;a href="http://calab.kaist.ac.kr/%7Ehyoon/courses/cs311/cs311_2006/Ch5.ppt"&gt;Basic Computer Organization and Design&lt;/a&gt;) and 6 (&lt;a href="http://calab.kaist.ac.kr/%7Ehyoon/courses/cs311/cs311_2006/Ch6.ppt"&gt;Programming the Basic Computer&lt;/a&gt;) that this simulator uses as foundation.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;object data="http://sites.google.com/site/exeqtor/sim_basic_comp.swf" height="730" type="application/x-shockwave-flash" width="800"&gt; &lt;param value="http://sites.google.com/site/exeqtor/sim_basic_comp.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;This basic computer is built from these components:&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" str="" style="border-collapse: collapse; height: 367px; width: 383px;"&gt;&lt;col style="width: 74pt;" width="99"&gt;&lt;/col&gt;  &lt;col style="width: 48pt;" width="64"&gt;&lt;/col&gt;  &lt;col style="width: 127pt;" width="169"&gt;&lt;/col&gt;  &lt;tbody&gt;&lt;tr height="27" style="height: 20.25pt;"&gt;   &lt;td class="xl25" height="27" style="color: #666666; font-weight: bold; height: 20.25pt; width: 74pt;" width="99"&gt;Component&lt;/td&gt;   &lt;td class="xl26" style="border-left: medium none; color: #666666; font-weight: bold; text-align: center; width: 48pt;" width="64"&gt;Bits&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; color: #666666; font-weight: bold; width: 127pt;" width="169"&gt;Functionality&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;DR&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;16&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Data Register&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;AR&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;12&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Address Register&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;AC&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;16&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Accumulator&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;IR&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;16&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Instruction Register&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;PC&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;12&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Program Counter&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;TR&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;16&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Temporary Register&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;INPR&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;8&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Input Register&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;OUTR&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;8&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Output Register&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;MEMORY&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;16&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Memory 4096 x 16&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;FGI&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;1&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Input Flag&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;FGO&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;1&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Output Flag&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;IEN&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;1&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Interrupt Enabled Status&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;R&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;1&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Interruption Status&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;I&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;1&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Decode Bit&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;S&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;1&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Halt Status&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;E&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;1&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Carry Bit&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="19" style="height: 14.25pt;"&gt;   &lt;td class="xl28" height="19" style="border-top: medium none; color: #000099; height: 14.25pt;"&gt;SC&lt;/td&gt;   &lt;td class="xl27" num="" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;3&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Sequence Counter&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;And the table of instructions it supports is:&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" str="" style="border-collapse: collapse; height: 607px; width: 585px;"&gt;&lt;col style="width: 23pt;" width="30"&gt;&lt;/col&gt;  &lt;col span="2" style="width: 60pt;" width="80"&gt;&lt;/col&gt;  &lt;col style="width: 60pt;" width="80"&gt;&lt;/col&gt;  &lt;col style="width: 177pt;" width="236"&gt;&lt;/col&gt;  &lt;tbody&gt;&lt;tr height="21" style="height: 15.75pt;"&gt;   &lt;td class="xl28" height="21" style="height: 15.75pt; width: 23pt;" width="30"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl26" rowspan="2" style="color: #666666; font-weight: bold; width: 60pt;" width="80"&gt;Symbol&lt;/td&gt;   &lt;td class="xl26" colspan="2" style="border-left: medium none; color: #666666; font-weight: bold; text-align: center; width: 120pt;" width="160"&gt;Hexcode&lt;/td&gt;   &lt;td class="xl26" rowspan="2" style="font-weight: bold; width: 177pt;" width="236"&gt;&lt;span style="color: #666666;"&gt; &lt;/span&gt;&lt;span style="color: #666666;"&gt;Description&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="22" style="height: 16.5pt;"&gt;   &lt;td class="xl28" height="22" style="height: 16.5pt;"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td class="xl26" style="border-left: medium none; border-top: medium none; color: #666666; font-weight: bold; text-align: center; width: 60pt;" width="80"&gt;I   = 0&lt;/td&gt;   &lt;td class="xl26" style="border-left: medium none; border-top: medium none; color: #666666; font-weight: bold; text-align: center; width: 60pt;" width="80"&gt;I   = 1&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl29" height="140" rowspan="7" style="color: #336666; height: 105pt; width: 23pt;" width="30"&gt;M&lt;br /&gt;E&lt;br /&gt;M&lt;br /&gt;O&lt;br /&gt;R&lt;br /&gt;Y&lt;/td&gt;   &lt;td class="xl27" style="border-left: medium none; border-top: medium none; color: #336666;"&gt;AND&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;0xxx&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;8xxx&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;AND memory word to AC&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #336666; height: 15pt;"&gt;ADD&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;1xxx&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;9xxx&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Add memory word to AC&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #336666; height: 15pt;"&gt;LDA&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;2xxx&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;Axxx&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Load AC from memory&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #336666; height: 15pt;"&gt;STA&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;3xxx&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;Bxxx&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Store content of AC into memory&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #336666; height: 15pt;"&gt;BUN&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;4xxx&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;Cxxx&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Branch unconditionally&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #336666; height: 15pt;"&gt;BSA&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;5xxx&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;Dxxx&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Branch and save return address&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #336666; height: 15pt;"&gt;ISZ&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;6xxx&lt;/td&gt;   &lt;td class="xl25" style="border-left: medium none; border-top: medium none; color: #990000; text-align: center;"&gt;Exxx&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Increment and skip if zero&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl29" height="240" rowspan="12" style="border-top: medium none; color: #000099; height: 180pt; width: 23pt;" width="30"&gt;R&lt;br /&gt;E&lt;br /&gt;G&lt;br /&gt;I&lt;br /&gt;S&lt;br /&gt;T&lt;br /&gt;E&lt;br /&gt;R&lt;/td&gt;   &lt;td class="xl27" style="border-left: medium none; border-top: medium none; color: #000099;"&gt;CLA&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7800&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Clear AC&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;CLE&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7400&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Clear E&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;CMA&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7200&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Complement AC&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;CME&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7100&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Complement E&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;CIR&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7080&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Circulate right AC and E&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;CIL&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7040&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Circulate left AC and E&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;INC&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7020&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Increment AC&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;SPA&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7010&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Skip next instruction if AC is positive&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;SNA&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7008&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Skip next instruction if AC is negative&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;SZA&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7004&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Skip next instruction if AC is zero&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;SZE&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7002&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Skip next instruction if E is zero&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #000099; height: 15pt;"&gt;HLT&lt;/td&gt;   &lt;td class="xl25" colspan="2" num="" style="border-left: medium none; color: #990000; text-align: center;"&gt;7001&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Halt computer&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl29" height="120" rowspan="6" style="border-top: medium none; color: #993399; height: 90pt; width: 23pt;" width="30"&gt;I/O&lt;/td&gt;   &lt;td class="xl27" style="border-left: medium none; border-top: medium none; color: #993399;"&gt;INP&lt;/td&gt;   &lt;td class="xl25" colspan="2" style="border-left: medium none; color: #990000; text-align: center;"&gt;F800&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Input character to AC&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #993399; height: 15pt;"&gt;OUT&lt;/td&gt;   &lt;td class="xl25" colspan="2" style="border-left: medium none; color: #990000; text-align: center;"&gt;F400&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Output character from AC&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #993399; height: 15pt;"&gt;SKI&lt;/td&gt;   &lt;td class="xl25" colspan="2" style="border-left: medium none; color: #990000; text-align: center;"&gt;F200&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Skip on input flag&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #993399; height: 15pt;"&gt;SKO&lt;/td&gt;   &lt;td class="xl25" colspan="2" style="border-left: medium none; color: #990000; text-align: center;"&gt;F100&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Skip on output flag&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #993399; height: 15pt;"&gt;ION&lt;/td&gt;   &lt;td class="xl25" colspan="2" style="border-left: medium none; color: #990000; text-align: center;"&gt;F080&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Interrupt on&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="20" style="height: 15pt;"&gt;   &lt;td class="xl27" height="20" style="border-left: medium none; border-top: medium none; color: #993399; height: 15pt;"&gt;IOF&lt;/td&gt;   &lt;td class="xl25" colspan="2" style="border-left: medium none; color: #990000; text-align: center;"&gt;F040&lt;/td&gt;   &lt;td class="xl24" style="border-left: medium none; border-top: medium none;"&gt;Interrupt off&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;The assembler is a bit different than the book, it supports labels of any size and uses the character (:) instead of (,) also I added the LBL pseudo instruction that can help in some cases:&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" str="" style="border-collapse: collapse; height: 162px; width: 569px;"&gt;&lt;col style="width: 60pt;" width="80"&gt;&lt;/col&gt;  &lt;col style="width: 37pt;" width="49"&gt;&lt;/col&gt;  &lt;col style="width: 270pt;" width="360"&gt;&lt;/col&gt;  &lt;tbody&gt;&lt;tr height="17" style="height: 12.75pt;"&gt;   &lt;td height="17" style="color: #000099; height: 12.75pt; width: 60pt;" width="80"&gt;ORG&lt;/td&gt;   &lt;td style="color: #660000; width: 37pt;" width="49"&gt;N&lt;/td&gt;   &lt;td str="Hexadecimal number N is the memory loc. " style="width: 270pt;" width="360"&gt;Hexadecimal number N is the   memory location&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="17" style="height: 12.75pt;"&gt;   &lt;td height="17" style="color: #000099; height: 12.75pt;"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td style="color: #660000;"&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td&gt;for the instruction or operand listed in the following line&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="17" style="height: 12.75pt;"&gt;   &lt;td height="17" style="color: #000099; height: 12.75pt;"&gt;DEC&lt;/td&gt;   &lt;td style="color: #660000;"&gt;N&lt;/td&gt;   &lt;td&gt;Signed decimal number N to be converted to the binary&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="17" style="height: 12.75pt;"&gt;   &lt;td height="17" style="color: #000099; height: 12.75pt;"&gt;HEX&lt;/td&gt;   &lt;td style="color: #660000;"&gt;N&lt;/td&gt;   &lt;td&gt;Hexadecimal number N to be converted to the binary&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="17" style="height: 12.75pt;"&gt;   &lt;td height="17" style="color: #000099; height: 12.75pt;"&gt;LBL&lt;/td&gt;   &lt;td style="color: #660000;"&gt;L&lt;/td&gt;   &lt;td&gt;Address of label L to be converted to the binary&lt;/td&gt;  &lt;/tr&gt;&lt;tr height="17" style="height: 12.75pt;"&gt;   &lt;td height="17" style="color: #000099; height: 12.75pt;"&gt;END&lt;/td&gt;   &lt;td&gt;&lt;br /&gt;&lt;/td&gt;   &lt;td&gt;End of symbolic program&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;There are 3 sample programs to select, or you can enter your own. After your program is ready press the [Assemble] button, if the program is correct you will need to load the binary codes of the program into memory, you can do this pressing the [Load] button. Now you are ready to run the whole program with [Run] or just go cycle by cycle with [Next].&lt;br /&gt;&lt;br /&gt;The source is available under the MIT license in:&lt;br /&gt;&lt;a href="http://code.google.com/p/basic-computer-simulator/"&gt;http://code.google.com/p/basic-computer-simulator/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Have fun!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-5859598684550301926?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/5859598684550301926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/01/simulator-for-basic-computer.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/5859598684550301926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/5859598684550301926'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2010/01/simulator-for-basic-computer.html' title='Simulator for a basic computer'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-8722937885831117187</id><published>2009-08-02T11:29:00.002-05:00</published><updated>2011-10-22T09:09:19.932-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><title type='text'>Very very simple interpreter in Flex</title><content type='html'>This weekend I've been playing with making a very very simple interpreter in Flash, mostly for drawing functions of the form: &lt;span style="font-weight: bold;"&gt;z = f(x, y)&lt;/span&gt;.&lt;br /&gt;This is based in the &lt;a href="http://compilers.iecc.com/crenshaw/tutor4.txt"&gt;part 4&lt;/a&gt; of the famous &lt;a href="http://compilers.iecc.com/crenshaw/"&gt;Lets build a Compiler!&lt;/a&gt;  tutorial by Jack Crenshaw.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;object data="http://sites.google.com/site/exeqtor/3dplot.swf" height="600" type="application/x-shockwave-flash" width="500"&gt; &lt;param value="http://sites.google.com/site/exeqtor/3dplot.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;I'm planning to do a step by step tutorial when I have time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-8722937885831117187?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/8722937885831117187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2009/08/very-very-simple-interpreter-in-flex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/8722937885831117187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/8722937885831117187'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2009/08/very-very-simple-interpreter-in-flex.html' title='Very very simple interpreter in Flex'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-4425824507156273542</id><published>2009-07-11T13:56:00.004-05:00</published><updated>2011-01-15T18:40:28.754-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='AS3'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Solving simple International Mathematical Olympiad problems.</title><content type='html'>Solving simple International Mathematical Olympiad problems by programming is a sadistic stress reliever. They were originally thought to be solved using only paper, pencil and lots of young and smart neurons. Let's amuse ourselves solving them with a bit of code. &lt;a href="http://blogoscoped.com/archive/2007-12-10-n70.html"&gt;Afterall, Why not to use the nukes?&lt;/a&gt; :D &lt;a href="http://3.bp.blogspot.com/_uHZQUuxM0oo/SlkFlwmU8pI/AAAAAAAAAEQ/1BTt7rYjSu0/s1600-h/Dibujo.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5357319377992872594" src="http://3.bp.blogspot.com/_uHZQUuxM0oo/SlkFlwmU8pI/AAAAAAAAAEQ/1BTt7rYjSu0/s320/Dibujo.JPG" style="cursor: pointer; display: block; height: 110px; margin: 0px auto 10px; text-align: center; width: 320px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;&lt;br /&gt;Follow the links for the solutions in AS3, but if you felt tempted give them first a try, some of these problems can even make a nice programming interview exercise (if the position at hand requires minimal mathematical skills from your candidates).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wonderfl.net/code/ecc2069f02b623abb5c057bcbf04de9023ea7a90"&gt;&lt;span style="font-weight: bold;"&gt;IMO 1960 Problem 01&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: #000099; font-weight: bold;"&gt;&lt;/span&gt;Determine all three-digit numbers N having the property&lt;br /&gt;that N is divisible by 11, and N/11 is equal to the sum&lt;br /&gt;of the squares of the digits of N.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;object data="http://sites.google.com/site/exeqtor/imo60_01.swf" height="200" type="application/x-shockwave-flash" width="480"&gt; &lt;param value="http://sites.google.com/site/exeqtor/imo60_01.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;It's a simple loop with known limits. I guess the average programmer can solve this quickly.&lt;br /&gt;&lt;script src="https://gist.github.com/781366.js?file=gistfile1.as"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wonderfl.net/code/e5e4a3f64024bf1be6452c83999f2138685903a8"&gt;&lt;span style="font-weight: bold;"&gt;IMO 1962 Problem 01&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;Find the smallest natural number n which has the following&lt;br /&gt;properties:&lt;br /&gt;&lt;br /&gt;(a) Its decimal representation has 6 as the last digit.&lt;br /&gt;(b) If the last digit 6 is erased and placed in front of the&lt;br /&gt;remaining digits, the resulting number is four times as&lt;br /&gt;large as the original number n.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;object data="http://sites.google.com/site/exeqtor/imo62_01.swf" height="200" type="application/x-shockwave-flash" width="480"&gt; &lt;/object&gt;&lt;a class="kwyzusvyyeqjmuhugnbd visible ontop" href="http://sites.google.com/site/exeqtor/imo62_01.swf" style="left: 347px ! important; top: -36.8px ! important;" title="Click here to block this object with Adblock Plus"&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;A bit involved, because now your loop doesn't have a limit:&lt;br /&gt;&lt;script src="https://gist.github.com/781369.js?file=gistfile1.as"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://wonderfl.net/code/c1de78e226118551a17e13178fb5ef2c7962b1dc"&gt;&lt;span style="font-weight: bold;"&gt;IMO 1963 Problem 06&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;Five students, A,B,C,D,E, took part in a contest.&lt;br /&gt;One prediction was that the contestants would finish in the&lt;br /&gt;order ABCDE. This prediction was very poor. In fact no&lt;br /&gt;contestant finished in the position predicted, and no two&lt;br /&gt;contestants predicted to finish  consecutively actually did so.&lt;br /&gt;A second prediction had the contestants finishing in the&lt;br /&gt;order DAECB. This prediction was  better. Exactly two of the&lt;br /&gt;contestants finished in the places predicted, and two disjoint&lt;br /&gt;pairs of students predicted to finish consecutively actually&lt;br /&gt;did so. Determine the order in which the contestants finished.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;object data="http://sites.google.com/site/exeqtor/imo60_01.swf" height="230" type="application/x-shockwave-flash" width="480"&gt; &lt;param value="http://planetadev.googlepages.com/imo63_06.swf" name="movie"&gt;&lt;/object&gt;&lt;a class="kwyzusvyyeqjmuhugnbd visible ontop" href="http://sites.google.com/site/exeqtor/imo60_01.swf" style="left: 352px ! important; top: -36.8px ! important;" title="Click here to block this object with Adblock Plus"&gt;&lt;/a&gt;&lt;a class="kwyzusvyyeqjmuhugnbd visible ontop" href="http://planetadev.googlepages.com/imo63_06.swf" style="left: 357px ! important; top: -36.7999px ! important;" title="Click here to block this object with Adblock Plus"&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now we are talking.... Raise your hand if you know what a permutation is. Ok. Now every one of you have to code a working version in five minutes. Counting! :D&lt;br /&gt;I couldn't do it. As always the optimized permutation generator slips through the holes in my mind. So I had to resort to my simple but inefficient recursive generator, it has the advantage that if I forget it, I can deduce it again. Here my ruby version:&lt;br /&gt;&lt;script src="https://gist.github.com/781372.js?file=gistfile1.rb"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Once you have a working generator of permutations the rest is just loop through all the possible outcomes and checking if the conditions are satisfied.&lt;br /&gt;Hmm... pretty boring for human minds, even if there are only 5! = 120 possibilities. It's no wonder that the solution for this problem in &lt;a href="http://www.amazon.com/IMO-Compendium-International-Mathematical-Mathematics/dp/0387242996"&gt;my book&lt;/a&gt; is a one liner without explanation. I guess this problem deserves the nukes!&lt;br /&gt;&lt;script src="https://gist.github.com/781376.js?file=gistfile1.as"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Take care!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-4425824507156273542?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/4425824507156273542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2009/07/solving-simple-international.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/4425824507156273542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/4425824507156273542'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2009/07/solving-simple-international.html' title='Solving simple International Mathematical Olympiad problems.'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_uHZQUuxM0oo/SlkFlwmU8pI/AAAAAAAAAEQ/1BTt7rYjSu0/s72-c/Dibujo.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-3094325044051352824</id><published>2009-07-05T18:17:00.002-05:00</published><updated>2011-01-15T18:57:49.928-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AS3'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>IMO 1959 Problem 04</title><content type='html'>The year is 1959. The place: Braşov, Romania, where the first International Mathematical Olympiad is being held. The problem is short, simple and sweet:&lt;br /&gt;&lt;pre&gt;&lt;span style="color: #000099;"&gt;Construct a right-angled triangle whose hypotenuse c is given if &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;it is known that the median from the right angle equals the &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;geometric mean of the remaining two sides of the triangle.&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can solve it like every high-schooler &lt;a href="http://www.queeky.com/cms/gallery/image/imo-1959-04?play=true"&gt;can do&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_uHZQUuxM0oo/Slktxw1scJI/AAAAAAAAAEY/6VN6gE028w0/s1600-h/imo_1959_04.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5357363564680867986" src="http://3.bp.blogspot.com/_uHZQUuxM0oo/Slktxw1scJI/AAAAAAAAAEY/6VN6gE028w0/s320/imo_1959_04.png" style="cursor: pointer; display: block; height: 240px; margin: 0px auto 10px; text-align: center; width: 320px;" /&gt;&lt;/a&gt;&lt;br /&gt;Or you can &lt;a href="http://wonderfl.net/code/7f735e2b394cb0586b3ca0095efa51d9dc1d9310"&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;brute force&lt;/span&gt;&lt;/a&gt; it! :D&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;object data="http://sites.google.com/site/exeqtor/imo59_04.swf" height="240" type="application/x-shockwave-flash" width="480"&gt; &lt;param value="http://sites.google.com/site/exeqtor/imo59_04.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Cheers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-3094325044051352824?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/3094325044051352824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2009/07/imo-1959-problem-04.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/3094325044051352824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/3094325044051352824'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2009/07/imo-1959-problem-04.html' title='IMO 1959 Problem 04'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_uHZQUuxM0oo/Slktxw1scJI/AAAAAAAAAEY/6VN6gE028w0/s72-c/imo_1959_04.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-1368970042930360243</id><published>2009-07-03T02:00:00.003-05:00</published><updated>2011-10-22T09:17:25.840-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='spanish'/><category scheme='http://www.blogger.com/atom/ns#' term='recursion'/><category scheme='http://www.blogger.com/atom/ns#' term='euler'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='AS3'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Particiones enteras</title><content type='html'>Celebrando el hecho de que ya termino con mi primer ciclo de la maestría, y que ademas he conseguido el titulo de &lt;i&gt;experto&lt;/i&gt; en &lt;a href="http://projecteuler.net/index.php?section=problems"&gt;ProjectEuler&lt;/a&gt; haré un post acerca de un problema que me parece interesante. El enunciado es bien simple:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000066; font-weight: bold;"&gt;Dado un numero entero "n" ¿De cuantas maneras diferentes se puede descomponer "n" en números enteros positivos?.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;La solución aunque simple no es evidente.&lt;br /&gt;Por ejemplo, sea &lt;span style="font-style: italic; font-weight: bold;"&gt;n = 4&lt;/span&gt;.&lt;br /&gt;4 puede descomponerse en: ( 1 + 1 + 1 + 1 ), ( 1 + 2 + 1 ), ( 3 + 1 ), ( 2 + 2 )   y  ( 4 ). Cada una de estas sumas es una &lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;partición entera&lt;/span&gt; &lt;/span&gt;de 4. Como buscamos solo particiones diferentes hay algunas que no se consideran, por ejemplo, no se esta considerando ( 2 + 1 + 1 ) porque es lo mismo que ( 1 + 1 + 2 ) si ignoramos el orden.&lt;br /&gt;Es fácil entender de donde viene el nombre de partición entera, lo que estamos haciendo es "partir" el numero 4 en agrupaciones diferentes:&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_uHZQUuxM0oo/Sk4lqJs1S_I/AAAAAAAAAD4/TfkR-ibY4cI/s1600-h/particiones_4.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5354258413078793202" src="http://2.bp.blogspot.com/_uHZQUuxM0oo/Sk4lqJs1S_I/AAAAAAAAAD4/TfkR-ibY4cI/s320/particiones_4.png" style="cursor: pointer; display: block; height: 185px; margin: 0px auto 10px; text-align: center; width: 520px;" /&gt;&lt;/a&gt;Vemos que el numero de formas &lt;span style="font-style: italic;"&gt;diferentes &lt;/span&gt;en que se puede descomponer 4 es 5.&lt;br /&gt;&lt;br /&gt;&lt;a name='more'&gt;&lt;/a&gt;La función que devuelve el numero total de particiones diferentes de un numero &lt;span style="font-weight: bold;"&gt;"n"&lt;/span&gt; se denota  como &lt;span style="font-style: italic; font-weight: bold;"&gt;p(n)&lt;/span&gt;, entonces: &lt;span style="font-style: italic; font-weight: bold;"&gt;p(4) = 5&lt;/span&gt;. ¿Como hacemos para calcular &lt;span style="font-style: italic; font-weight: bold;"&gt;p(n)&lt;/span&gt; para un &lt;span style="font-style: italic; font-weight: bold;"&gt;"n"&lt;/span&gt; cualquiera? Antes de resolver este problema resolveremos el problema mas general:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000066; font-weight: bold;"&gt;Dado un numero entero "n", listar todas las particiones enteras diferentes de "n".&lt;/span&gt;  &lt;br /&gt;La clave para resolver este problema es considerar particiones ascendentes y ordenadas de menor a mayor.&lt;br /&gt;Una partición ascendente (que abreviaremos: &lt;span style="font-style: italic;"&gt;PA&lt;/span&gt;) es aquella en la cual se cumple que cada termino es igual o mayor que el termino a su izquierda; así ( 1 + 1 + 2 ) es una &lt;span style="font-style: italic;"&gt;PA&lt;/span&gt;,  pero ( 1 + &lt;span style="color: red; font-weight: bold;"&gt;2 + 1&lt;/span&gt; ) no lo es.&lt;br /&gt;&lt;br /&gt;Una partición es mayor que otra partición si su n-ésimo termino es mayor que el n-ésimo termino de la otra partición (cuando se lee de izquierda a derecha), siendo todos los términos anteriores al n-ésimo iguales (si existen).  De aquí que ( 1 + &lt;span style="color: red; font-weight: bold;"&gt;3&lt;/span&gt; ) sea mayor que ( 1 + &lt;span style="color: red; font-weight: bold;"&gt;1&lt;/span&gt; + 2 ) porque su segundo termino es mayor que el segundo termino de la otra.&lt;br /&gt;&lt;br /&gt;Ordenando las particiones ascendentes para n = 4:&lt;br /&gt;&lt;br /&gt;&lt;ol style="color: #666666; font-weight: bold;"&gt;&lt;li&gt;pa1 = 1 + 1 + 1 + 1&lt;/li&gt;&lt;li&gt;pa2 = 1 + 1 + 2&lt;/li&gt;&lt;li&gt;pa3 = 1 + 3&lt;/li&gt;&lt;li&gt;pa4 = 2 + 2&lt;/li&gt;&lt;li&gt;pa5 = 4&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;Iterativamente no se cómo se pueda generar esta secuencia así que iremos por el camino recursivo. De la lista de arriba podemos ver que las particiones ascendentes de 4 son:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; de 4 = (pa1 + pa2 + pa3) + (pa4) + (pa5&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;o dicho de otra manera:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #000099;"&gt;de 4 &lt;/span&gt;&lt;span style="color: #000099;"&gt;= (&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; de 4 que empiezan con 1) + (&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; de 4 que empiezan con 2) + (&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; de 4 que empiezan con 4)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sea&lt;span style="font-style: italic; font-weight: bold;"&gt;  f  &lt;/span&gt;una función recursiva que devuelva particiones ascendentes. Si esta función recibiera como primer parámetro una partición ascendente &lt;span style="font-style: italic; font-weight: bold;"&gt;con la que queremos que empiecen todas las particiones ascendentes devueltas por esta función&lt;/span&gt;, podríamos escribir la igualdad anterior como:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #000099;"&gt;de 4&lt;/span&gt;&lt;span style="color: #000099;"&gt; = f({1}, ...) + f({2}, ...) + f({4}, ...)&lt;/span&gt;       &lt;span style="color: #999999;"&gt;-- (1)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Donde usamos las llaves { } para indicar los términos de una partición. Estamos considerando que&lt;span style="font-style: italic; font-weight: bold;"&gt; f &lt;/span&gt;puede recibir otros parámetros (que aun no hemos descubierto) y por eso le agregamos los puntos consecutivos como segundo parámetro.&lt;br /&gt;&lt;br /&gt;Para resolver este problema es vital darse cuenta que todas las particiones de 4 pueden a su vez ser generadas por la misma función pero enviándole como primer parámetro una partición vacía:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #000099;"&gt;de 4&lt;/span&gt;&lt;span style="color: #000099;"&gt; = f({}, ...)&lt;/span&gt;     &lt;span style="color: #666666;"&gt;-- (2)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Examinando la ecuación (1) vemos que falta el termino f({3}, ...) que correspondería a las particiones ascendentes de 4 que empiezan con 3. De nuestra lista de particiones (al inicio) vemos que no existe ninguna, pero razonemos porque; si existiera alguna &lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; esta sería de la forma: ( 3 + ... ), ya que 3 es menor que 4 entonces aun tenemos que agregarle mas términos, pero los únicos valores que podemos agregar como siguientes términos serian números iguales o mayores que 3 (porque tiene que ser una &lt;span style="font-style: italic;"&gt;PA&lt;/span&gt;) entonces la lista de posibles particiones seria: ( 3 + 3 ), ( 3 + 4 ), etc. Todas ellas con sumas mayores que 4, lo que no puede ser, de aquí que:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({3}, ...) = &lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;/span&gt;&lt;span style="color: #000099; font-size: 100%;"&gt;∅&lt;/span&gt; &lt;span style="color: #666666;"&gt;(conjunto vacío)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Agregando esto a (1):&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #000099;"&gt;de 4&lt;/span&gt;&lt;span style="color: #000099;"&gt; = f({1}, ...) + f({2}, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({3}, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({4}, ...)&lt;/span&gt;       &lt;span style="color: #999999;"&gt;-- (3)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Remplazando (2) en (3):&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({}, ...)&lt;/span&gt; &lt;span style="color: #000099;"&gt;= f({1}, ...) + f({2}, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({3}, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({4}, ...)&lt;/span&gt;       &lt;span style="color: #999999;"&gt;-- (4)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Nos falta una forma de pasar la información del número de quien estamos generando particiones (en nuestro ejemplo de 4). Para esto podemos pasar como segundo parámetro &lt;span style="font-style: italic; font-weight: bold;"&gt;el valor que queremos que sumen los términos que se agreguen a la PA que pasamos como primer parámetro&lt;/span&gt;, agregando esto a (4):&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({}, 4, ...)&lt;/span&gt; &lt;span style="color: #000099;"&gt;= f({1}, 3, ...) + f({2}, 2, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({3}, 1, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({4}, 0, ...)&lt;/span&gt;       &lt;span style="color: #999999;"&gt;-- (5)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #999999;"&gt;&lt;span style="color: black;"&gt;en donde:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({1}, 3, ...) =&lt;/span&gt;&lt;span style="color: #000099;"&gt; ( 1 + 1 + 1 + 1 ), ( 1 + 1 + 2 ), ( 1 + 3 )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({2}, 2, ...)&lt;/span&gt;&lt;span style="color: #000099;"&gt; = &lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;/span&gt;&lt;span style="color: #000099; font-size: 100%;"&gt;( 2 + 2 )&lt;/span&gt;&lt;span style="color: #666666;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style="color: #000099;"&gt;f({3}, 1, ...)&lt;/span&gt;&lt;span style="color: #000099;"&gt; = &lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;/span&gt;&lt;span style="color: #000099; font-size: 100%;"&gt;∅&lt;/span&gt; &lt;span style="color: #666666;"&gt;(conjunto vacío)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f({4}, 0, ...)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #999999;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;span style="color: #000099;"&gt; ( 4 )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Aquí f({1}, ...) se ha convertido en f({1}, 3, ...) porque si cada &lt;span style="font-style: italic;"&gt;PA &lt;/span&gt;empieza con 1 (y buscamos las &lt;span style="font-style: italic;"&gt;PA &lt;/span&gt;de 4), solo necesitamos agregar términos &lt;span style="font-style: italic; font-weight: bold;"&gt;hasta que sumen&lt;/span&gt; 3:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic;"&gt;PA &lt;/span&gt;de 4 que empiezan con 1 =  f({1}, &lt;span style="color: red; font-weight: bold;"&gt;3&lt;/span&gt;, ...)&lt;/span&gt; &lt;span style="color: #000099;"&gt;= &lt;/span&gt;( 1 + &lt;span style="color: red; font-weight: bold;"&gt;1 + 1 + 1&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;), ( 1 + &lt;span style="color: red; font-weight: bold;"&gt;1 + 2&lt;/span&gt; ),  ( 1 + &lt;span style="color: red; font-weight: bold;"&gt;3&lt;/span&gt; )&lt;br /&gt;&lt;br /&gt;Ya estamos preparados para investigar el comportamiento recursivo de &lt;span style="font-style: italic; font-weight: bold;"&gt;f&lt;/span&gt;, vemos que:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f({1}, 3, ...)&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;[( &lt;span style="color: red; font-weight: bold;"&gt;1 + 1&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;+ 1 + 1 ), ( &lt;span style="color: red; font-weight: bold;"&gt;1 + 1&lt;/span&gt; + 2 )],  [ &lt;/span&gt;&lt;span style="color: #000099; font-size: 100%;"&gt;&lt;span style="color: #cc33cc; font-weight: bold;"&gt;∅&lt;/span&gt; ],  &lt;/span&gt;&lt;span style="color: #000099;"&gt;[( &lt;span style="color: #009900; font-weight: bold;"&gt;1 + 3&lt;/span&gt; &lt;span style="color: #000099;"&gt;)&lt;/span&gt;]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;o en palabras:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; de 4 que empiezan con&lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;/span&gt;&lt;span style="color: #000099;"&gt;{1} = (&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; de 4 que empiezan con &lt;span style="color: red;"&gt;{&lt;/span&gt;&lt;span style="color: red; font-weight: bold;"&gt;1, 1&lt;/span&gt;&lt;span style="color: red;"&gt;}&lt;/span&gt;) + (&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; de 4 que empiezan con &lt;span style="color: #993399;"&gt;{&lt;/span&gt;&lt;span style="color: #993399; font-weight: bold;"&gt;1, 2&lt;/span&gt;&lt;span style="color: #993399;"&gt;}&lt;/span&gt;) + (&lt;span style="font-style: italic;"&gt;PA&lt;/span&gt; de 4 que empiezan con &lt;span style="color: #009900;"&gt;{&lt;/span&gt;&lt;span style="color: #009900; font-weight: bold;"&gt;1, 3&lt;/span&gt;&lt;span style="color: #009900;"&gt;}&lt;/span&gt;)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;en donde:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({1, 1}, 2, ...) =&lt;/span&gt;&lt;span style="color: #000099;"&gt; ( 1 + 1 + 1 + 1 ), ( 1 + 1 + 2 )&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({1, 2}, 1, ...)&lt;/span&gt;&lt;span style="color: #000099;"&gt; = &lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;/span&gt;&lt;span style="color: #000099; font-size: 100%;"&gt;∅&lt;/span&gt; &lt;span style="color: #666666;"&gt;(conjunto vacio)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f({1, 3}, 0, ...)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #999999;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;span style="color: #000099;"&gt; ( 1 + 3 )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;o en términos de &lt;span style="font-style: italic; font-weight: bold;"&gt;f &lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({1}, 3, ...)&lt;/span&gt; &lt;span style="color: #000099;"&gt;= f({1, 1}, 2, ...) + f({1, 2}, 1, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({1, 3}, 0, ...)&lt;/span&gt;       &lt;span style="color: #999999;"&gt;-- (6)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;De (5) y (6) podemos obtener pistas de como terminar la recursion, observemos que:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f({4}, 0, ...)&lt;/span&gt;  = ( 4 )&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;br /&gt;f({1, 3}, 0, ...)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #999999;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;span style="color: #000099;"&gt; ( 1 + 3 )&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Es simple deducir de estos ejemplos que si nos pasan como segundo parámetro cero, significa que no necesitamos agregar nada a la lista que nos pasaron como primer parámetro (pues ya suma lo que estábamos buscando), y solo debemos retornar esa lista como respuesta y terminar la recursión, entonces:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f(&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, 0, ...)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #999999;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;&lt;/span&gt;       &lt;span style="color: #999999;"&gt;-- (7)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;en donde:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt; = alguna partición ascendente&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Además de:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({&lt;span style="color: red; font-weight: bold;"&gt;3&lt;/span&gt;}, &lt;span style="color: #009900; font-weight: bold;"&gt;1&lt;/span&gt;, ...)&lt;/span&gt;&lt;span style="color: #000099;"&gt; = &lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;/span&gt;&lt;span style="color: #000099; font-size: 100%;"&gt;∅&lt;/span&gt; &lt;span style="color: #666666;"&gt;(conjunto vacio)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;f({1, &lt;span style="color: red; font-weight: bold;"&gt;2&lt;/span&gt;}, &lt;span style="color: #009900; font-weight: bold;"&gt;1&lt;/span&gt;, ...)&lt;/span&gt;&lt;span style="color: #000099;"&gt; = &lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;/span&gt;&lt;span style="color: #000099; font-size: 100%;"&gt;∅&lt;/span&gt; &lt;span style="color: #666666;"&gt;(conjunto vacio)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;se puede deducir que si el &lt;span style="color: #009900; font-weight: bold;"&gt;segundo parámetro&lt;/span&gt; es un numero menor que el &lt;span style="color: red; font-weight: bold;"&gt;último termino&lt;/span&gt; de la &lt;span style="font-style: italic;"&gt;PA &lt;/span&gt;pasada como primer parámetro, entonces la función debe retornar nada y terminar:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f(&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, m, ...)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #999999;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;span style="color: #000099; font-size: 100%;"&gt;∅&lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;/span&gt;&lt;span style="color: #666666;"&gt;(conjunto vacío)&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;span style="color: #000099;"&gt;Si&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt; (m &amp;lt; z) ∧&lt;/span&gt;&lt;span style="color: #000099;"&gt; (m &amp;gt; 0)&lt;/span&gt;       &lt;span style="color: #999999;"&gt;-- (8)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;en donde:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;z = último termino de &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Es fácil demostrar esto ya que los únicos elementos que podemos agregar a  &lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;pa = {a, b, ... , z}&lt;/span&gt; son números iguales o mayores que &lt;span style="font-style: italic; font-weight: bold;"&gt;z&lt;/span&gt;, y como &lt;span style="font-style: italic; font-weight: bold;"&gt;m &amp;gt; 0&lt;/span&gt; aún tenemos que agregar términos a &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt; (pues no esta completa), pero agregando cualquiera de los términos válidos nos dará una suma mayor que &lt;span style="font-style: italic; font-weight: bold;"&gt;m&lt;/span&gt; (porque los términos validos son por lo menos iguales a &lt;span style="font-style: italic; font-weight: bold;"&gt;z&lt;/span&gt; y&lt;span style="font-weight: bold;"&gt; &lt;span style="font-style: italic;"&gt;z &amp;gt; m&lt;/span&gt;&lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;&lt;/span&gt;) lo que no se quiere.&lt;br /&gt;&lt;br /&gt;De (5) y (6):&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f({}, 4, ...)&lt;/span&gt; &lt;span style="color: #000099;"&gt;= f({1}, 3, ...) + f({2}, 2, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({3}, 1, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({4}, 0, ...)&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;br /&gt;f({1}, 3, ...)&lt;/span&gt; &lt;span style="color: #000099;"&gt;= f({1, 1}, 2, ...) + f({1, 2}, 1, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ f({1, 3}, 0, ...)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Es posible deducir que:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f(&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, m, ...)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #999999;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;span style="color: #000099;"&gt;f({&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, z}, m - z, ...) + f({&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, z + 1}, m - z - 1, ...) &lt;/span&gt;&lt;span style="color: #000099;"&gt;+ ... + f({&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, m}, 0, ...)&lt;/span&gt;       &lt;span style="color: #999999;"&gt;-- (9)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;en donde:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt; = alguna partición ascendente&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;br /&gt;z = último termino de &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, o 1 si &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt; esta vacía.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;m &amp;gt; 0 ∧ m ≥ z&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;La ecuación (9) dice que todas las &lt;i&gt;PA&lt;/i&gt; que empiezan con &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt; (y a las que hay que agregar términos hasta que sumen &lt;span style="font-style: italic; font-weight: bold;"&gt;m&lt;/span&gt;) son iguales a la sumatoria de todas las &lt;i&gt;PA&lt;/i&gt; que empiezan con &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt; mas un termino (que va desde &lt;span style="font-style: italic; font-weight: bold;"&gt; z&lt;/span&gt; hasta &lt;span style="font-style: italic; font-weight: bold;"&gt;m&lt;/span&gt;, donde &lt;b&gt;z&lt;/b&gt; es el ultimo termino de &lt;i&gt;&lt;b&gt;pa&lt;/b&gt;&lt;/i&gt;) en donde se resta el nuevo termino a la suma a la que deben llegar los nuevos términos de las nuevas particiones. Como vemos &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt; crece en tamaño y&lt;span style="font-style: italic; font-weight: bold;"&gt; m&lt;/span&gt; disminuye en valor, siendo evidente por (7) y (8) que este proceso recursivo debe llegar a un fin.&lt;br /&gt;&lt;br /&gt;Ademas de (7), (8) y (9) vemos que ya no serán necesarios mas parámetros para esta función pues ya hemos establecido su proceso iterativo y condiciones para detener la recursión.&lt;br /&gt;&lt;br /&gt;Resumiendo:&lt;span style="color: #000099;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f(&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, m)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #999999;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f({&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, z}, m - z) + f({&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, z + 1}, m - z - 1) &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;+ ... + f({&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, m}, 0)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;  &lt;span style="color: red;"&gt;Si (&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;m &lt;/span&gt;&lt;span style="color: red;"&gt;≥&lt;/span&gt;&lt;span style="color: red;"&gt; z) &lt;/span&gt;&lt;span style="color: red;"&gt;∧&lt;/span&gt;&lt;span style="color: red;"&gt; (m &amp;gt; 0&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;f(&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, m)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #999999;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;span style="color: #000099; font-size: 100%;"&gt;∅&lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;span style="color: red; font-style: italic;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;Si (m &amp;lt; z)&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: red;"&gt;∧&lt;/span&gt;&lt;span style="color: red;"&gt; (m &amp;gt; 0&lt;/span&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;f(&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, m)&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #999999;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;= &lt;/span&gt;&lt;span style="color: #000099;"&gt; &lt;span style="font-style: italic; font-weight: bold;"&gt;pa  &lt;/span&gt;&lt;span style="color: red;"&gt;Si&lt;/span&gt;&lt;/span&gt;&lt;span style="color: red;"&gt; (m = 0&lt;/span&gt;&lt;span style="color: #999999;"&gt;&lt;span style="color: red;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;en donde:&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt; = alguna partición ascendente&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;z = máximo termino de &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt;, o 1 si &lt;span style="font-style: italic; font-weight: bold;"&gt;pa&lt;/span&gt; esta vacía.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;La relación recursiva puede escribirse en forma compacta:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;a href="http://4.bp.blogspot.com/_uHZQUuxM0oo/Sk5074fkEBI/AAAAAAAAAEA/PTNsKeGvlnY/s1600-h/sum.PNG"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5354345579115974674" src="http://4.bp.blogspot.com/_uHZQUuxM0oo/Sk5074fkEBI/AAAAAAAAAEA/PTNsKeGvlnY/s320/sum.PNG" style="cursor: pointer; display: block; height: 79px; margin: 0px auto 10px; text-align: center; width: 320px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Listo!, ya tenemos todo lo necesario para programar.&lt;br /&gt;Usaremos arreglos para representar las particiones e iremos imprimiendo las particiones que vayamos encontrando (no las devolveremos). En código simplificado:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: black;"&gt;void f(pa, m) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #6666cc;"&gt;    // Determinar valor de [z].&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;    z = (pa.longitud() &amp;gt; 0)? pa.ultimo() : 1 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #6666cc;"&gt;    // Proceso recursivo&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;    for (k = z; k &amp;lt;= m; ++k) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #6666cc;"&gt;        // Crear nueva particion temporal [pt] agregando &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #6666cc;"&gt;        // elemento [k] a la particion [pa].&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;        pt = pa.agregarAlFinal(k)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;        if (m == k) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #6666cc;"&gt;            // Si (m - k == 0) imprimir [pt]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;            imprimir(pt) &lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;        else {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #6666cc;"&gt;            // Continuar recursion&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;            f(pt, m - k)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="color: #000099;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Puedes revisar la implementación online en AS3 &lt;a href="http://wonderfl.net/code/618be1d1b0bfab9164b7a0dc9ee12800e8f1955a"&gt;aquí&lt;/a&gt;, los comentarios están en ingles, pero son similares a los comentarios de arriba.&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;object data="http://sites.google.com/site/exeqtor/partitions.swf" height="340" type="application/x-shockwave-flash" width="640"&gt; &lt;param value="http://sites.google.com/site/exeqtor/partitions.swf" name="movie"&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;Lamentablemente la solución que he implementado es bastante lenta para valores de &lt;span style="font-style: italic; font-weight: bold;"&gt;n&lt;/span&gt; grandes. Los métodos de optimización serán motivo de otro post, incluyendo la historia de como ese genio entre genios llamado &lt;a href="http://en.wikipedia.org/wiki/Euler"&gt;Euler&lt;/a&gt; encontró una respuesta genial a esta pregunta... después de buscarla por 11 años!&lt;br /&gt;&lt;br /&gt;Cuídense.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-1368970042930360243?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/1368970042930360243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2009/07/particiones-enteras.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/1368970042930360243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/1368970042930360243'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2009/07/particiones-enteras.html' title='Particiones enteras'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_uHZQUuxM0oo/Sk4lqJs1S_I/AAAAAAAAAD4/TfkR-ibY4cI/s72-c/particiones_4.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-4965856980274890642</id><published>2008-03-22T19:57:00.001-05:00</published><updated>2010-02-01T22:20:21.395-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='J2ME'/><category scheme='http://www.blogger.com/atom/ns#' term='puzzles'/><category scheme='http://www.blogger.com/atom/ns#' term='problems'/><category scheme='http://www.blogger.com/atom/ns#' term='chess'/><title type='text'>Chess problems in your phone</title><content type='html'>This little thing can make you waste serious time if you like chess problems :)&lt;br /&gt;It has been only tested in my SonyEricsson  W810i, but I hope it could run in most of the phones with MIDP 2.0 + CLDC 1.1 support. It requires a phone with at least &lt;span style="font-weight: bold;"&gt;176x176 pixels &lt;/span&gt;in screen resolution.&lt;br /&gt;It supports UNDO and REDO and has the first move of the solution as a hint (if you feel impatient).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_uHZQUuxM0oo/R-WtT9J-kZI/AAAAAAAAACM/OxMHHeWui4g/s1600-h/0.PNG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5180737504705155474" src="http://1.bp.blogspot.com/_uHZQUuxM0oo/R-WtT9J-kZI/AAAAAAAAACM/OxMHHeWui4g/s320/0.PNG" style="cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_uHZQUuxM0oo/R-Ww09J-kcI/AAAAAAAAACk/SghCDX8FnSk/s1600-h/3.PNG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5180741370175721922" src="http://1.bp.blogspot.com/_uHZQUuxM0oo/R-Ww09J-kcI/AAAAAAAAACk/SghCDX8FnSk/s320/3.PNG" style="cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_uHZQUuxM0oo/R-WwttJ-kaI/AAAAAAAAACU/ZJDRS-R18Ec/s1600-h/1.PNG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5180741245621670306" src="http://4.bp.blogspot.com/_uHZQUuxM0oo/R-WwttJ-kaI/AAAAAAAAACU/ZJDRS-R18Ec/s320/1.PNG" style="cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;" /&gt;&lt;/a&gt;The problems belong to the books:&lt;br /&gt;&lt;br /&gt;J. W. Abbott: &lt;b&gt;121 Chess Problems&lt;/b&gt; (1887)&lt;br /&gt;F. Healey: &lt;b&gt;200 Chess Problems&lt;/b&gt; (1866)&lt;br /&gt;&lt;a href="http://www.anders.thulin.name/SUBJECTS/CHESS_PROBLEMS/"&gt;[link]&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I must thank to the guy who converted those PDF files to PGN files, without that I would have spent more time translating the positions to FEN, I only needed to prune off the bad problems and add the hints, the original PGN files can be found here:&lt;br /&gt;&lt;a href="http://uglx.org/misc-chess"&gt;[link]&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You can choose from 4 different sets of pieces, every set has been composed by me, so every one of those pixels belong to me!! :D&lt;br /&gt;To say the truth, the "Da Vinci" set was inspired in this article:&lt;br /&gt;&lt;a href="http://www.timesonline.co.uk/tol/life_and_style/court_and_social/article3523718.ece"&gt;[link]&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_uHZQUuxM0oo/R-WxsNJ-kdI/AAAAAAAAACs/AJanfQsnJIk/s1600-h/2.PNG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5180742319363494354" src="http://2.bp.blogspot.com/_uHZQUuxM0oo/R-WxsNJ-kdI/AAAAAAAAACs/AJanfQsnJIk/s320/2.PNG" style="cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;" /&gt;&lt;/a&gt;&lt;br /&gt;However I guess I couldn't capture the spirit and interchanged the knight by the bishop.&lt;br /&gt;&lt;br /&gt;DOWNLOAD:&lt;br /&gt;&lt;a href="http://planetadev.googlepages.com/chessProblems.jar"&gt;chessProblems.jar&lt;/a&gt;&lt;br /&gt;&lt;a href="http://planetadev.googlepages.com/chessProblems.jad"&gt;chessProblems.jad&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Have a nice day!&lt;br /&gt;&lt;br /&gt;Update 2010: I'm going to port this to the Android soon, also planing to opening the source code if someone is interested.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-4965856980274890642?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/4965856980274890642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2008/03/chess-problems-in-your-phone.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/4965856980274890642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/4965856980274890642'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2008/03/chess-problems-in-your-phone.html' title='Chess problems in your phone'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_uHZQUuxM0oo/R-WtT9J-kZI/AAAAAAAAACM/OxMHHeWui4g/s72-c/0.PNG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-9210225893597021271</id><published>2008-03-02T08:26:00.001-05:00</published><updated>2010-02-01T22:20:56.932-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='opinion'/><category scheme='http://www.blogger.com/atom/ns#' term='spanish'/><title type='text'>Futuro movil</title><content type='html'>Me parece que el futuro será móvil.&lt;br /&gt;&lt;br /&gt;La epoca de las grandes y ruidosas PC de escritorio esta llegando a su fin :D. Y no me refiero a las costosas y pesadas laptops de ahora sino mi idea va mas por el lado de los celulares de ultima generación que están saliendo al mercado.&lt;br /&gt;&lt;br /&gt;Ya estamos viendo laptops cada vez mas pequeñas con discos de estado solido y Linux como SO:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_uHZQUuxM0oo/R8q7q7rK_-I/AAAAAAAAABs/v629MZp8wJY/s1600-h/asuseeepcspec.jpeg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5173153468236103650" src="http://2.bp.blogspot.com/_uHZQUuxM0oo/R8q7q7rK_-I/AAAAAAAAABs/v629MZp8wJY/s320/asuseeepcspec.jpeg" style="cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://gizmodo.com/gadgets/asus-eee/first-review-of-asuss-eee-verdict-ok-hardware-great-ui-315196.php"&gt;$400: Asus EEE&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_uHZQUuxM0oo/R8q8u7rLAAI/AAAAAAAAAB8/5MEM0_YbSCA/s1600-h/specs_dimensions_thumb.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5173154636467208194" src="http://3.bp.blogspot.com/_uHZQUuxM0oo/R8q8u7rLAAI/AAAAAAAAAB8/5MEM0_YbSCA/s320/specs_dimensions_thumb.jpg" style="cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://laptop.org/laptop/hardware/specs.shtml"&gt;$200 OLPC (solo puedes comprarlo por millares)&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Por otro lado los celulares de ahora son cada vez mas potentes.&lt;br /&gt;&lt;br /&gt;Consideremos el iPhone por ejemplo, fue el primero que me demostró que un celular podía ser  utilizado para navegar internet. Antes de eso seguro que muchos celulares tenían web browsers, pero la calidad de navegación era deprimente o incómoda, pantallas muy pequeñas, dificultad para mover la pagina, etc. Súmale a eso la tarifa de la llamada y no era muy tentadora la idea tampoco. Tenia que ser Apple quien demostrara que el tema de la web en tu celular es posible y &lt;span style="font-weight: bold;"&gt;práctico&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;El futuro parece converger en un híbrido de las laptops actuales y tu celular. Con el dispositivo ideal:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Puedes comunicarte fácilmente con tus amigos.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Puedes guardar tu agenda, revisar tu correo, responder tu correo.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Puedes escuchar música, ver videos.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Puedes jugar juegos.&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Puedes escribir reportes (o programar) en el camino.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Todo eso es posible en las laptops actuales, pero no en los celulares, actualmente no existe siquiera  un celular que sirva realmente para jugar, al menos que yo sepa. Trata de jugar cualquier juego de acción en tu celular y veras que es bastante difícil, e incómodo, los botones son pequeños y duros o están muy cerca uno del otro y el pad de dirección esta en un lugar donde no es fácil de usar.&lt;br /&gt;&lt;br /&gt;Necesito un gameboy-celular!! Aunque nada impide soñar que algún día tendremos un iGameBoy.&lt;br /&gt;&lt;br /&gt;En cuanto a herramientas de desarrollo, J2ME es lento.  Concuerdo plenamente con &lt;a href="http://www.armadilloaerospace.com/n.x/johnc/recent%20updates/archive?news_id=295"&gt;John Carmack&lt;/a&gt; (padre de Doom). El dice que no entiende como un celular con hardware suficiente para ser mejor que un GameBoy Advance con Java se convierte en un CPU con el poder de una IBM PC de 4.77 MHz y encima con controles que apestan!&lt;br /&gt;&lt;br /&gt;Google mismo se ha dado cuenta de esto y le ha lanzado una artera puñalada a Sun con su &lt;a href="http://code.google.com/android/"&gt;Android&lt;/a&gt;. Android hasta ahora es solo una copia del J2ME, claro, sin todas las restricciones del consorcio J2ME y open source, pero sigue siendo Java (aunque usando una máquina virtual completamente diferente). Aun falta algo que permita acceder al procesador directamente, algo tan importante para desarrollar juegos de acción. Google ha dicho que esta en sus planes. Esperemos pues.&lt;br /&gt;&lt;br /&gt;Un tercer contendor seria: FlashLite.&lt;br /&gt;&lt;br /&gt;Aunque Flash ya tiene en su récord haber desaparecido (para efectos practicos) los applets de la web, su incursion en el mercado de celulares es aun muy limitada y aunque mejora el hecho de la compatibilidad (por el mismo hecho de que solo corre en pocos equipos) los primeros reportes no indican un aumento en el desempeño gráfico importante.&lt;br /&gt;El tiempo dirá, de todos modos el tiempo corre a favor de FlashLite y en contra de J2ME.&lt;br /&gt;&lt;br /&gt;Y bueno esta semana decidi portar mis problemas de ajedrez de la semana pasada de AS3 a J2ME como un ejercicio y este es el resultado:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://planetadev.googlepages.com/chessProblems.jar"&gt;JAR&lt;/a&gt;&lt;br /&gt;&lt;a href="http://planetadev.googlepages.com/chessProblems.jad"&gt;JAD&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Demás esta decir que tuve que experimentar en carne propia el ya famoso "write once, run everywhere", que para efectos prácticos se convierte en "compila en windows,  falla donde sea". En mi caso habían dos errores que en el emulador no se notaban pero si en mi celular. Claro que los dos errores eran mi culpa (en este caso), pero se de otros que se han jalado los cabellos por errores esotéricos en la implementación del fabricante. De nuevo, no es culpa de Java tampoco, pero eso les pasa a los chicos de Sun por crear un lema tan pegajoso :).&lt;br /&gt;&lt;br /&gt;Solo lo he probado en mi celular W810i y supuestamente debería correr en cualquier dispositivo con soporte CLDC 1.1 y MIDP 2.0.&lt;br /&gt;&lt;br /&gt;Notas finales:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;- No quiero hacer juegos de accion para celulares, pero puzzles esta bien.&lt;br /&gt;- Java sera por fin WORE? O sera desplazado de nuevo por Flash?&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;- Microsoft existira en el futuro? Creo que ninguno de esos celulares corre Windows ni IE.... :D&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;- Cuando sale mi iGameBoy????&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Hasta la proxima!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-9210225893597021271?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/9210225893597021271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2008/03/futuro-movil.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/9210225893597021271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/9210225893597021271'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2008/03/futuro-movil.html' title='Futuro movil'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_uHZQUuxM0oo/R8q7q7rK_-I/AAAAAAAAABs/v629MZp8wJY/s72-c/asuseeepcspec.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-8703120992216878900</id><published>2007-11-04T11:36:00.001-05:00</published><updated>2010-02-01T22:22:20.347-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='c++'/><category scheme='http://www.blogger.com/atom/ns#' term='spanish'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl</title><content type='html'>Recuerdo el día que se rompió la  burbuja C/C++ que aprisionaba mi cabeza. Fue por la noche, estaba molesto, pues tenía que aceptar, nuevamente, que aquel simple &lt;span style="font-style: italic;"&gt;programita&lt;/span&gt; que me había querido hacer seguiría demorándose n-dias mas porque ya estaba cansado de escribir tanto código aburrido, para hacer hacer algo que no era ni tan interesante, ni tan urgente como para seguir frente a una computadora, después de haber estado todo el día frente a otra en mi trabajo, tal ves  podría dormir temprano por alguna vez, y tratar de llegar temprano mañana, para variar.&lt;br /&gt;&lt;br /&gt;"Debe haber algo mejor", me decía, no puede ser que para abrir un archivo tenga que escribir:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: #ffcc96; font-size: 85%;"&gt;&lt;span style="font-family: lucida console,courier new;"&gt;&lt;span style="color: #660000;"&gt;HANDLE hArchivoFuente = NULL;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;hArchivoFuente = CreateFile (m_strSource,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    GENERIC_READ,      //Para lectura&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    0,                 //No se permite compartir&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    NULL,              //No seguridad&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    OPEN_EXISTING,     //Falla si no existe&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    FILE_ATTRIBUTE_NORMAL,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    NULL);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;if (hArchivoFuente == INVALID_HANDLE_VALUE) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;  ::MessageBox (NULL,&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;      "No se pudo abrir el archivo de origen.",&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;      NULL, MB_OK | MB_ICONERROR);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;  return;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;Y eso que ni siquiera estaba programando usando el API Win32 puro, debido a que me estaba tomando mucho tiempo, había terminado usando MFC, denigrándome en mi auto conferido titulo de "verdadero programador". Que iba a saber yo  entonces que los "verdaderos programadores" solo programan en ensamblador :)-&lt;br /&gt;&lt;br /&gt;Para entonces seguro que ya me habría hecho el &lt;span style="font-style: italic;"&gt;programita &lt;/span&gt;en VisualBasic en un dos por tres, pero a mis cándidos ojos de flamante internauta, crédulos y asombrados, le era evidente que en el mundo de los "verdaderos programadores", los que programaban en VisualBasic o eran unos retardados o lo hacían porque no tenían ninguna otra opción. Y claro esta que yo no quería parecer retardado ante semejantes &lt;span style="font-style: italic;"&gt;luminarias&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Asi pues, por ese entonces, para mis proyectos personales o era C/C++ o era nada. Aunque por ahi rondara un triste engendro mio hecho en VB, cuyo único punto  que lo salvaba del anonimato era que tenia un control programado en C++ usando ATL.&lt;br /&gt;&lt;br /&gt;Pero ya estaba harto. Programar en C/C++ era lento, tanto que aveces me aburría del proyecto y comenzaba con otro.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_uHZQUuxM0oo/Ry18TsVWr3I/AAAAAAAAAA0/cmZuN9NIwXg/s1600-h/Chapulin.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5128892228404948850" src="http://4.bp.blogspot.com/_uHZQUuxM0oo/Ry18TsVWr3I/AAAAAAAAAA0/cmZuN9NIwXg/s320/Chapulin.jpg" style="cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;" /&gt;&lt;/a&gt;&lt;br /&gt;Asi fue como comenzé a buscar algún otro lenguaje y me tope con Perl, lo que mas me gusto fue que podía programar iterativamente, lanzaba el programa desde mi editor con una tecla y asi sucesivamente iba refinando mi programa. A mis manos cayo un librito de como "Aprender Perl en 24 dias" o era horas? no recuerdo bien y casi como jugando empecé a usarlo para todas esa cosas aburridas y tediosas que necesitaban ser automatizadas. Gracias a Perl pude agregar comandos a mi editor para compilar C/C++,  Java, C#, Haskell, Ocaml y hasta HLA, pude mandar correos con una tecla, hacer backups de la empresa mientras leía cosas mas interesantes, administrar el repositorio SVN, crear instaladores y no se cuanta cosa mas. Mi computadora (y la de mi trabajo) esta llena de pequeños y útiles archivos pl, tanto asi que Perl es la segunda cosa que instalo cada vez que tengo que formatear mi computadora.&lt;br /&gt;&lt;br /&gt;De eso ya hace tiempo, puedo decir que he aprendido lo suficiente de Perl como para encontrarle cosas que no me gustan. Por el tiempo que decidí aprender Perl, ya existía Python y Ruby. Pero debido a que todos esos nombres me sonaban raros decidí usar el primer lenguaje que me funcionó, así que se puede decir que mi elección por Perl fue accidental, y no fríamente calculada. A pesar de ello, no me arrepiento de haberlo aprendido, aunque ahora ya no lo use tanto. De haber llegado a mis manos "Aprenda Lisp en 24 horas" tal vez otra seria mi historia :)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: #ffcc96; font-size: 85%;"&gt;&lt;span style="font-family: lucida console,courier new;"&gt;&lt;span style="color: #660000;"&gt;# Fill parameter values&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;if (/(\S+)/) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;  if ($arrayOpen) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    if (/\}/) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;      $arrayOpen = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    chomp($_);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    @{$test[$indexTest]}[$indexParam] .= $_;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    $_ .= "\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;  else {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    if (( /\{/ ) &amp;amp;&amp;amp; !( /\}/)) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;      $arrayOpen = 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    chomp($_);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    @{$test[$indexTest]}[$indexParam] = $_;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;    $_ .= "\n";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #660000;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;El código de arriba es parte del script mas grande que tengo en Perl, crea una solución completa para VisualStudio 2005, interpreta un problema, y crea todos los archivos necesarios con formato y casos de prueba. En el colmo de la ironía: para poder resolver problemas en C++. En Perl es un poco mas de 600 lineas, no quiero imaginar cuantas lineas sería en C++,  aun usando Boost. Pero seguro que son mas de las que me molestaría en programar para algo así. El punto es: el código de arriba trata de ser legible, aun asi: ¿Cuantos pueden adivinar que esta pasando ahi?.&lt;br /&gt;&lt;br /&gt;Hace tiempo Larry Wall (el creador de Perl) estaba hablando de las irracionalidades que comenten los que crean lenguajes de programación,  aquí algunos extractos, algunos bastante graciosos (tristemente con algo de verdad) :&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #333399;"&gt;&lt;br /&gt;- "Tenemos que comenzar todo desde el principio!" (casi cualquier lenguaje académico que encuentres)&lt;br /&gt;- "Frases en ingles" (eso es Cobol)&lt;br /&gt;- "El procesamiento de texto no importa mucho" (Fortran)&lt;br /&gt;- "Lenguajes simples producen soluciones simples" (C)&lt;br /&gt;- "Se me ha ocurrido un modo de hacerlo asi que debe de estar bien" (PHP)&lt;br /&gt;- "Puedes construir todo con puertas NAND" (cualquier lenguaje inventado por un electrónico)&lt;br /&gt;- "Este es un lenguaje de muy alto nivel, ¿A quien le importan los bits?" (lenguajes 4G)&lt;br /&gt;- "A los usuarios les importa la elegancia" (Eiffel)&lt;br /&gt;- "La especificación es suficientemente buena" (Ada)&lt;br /&gt;- "Hagamos esto fácil para la computadora!" (Lisp)&lt;br /&gt;- "Todo es un objeto" (Smalltalk y Ruby)&lt;br /&gt;- "Todo es una hipótesis" (Prolog)&lt;br /&gt;- "Todo es una función" (Haskell)&lt;br /&gt;- "Los programadores no deberían tener nunca libre albedrío" (Python) &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Pero Larry se olvido de criticar Perl, yo diría:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #333399;"&gt;- "Hagamos esto críptico!" (Perl)  :p&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hasta al proxima!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-8703120992216878900?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/8703120992216878900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2007/11/perl.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/8703120992216878900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/8703120992216878900'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2007/11/perl.html' title='Perl'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_uHZQUuxM0oo/Ry18TsVWr3I/AAAAAAAAAA0/cmZuN9NIwXg/s72-c/Chapulin.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2994292646876077363.post-2495042272547414848</id><published>2007-11-01T17:00:00.001-05:00</published><updated>2010-02-01T22:23:18.779-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hiring'/><category scheme='http://www.blogger.com/atom/ns#' term='spanish'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><title type='text'>De como encontré programadores que no podían programar la serie de Fibonacci</title><content type='html'>Es difícil encontrar buenos programadores y es mucho mas difícil decidir en unos cuantos minutos cual es la capacidad de cada candidato para resolver problemas de un nivel de dificultad no trivial. No quiero equivocarme, es muy costoso para la empresa contratar un candidato que no pueda ajustarse a las exigencias del puesto, es frustrante para dicha persona y negativo para el equipo en general. Lamentablemente ya me ha pasado. Asi que en la duda prefiero rechazar que aceptar.&lt;br /&gt;&lt;br /&gt;Ahora bien si nosotros estuviéramos mas enfocados en búsquedas en tablas y presentación de resultados (y no hay nada de malo en ello) obviamente me centraría mas en saber cual es la experiencia con SQL, herramientas de reportes, creación de interfaces, etc. del candidato. Lamentablemente lo que yo busco es un candidato con la capacidad de resolver problemas que probablemente ni el ni yo hemos visto, además de poder hacer todas esas cosas mundanas que la gente de TI hacemos.&lt;br /&gt;&lt;br /&gt;Encontrar este tipo de programadores es bastante difícil, encontrar buenos programadores en general es difícil. Por ello el proceso completo de selección de un programador con experiencia (no junior) envuelve: revisión de su CV, un examen online y finalmente un examen escrito con entrevista personal.&lt;br /&gt;&lt;br /&gt;El CV básicamente solo descarta aquellas personas que mencionan su experiencia con lenguajes de programación como Word, PowerPoint o Internet Explorer (y no es haciendo macros o JavaScript). Es decir: tienes que tener un CV tan pero tan malo para que sea rechazado en esta fase.&lt;br /&gt;&lt;br /&gt;El examen online me ayuda a separar a los que &lt;span style="font-style: italic; font-weight: bold;"&gt;dicen&lt;/span&gt; tener años de experiencia en C/C++, de los que realmente tienen &lt;span style="font-style: italic; font-weight: bold;"&gt;algo&lt;/span&gt; de experiencia. Las preguntas no son triviales, aunque ciertas pistas y respuestas se pueden encontrar buscando en la web. Casi todas las preguntas se pueden responder con menos de 100 lineas. Y debido a que se pueden elegir las preguntas a resolver casi siempre se eligen las preguntas mas simples. El candidato tiene un tiempo máximo de una semana para entregarlo después de contactar con el. Esto debido a que puede estar trabajando y solo podría resolver el examen en su tiempo libre. Que lo entregue lo mas pronto posible es por cierto considerado como un punto a favor. Solo un 5% pasa esta etapa, quizás menos. Lo que es bueno porque me evita el trabajo de descartar a los que solo han hecho cosas triviales en C/C++, (como copiar de la pizarra en su clase de Lenguajes de Programación I, hace varios años dicho sea de paso, eso señores no cuenta como años de experiencia en ningún lenguaje de programación excepto quizás VisualBasic), asi como a los que realmente no están muy interesados en el puesto y piensan que es un fastidio continuar con tan horrendo examen.&lt;br /&gt;&lt;br /&gt;Ahora viene la parte difícil, decidir de entre los que enviaron el examen a los que realmente me gustaría contratar de los que no. Una primer vistazo al código es suficiente para descartar muchos, solo un 20% logra aprobar el examen, y no hablo de formato de código, o eficiencia de la implementación, hablo que muchos programas se cuelgan o dan soluciones equivocadas.&lt;br /&gt;&lt;br /&gt;Entonces me queda un 1% del total por evaluar. Para comenzar debo aclarar que cualquiera que haya resuelto y aprobado ese examen &lt;span style="font-style: italic; font-weight: bold;"&gt;por su cuenta&lt;/span&gt; es capaz de realizar cualquier trabajo medianamente complejo en C/C++. Y de tener recursos ilimitados por gastar contrataría directamente a dicha persona. Pero no los tengo, asi que mi inquietud es medir &lt;span style="font-style: italic; font-weight: bold;"&gt;con cuanta ayuda&lt;/span&gt; resolvió el candidato ese examen online y&lt;span style="font-style: italic;"&gt; &lt;span style="font-weight: bold;"&gt;cuanto tiempo real&lt;/span&gt; &lt;/span&gt;le tomaría hacerlo todo de nuevo bajo mi supervisión. Ahora que lo pienso esa seria una buena solución. Esto de escribir blogs es bueno. De hecho bastaría sentarme con el media hora para darme cuenta de que se encontró la solución por algún lado y la copio o que realmente se tomo un mes para resolver el examen antes de enviar su CV. Ahora, el hecho que lo haya podido hacer tiene su lado bueno, el restante 95% de candidatos no pudo hacerlo. Por otro lado no quiero contratar una persona deshonesta.&lt;br /&gt;&lt;br /&gt;La solución actual implica pedirle al candidato venir para una entrevista personal y un examen psicológico y de programación. El examen psicológico es un test de IQ estándar, no hemos tenido sorpresas aqui,  casi todos hacen entre 8 y 10 de 13 (lo que esta dentro del rango normal), donde si he tenido sorpresas es en el examen de programación. Este examen es bastante simple, o me parecía bastante simple, al principio pensé que seria ridículamente simple y esperaba ver cierta cara de mofa en los candidatos ante tales preguntas, todo sea por verificar la capacidad de cada candidato me decía. Si tu dices saber teoría de números y yo te pongo una pregunta donde debes multiplicar 13x14, lo que se espera es que puedas resolver eso sin ninguna dificultad. Casi como respirar.&lt;br /&gt;&lt;br /&gt;Dicho examen puede ser resuelto en C/C++ o pseudocódigo, importa poco si te equivocas por allí en cerrar una llave o un paréntesis si la idea se entiende. Vamos yo me equivoco varias veces en ese tipo de cosas todos los dias, seria tonto decirte que no sabes programar porque no pusiste un punto y coma al final de una sentencia, ese tipo de cosas suelen pasar y mas si estas bajo presión y &lt;span style="font-style: italic; font-weight: bold;"&gt;escribiendo en papel&lt;/span&gt;. Además, y aqui voy a dejar tema para otro post: yo creo que un lenguaje que &lt;span style="font-style: italic; font-weight: bold;"&gt;te obliga&lt;/span&gt; a poner un punto y coma al final de cada sentencia es un &lt;span style="font-style: italic; font-weight: bold;"&gt;fastidio&lt;/span&gt;, por decir lo menos. Y ya esta, que empiecen a llover los vilipendios. Pero desde que mi lenguaje favorito dejo de ser C/C++ y ahora es Ruby no voy a cambiar de opinión (si ya se que que Ruby es lento, por eso aun uso C/C++), pero bueno, a lo que iba.&lt;br /&gt;&lt;br /&gt;Espero que un candidato con experiencia resuelva ese examen sin mucho problema: OK lo ideal seria darle un compilador por media hora pero el examen también tiene preguntas de concepto y diseño, no creo que una PC le ayude mucho en ello, además estamos partiendo del precepto de &lt;span style="font-style: italic;"&gt;&lt;span style="font-weight: bold;"&gt;que el candidato sabe programar y bastante bien&lt;/span&gt;. &lt;/span&gt;Entonces llegamos a la pregunta maldita:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #660000; font-size: 100%;"&gt;&lt;span style="font-family: courier new;"&gt;Implementar una función que devuelva el termino n-esimo de la serie de Fibonacci: 1,1,2,3,5,8,... &lt;/span&gt;&lt;span style="font-family: courier new;"&gt;¿En cuanto tiempo calculará su función el valor de fibonacci(75)?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Tan simple como eso, la segunda parte es un hint para que el candidato implemente una solución iterativa, pues la solución recursiva demora demasiado y me sirve perfectamente para verificar si el candidato ha implementado alguna vez en su vida este ejercicio básico.&lt;br /&gt;&lt;br /&gt;Y aqui viene la parte desagradable y el motivo de este post, pues he tenido que rechazar candidatos que en el papel tenían amplios conocimientos y certificados, cuyo examen online estaba dentro del promedio de calidad que acepto (sin llegar a ser brillante) pero cuya respuesta a esta pregunta hizo que sonaran muchas campanas de alerta en mi interior.&lt;br /&gt;&lt;br /&gt;Hubo un candidato que tenia en su CV una maestría en una universidad del extranjero en ciencias de la computación, había implementado como tesis de bachiller un complejo algoritmo de optimización y que sin embargo falló en todas las preguntas simples que le hice. Siendo esta la de Fibonnacci la que ya no pude soportar. Cuando le pregunte el porqué me respondió: "Que era algo que había visto en la universidad hace mucho tiempo y no se recordaba bien pero tenia que hacerse con recursión."&lt;br /&gt;&lt;br /&gt;El que no se recordara de Fibonacci no importaba, de hecho que nunca haya visto el problema seria lo ideal pues el candidato trataría de resolverlo solo con su ingenio, la serie esta ahí, ¿Quizás no pudo recordar como se formaba la serie? Difícilmente pues el mismo está admitiendo haberla visto algún tiempo y no es una serie como esta:  &lt;b&gt; 1, 11, 21, 1211, 111221, 312211,... &lt;/b&gt;Esa si es una serie que te hará doler la cabeza. El hecho es que para mi el candidato solo conocía la programación desde un punto de vista teórico, y eso hasta puede estar bien, Dijkstra mismo  pensaba que había algo mas abstracto en las ciencias de la computación que mera programación. Algo en lo cual yo creo totalmente. "Las computadoras no son mas, a las ciencias de la computación, de lo que los telescopios son a la astronomía". Absolutamente cierto, pero yo estoy buscando un programador &lt;span style="font-style: italic; font-weight: bold;"&gt;practico&lt;/span&gt;, y todos los programadores buenos y prácticos que conozco, aquellos que logran hacer cosas, pueden resolver este problema sin pensarlo mucho, quizás sin usar un tipo de dato que te permita calcular fibonacci(75), quizás sin emplear solo dos variables, quizás sin usar &lt;a href="http://en.wikipedia.org/wiki/Fibonacci_number"&gt;la formula cerrada o usando matrices&lt;/a&gt;, quizás sin emplear librerías especiales de números para calcular valores grandes, etc. Solo pon algunas variables y un contador dentro de un sucio for o while y punto. Siguiente problema.&lt;br /&gt;&lt;br /&gt;Por eso escribo este post, quizás haya algún buen programador ahí afuera, realmente bueno, que lo lea y que tampoco sepa como programar la serie de fibonacci y que me convenza que alguien que no puede hacerlo en 10 minutos puede aún resolver problemas mas complejos &lt;span style="font-style: italic; font-weight: bold;"&gt;pero practicos&lt;/span&gt;(?).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2994292646876077363-2495042272547414848?l=elrinconde-ex.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elrinconde-ex.blogspot.com/feeds/2495042272547414848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elrinconde-ex.blogspot.com/2007/10/de-como-ex-encontro-hackers-que-no.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/2495042272547414848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2994292646876077363/posts/default/2495042272547414848'/><link rel='alternate' type='text/html' href='http://elrinconde-ex.blogspot.com/2007/10/de-como-ex-encontro-hackers-que-no.html' title='De como encontré programadores que no podían programar la serie de Fibonacci'/><author><name>_ex_</name><uri>http://www.blogger.com/profile/01910988779640115452</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry></feed>
