50 Years of Visionary Sci-Fi Computer Interfaces f

Create your own machine learning powered RSS reader in under 30 minutes f

Why Amazon has no profit—and why it works f

DuckTales Theme Song With Real Ducks

You Might Not Need jQuery f

Metacademy - Level-Up Your Machine Learning f

Realistic terrain in 130 lines f

Common C# Interview Questions f

10 Inexpensive Ways to Build Your Wardrobe f

Become a better programmer with programming challenges f

When I went to university me and some friends spent time on practising algorithm implementations for the national programming contests that were held each year. The concept was (and still is) to solve about ten problems in a couple of hours time using a programming language of choice. The source code is submitted to an automatic judge that compiles the code and feeds the executable with test data and verifies that the program delivers the correct output expected for the input.

After being out in real work I have noticed that I have had good use of these earlier exercises. One of the most important lessons is to know by heart the complexity of different algorithms and when to use a simple brute force method and when a more advanced algorithm must be implemented.
I noticed that the old Online Judge system that we practised on in the early 2000s still is online and has grown to a large site with lots of users solving programming challenges. If you want to recapitulate your algorithm skills this is a fun and very hands on way to do small exercises and get feedback in realtime. Also there is an addictive gamification effect of trying to solve more problems.

Browse the catalogue of problems and find some challenge that feels interesting. The problems are color coded so you know which one you already solved and some stats that gives a hint on how difficult the problems have been for other users to solve.


Once you have submitted your code you get instant feedback on how your code has performed on the judges test cases.



At the moment you may submit solutions in C/C++/C++11 and Java. Create an account at http://uva.onlinejudge.org/. Once you’ve done that you can follow your progress and your statistics in different ways. Here’s my stats http://uhunt.felix-halim.net/id/426271.
I’ve recently done a couple of problems per night just for the fun of it. It feels exciting to program on a hard problem using just 20 lines of code instead of coding 1000 lines of boiler plate which I guess many of us do at our every day works.
Without trying to indicate that I’m an expert on complex algorithms, here are some things I think are valuable when getting serious about algorithm design and solving harder programming challenges.

Hacking Team’s Tradecraft and Android Implant f

American Gothic in the palette of Mona Lisa: Rearrange the pixels - Programming Puzzles & Code Golf Stack Exchange f

You are given two true color images, the Source and the Palette. They do not necessarily have the same dimensions but it is guaranteed that their areas are the same, i.e. they have the same number of pixels.

Your task is to create an algorithm that makes the most accurate looking copy of the Source by only using the pixels in the Palette. Each pixel in the Palette must be used exactly once in a unique position in this copy. The copy must have the same dimensions as the Source.

This Python script can be used ensure these constraints are met:

from PIL import Image
def check(palette, copy):
    palette = sorted(Image.open(palette).convert('RGB').getdata())
    copy = sorted(Image.open(copy).convert('RGB').getdata())
    print 'Success' if copy == palette else 'Failed'

check('palette.png', 'copy.png')

Here are several pictures for testing. They all have the same area. Your algorithm should work for any two images with equal areas, not just American Gothic and the Mona Lisa. You should of course show your output.

American Gothic Mona Lisa Starry Night The Scream River Rainbow

Thanks to Wikipedia for the images of famous paintings.

Scoring

This is a popularity contest so the highest voted answer wins. But I’m sure there’s lots of ways to be creative with this!

Animation

millinon had the idea that it would be cool to see the pixels rearrange themselves. I thought so too so I wrote this Python script that takes two images made of the same colors and draws the intermediate images between them. Update: I just revised it so each pixel moves the minimum amount it has to. It is no longer random.

First is the Mona Lisa turning into aditsu’s American Gothic. Next is bitpwner’s American Gothic (from Mona Lisa) turning into aditsu’s. It’s amazing that the two versions share the exact same color palette.

Mona Lisa to American Gothic animation animating between two versions of American Gothic made from Mona Lisa

The results are really quite astounding. Here is aditsu’s rainbow Mona Lisa (slowed to show detail).

rainbow spheres to Mona Lisa animation

This last animation is not necessarily related to the contest. It shows what happens when my script is used to rotate an image 90 degrees.

tree rotation animation

Let's Build A Traditional City (And Make A Profit) f

Founding our own town is tempting - rural land is cheap, and we have the ability to build whatever we want. However, it has its downfalls - no one currently lives there, and unless you’ve somehow managed to convince 1,000 families to relocate with you without any guarantee of a job when they get there, you will have a hard time populating your town. Let’s also add to the fact we could be building on potentially valuable agricultural land or interferring with some other natural habitat. 

We can still build a traditional urban environment from scratch, even without founding our own city. Look around your city - I am sure you will be able to find plenty of suitable locations. For example, take a look at this satellite image of Houston; 

 

I have outlined all of the potential infill locations in red. As you can see, there is no shortage of land in most of our city’s today. 

Infill development has many advantages; 

  1. You’re not contributing to urban sprawl.
  2. You can utilize the city’s existing infrastructure like fire and police protection, there are already water, electric, and telecommunication utilities, garbage collection, mail services, and perhaps even transit - without having to worry about all of that yourself.
  3. You already have an existing population base around you. It’ll be much easier to attract residents and shoppers that already live in the city.

Creating a Software Company? 9 Decisions You Have to Make f

If programming languages were weapons f

blog comments powered by Disqus
-