Giter Site home page Giter Site logo

battleboat's People

Contributors

billmei avatar grochowskimichal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

battleboat's Issues

Random placement doesn't account for existing placement

After running setDebug(true) in the console the "Place Randomly and Start" button is revealed.
Place some boats (not all), then select "Place Randomly and Start".

The manually placed boats are visible, but the full set of 5 boats have been added to the board.
screen shot 2014-09-20 at 5 05 52 pm

If the bot guesses a cell containing one of the manually placed cells an exception is thrown:
targetGrid.isUndamagedShip(x, y) returns true for the manually placed cell, but
targetFleet.findShipByCoords(x, y) returns null, so
targetFleet.findShipByCoords(x, y).incrementDamage() throws
"Uncaught TypeError: Cannot read property 'incrementDamage' of null".

The quick fix is to change the way the boats are added to the board to prevent this problem.

This bug highlights the discrepancy between the way boats are displayed and stored. I would suggest getting rid of targetGrid.isUndamagedShip(x, y) in favor of targetFleet.findShipByCoords(x, y)'s response (the boat's internal representation) providing enough info about the state of the ship to determine if the cell is undamaged (it might even already).

Improvements on the AI's strategy

Is there a strategy that is employed such that the AI always wins? I feel like a strategy isnt being employed by the ai aside from "find the next closest piece". I'd like to really make an AI that ASSUREDLY beats humans at this game

Pondering: immediate probability cloud != ideal solution

Excerpt from an email from me to @uniphil...

...

So going with the most likely square on a per-move basis might not always be ideal. For example, let's say you're looking for a length 2 ship, and the open squares on the board look like this:

o o o o o
o       o

The algorithm is going to favour:

O O O O O
o       o

For argument's sake, let's say the centre square is chosen first. 1/3 hit rate.

If the square is hit, you can choose left / right on the next move, so 50% there. So.. 1/3 chance of getting 2.5 moves to victory.

If the square isn't a hit (2/3), you'll then choose left / right corner. If it's a hit, it leaves you with a victory after 3 or 4 moves (3.5). If it's a miss, 4.5.

1/3 * 2.5 + 1/3 * 3.5 + 1/3 * 4.5 = 3.5 move average. Starting on the corners is similar and also yields a 3.5 average.

But!! These guys:

o O o O o
o       o

yield a (2.5 + 3 + 4.5) / 3 = 3.33 move average.

I'm sure there are better examples, but this shows that relying on an immediate probability cloud misses something on planning ahead. Integrating post-move-board-complexity would improve the solution...

Pondering how to not brute-force this. Merp.

Thoughts? @uniphil @Kortaggio @hdevalence

Translator

The issue is the google translate exntesion.
(translating websites for ur own language - in my case from english to polish one )
It makes it impossible to use the application - it is not possible to place ships while the page is translated.
Idk acutally if its only with polish language but i guess its the same with every other one.

Issues with the random placement

I found some issues when I use the random placement on the board
If I select a ship and then press Random placement I get a "extra ship" to place on the board.
Also, the IA start to fail when I play with this issue.

image

Logic

Hello, apparantly your system is simply picking randomly a set of grid squares on alternate grids. Would it not be simpler just to go in some sort of structured direction? Also, if you're collecting win statistics using google, why not collect ship placement locations through it? That way you could see where people place most ships, for instance, very few people place ships on the very outside of the grid.

In case you expect players to play more than once, picking random locations makes sense, as they cannot pick a location well. Oh, one more thing, when the computer finds the '2' ship, you should change the square structure, plus the same with when the "2 and 3" ships are found. I don't think it does this, although I might be mistaken.

If I'm made a monumental failure, please do not hesitate to say.

How to change Grid size?

I already changed Grid size to 5x5 successfully, but the AI doesn't seems to place ships correctly in the new player's grid and either on computer's grid because I missed all shoots.
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.