Method chaining is the feature available in many programming languages to stack method calls in one line, with each method accessing the object the previous method returned. Compare: The first block’s MyObject class uses traditional setters whereas the second block…
N-Queens Part 3: Success
In the last two posts we explored three different algorithms for solving the n-queens problem. If we wanted to actually implement one of them, we would need to consider which one performs the best. However, performance can be measured in…
N-Queens Part 2: More Algorithms
Last time we were considering the following n-queens board with a current heuristic cost of 5:By making just one move, the best decision would be to move the second queen to the space marked 2. However, to find that move,…
N-Queens Part 1: Steepest Hill Climbing
The n-queens problem was first invented in the mid 1800s as a puzzle for people to solve in their spare time, but now serves as a good tool for discussing computer search algorithms. In chess, a queen is the only…
Finding the colors used in graffiti through clustering
Earlier this week, a Graffiti “museum” of sorts in New York was destroyed. Graffiti artists from around the world came to contribute to the ever-changing murals at 5Pointz. To combine millions of colors into just 32 obviously removes a lot…