Browsed by
Category: Technical

Optimal Battleship

Optimal Battleship

Nick Berry, president of DataGenetics, meticulously analyzes different strategies to play the classic board game Battleship (he also has done Chutes & LaddersCandyland and Risk)

It’s a great example of how computer scientists often work. He explores a host of techniques and analyzes the results by calculating how often you’ll get a perfect game, median number of guesses, and how bad it gets in the worst case.

He examines 4 major strategies:

  1. Pure random searching
  2. Hunt and Target – Hunt randomly until you get a hit, then proceed methodically to sink the hit ship.
  3. Hunt and Target with parity – since the minimum length of a ship is 2 units, you need only search even or odd squares
  4. Hunt and Target with parity combined with a probability density function.

His fourth approach is the most fascinating. The system calculates every possible configuration of the remaining ships, and then sums up the probability of a ship on each square. At the beginning, all the squares are basically equally probable, but as more and more guesses are made, the number of possible configurations decreases. If you continually calculate the sum of these possibilities, pick the square with the highest probability and repeat this process, you get significantly better results.

How much better? Purely random guessing gives you a median of 97 moves. Using parity with the hunt+target method averages 64 moves. But using the probability density function increases that to a staggering 42 moves on average.

Turns out, I discussed the use of this kind of probability density function by speedrunners who used the same technique to beat the splosh-kaboom minigame in the Legend of Zelda Wind Waker.

Rapidly Exploring Random Tree

Rapidly Exploring Random Tree

Algorithm of the day: Rapidly exploring random trees (RRT) is an algorithm designed to efficiently search non-convex spaces by randomly building a space-filling tree. The tree is constructed incrementally from samples drawn randomly from the search space and is inherently biased to grow towards large unsearched areas of the problem. They easily handle problems with obstacles and differential constraints and have been widely used in autonomous robotic motion planning.

Nope Eye

Nope Eye

Uncanny valley describes objects that imperfectly resemble actual human beings and provoke uncanny or eeriness in observers.

We need another word that describes things that actually horrify you. Perhaps the terror trough?

DCS and Augmented Reality

DCS and Augmented Reality

DCS World is one of the most amazing flight simulators out there. The hyper reality and complexity of just getting your plane off the ground is well known. Modders and modelers sell hyper-realistic models for the game like the F/A-18C Hornet shown here. In the high-fidelity cockpits, literally every button/switch/knob is clickable. It’s not just for show either – people claim they can start up the real planes by learning it first in DCS.

One user has cleverly combined some augmented reality in their setup.

If you like this, you can check out some of the amazing fun folks have in this game. Check out the Youtube channel for the Grim Reapers. They have interesting, and often hilarious, skill competitions – like their AAA/SAM evasion canyon run.