Thursday, January 7, 2010

Simulator for a basic computer

This is simple simulator for the basic computer described in the book of Morris Mano "Computer System Architecture". Here 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 (Basic Computer Organization and Design) and 6 (Programming the Basic Computer) that this simulator uses as foundation.

Sunday, August 2, 2009

Very very simple interpreter in Flex

This weekend I've been playing with making a very very simple interpreter in Flash, mostly for drawing functions of the form: z = f(x, y). This is based in the part 4 of the famous Lets build a Compiler! tutorial by Jack Crenshaw.


Saturday, July 11, 2009

Solving simple International Mathematical Olympiad problems.

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. Afterall, Why not to use the nukes? :D

Sunday, July 5, 2009

IMO 1959 Problem 04

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:
Construct a right-angled triangle whose hypotenuse c is given if 
it is known that the median from the right angle equals the 
geometric mean of the remaining two sides of the triangle.

The mathematical solution is left as an exercise, because you can use the brute force Luke. :D




Cheers.

Friday, July 3, 2009

Particiones enteras

Celebrando el hecho de que ya termino con mi primer ciclo de la maestría, y que ademas he conseguido el titulo de experto en ProjectEuler haré un post acerca de un problema que me parece interesante. El enunciado es bien simple:

Dado un numero entero "n" ¿De cuantas maneras diferentes se puede descomponer "n" en números enteros positivos?.

La solución aunque simple no es evidente.
Por ejemplo, sea n = 4.
4 puede descomponerse en: ( 1 + 1 + 1 + 1 ), ( 1 + 2 + 1 ), ( 3 + 1 ), ( 2 + 2 ) y ( 4 ). Cada una de estas sumas es una partición entera 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.
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:
Vemos que el numero de formas diferentes en que se puede descomponer 4 es 5.

Saturday, March 22, 2008

Chess problems in your phone

This little thing can make you waste serious time if you like chess problems :)
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 176x176 pixels in screen resolution.


It supports UNDO and REDO and has the first move of the solution as a hint (if you feel impatient). The problems belong to the books:

J. W. Abbott: 121 Chess Problems (1887)
F. Healey: 200 Chess Problems (1866)
[link]

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:
[link]

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
To say the truth, the "Da Vinci" set was inspired in this article:
[link]

DOWNLOAD:chessProblems.jar
chessProblems.jad

Have a nice day!