Sunday, March 25, 2012

Battleship - Game Play

I found out today that someone else did something similar to what I did: http://thevirtuosi.blogspot.com/2011/10/linear-theory-of-battleship.html, but we are a little bit different.

I calculate what happens with a miss by passing a board where that is an imaginary ship - place all of the ships, and then subtract off the imaginary ship board before returning.  I also changed the order in which I place the ships; placing the larger ships first makes it not take as many searches to find a space where a large ship would fit.

Effects of misses (right) on the (left) PDF.  A miss means that a ship cannot be there so the PDF at that location must be zero.
Anyway, I have the rest of the code written but haven't made any visuals of it.  It is essentially just computing the PDF, and then choosing from that PDF for where to place the ships.  It gets a little bit hung up on deciding what ships are remaining; currently I keep on assuming that I don't eliminate any ship until they all are sunk.

In the event of a nuclear disaster don't "Eat Fresh, Eat Local".   And try not to breathe the air.  You get about 500 times more dose* if you eat contaminated food.  Especially don't drink the milk 2 days after the event.


*depending on what sort of isotope, etc.

No comments:

Post a Comment