Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

I am trying to make battleship with Java and i am running into a few questions?

First i am having trouble with the AI, i know how i want it to work with a guess random method and certain parameters to follow if the guess is right, if wrong continue the same process. The real issue i am having with my AI is how it is supposed to place its pieces on the board at random with no over laps.

Second issue i am having is how to move each object, i was going to use a key listener but... wait i just figured it out nm on that one lol, but i am still having trouble making it so it is recognized like when they type in the coordinates they want to fire at how do i make it say direct hit...

Third this is mostly a cosmetic issue but still i want it to look nice, how do i import music and sound affects like i was thinking i would do it like

if (hit = true)

{

import music

}

but that import music thing was just logic i do not know what method to use in order to make that happen.

1 Answer

Relevance
  • 9 years ago
    Favorite Answer

    if (hit = true)

    ^--- No offense, but the fact that you don't even understand the difference between the assignment operator = and the equality test == suggests you may not be ready to write a Battleship implementation.

Still have questions? Get your answers by asking now.