Show HN: Battleboat.js – A robot that plays Battleship
kortaggio.github.io
kortaggio.github.io
After a few iterations of optimization you get the most moves before the bot finds your boat
Here is the setup: http://imgur.com/gallery/5jx3ARG
It'd be fun to automate the process and find the absolute best strategy against this deterministic guessing algorithm.
Edit: the only placement that actually matters is that of the smallest ship, ie: http://imgur.com/YQ01k95
for (var i = 0; i < this.shipLength; i++) {
if (direction === Ship.DIRECTION_VERTICAL) {
if (this.playerGrid.cells[x + i][y] === CONST.TYPE_SHIP ||
this.playerGrid.cells[x + i][y] === CONST.TYPE_MISS ||
this.playerGrid.cells[x + i][y] === CONST.TYPE_SUNK) {
return false;
}
}[Evidence: http://frupic.frubar.net/32232]