Qualification Round: Train Timetable

Have you noticed that there is always a train ready to go at the time of a trip departure? there is no delay, that have to be planned someway, this is exactly what we were asked to do, we were to do a program to calculate the minimal number of trains required to accomplish all the trips on time. Click here to download the problem statement. (more…)
July 19th, 2008 by Jorge Sanchez 

Qualification Round: Saving the Universe

The first of three nice problems in the “Qualification Round” for Google Code Jam 2008, our mission is to save the universe from a possible implosion caused by a search engine, how can we fix this to keep the universe in order? the answer is a click away from here. You may start thinking how can a search engine make all the universe implode, well … impossible happens … all the...

July 19th, 2008 by Jorge Sanchez 

The Price is Wrong

We have to make a program that tells what is the smallest set of prices needed to change in order to have a growing price list. This time we need to think a little bit more, why? because if we don’t think before coding our program can be dealing with 2 at the power of 64 iterations a total of 18446744073709551616 iteration which is hard even if your PC have the best processor in the market. Click...

July 12th, 2008 by Jorge Sanchez 

Triangle Trilemma

We are asked to write a program to classify triangles, this is an easy one, easy is good because at this time all we need is just one successful solution for the Qualification Round, of course our chances to qualify are higher if we start with the easy problem at the contest. Click here to download the problem statement. (more…)
July 12th, 2008 by Jorge Sanchez 

Training for Google Code Jam 2008 with ActionScript3

Imagine this, the contest day has come, you’re in front of your computer waiting the last 60 seconds for the contest to begin, it’s your first programming contest but you haven’t had time to try to answer the Practice Problems so you have no idea on how to solve even the easiest problem. If you don’t have much time to practice or you just want to see a different solution to the practice problems,...

July 11th, 2008 by Jorge Sanchez 

Step 6: Placing nodes in the organigram

In this final step we will place every node in it’s correct position, from the previous step we know that the width of the entire control depends on the number of nodes without children and the number of level, so, we can easily place the nodes without children, its position is given by the up left corner position (x, y). For every node without children we have: x = (n - 1) * nodeWidth + (n...

May 4th, 2008 by Jorge Sanchez 

Step 5: Implementing the Organigram Class

The Node class was simple, the Organigram is not going to be different, as we did before we need to implement a constructor, override some functions and implement some additional functions. Calculating the size (width and height) of the organigram Let’s check the picture To calculate the width we have to find all the nodes without children in the picture those nodes are numbered from 1 to 9,...

April 9th, 2008 by Jorge Sanchez 

Step 4: Implementing additional functions for Node

In the previous step I left an important implementation, it is important because every class visual or not must have it, it is called the constructor and it has the same as the class that is being implemented, in our case we have the following code for the constructor. // Implement class constructor public function Node(): void { super(); // always call the superclass constructor in aour case Canvas setStyle("backgroundImage",...

April 8th, 2008 by Jorge Sanchez 

Step 3: Implementing the Node class

Before reading this step, you have to download the source code of this control from the FlexTuts Library section, that way it will be easier to understand what we are doing. Calculating the size (width and height) of a node The following image will help us calculate the total width and height from the image we can say: nodeWidth = border + picture.width + space + title.width + border nodeHeight =...

April 7th, 2008 by Jorge Sanchez 

Step 2: Project Organization

In this step we will create and organize the library project and a flex application project to test the library, from now on I’ll assume that you have installed the Flex Builder 3. Creating the library project: FlexTutsLibrary To create a library project in Flex Builder 3 go to File>New>Flex Library Project. A window will be shown. Then fill the Project name field with ‘FlexTutsLibrary’...

April 7th, 2008 by Jorge Sanchez