The source code of all apps is included in the JDroidLib distribution.
Battleship with Bluetooth Communication
Before the play begins, each player secretly arranges their ships on their primary grid. Each ship occupies a number of consecutive squares on the grid, arranged either horizontally or vertically. The number of squares for each ship is determined by the type of the ship. The ships cannot overlap (i.e., only one ship can occupy any given square in the grid). The types and numbers of ships allowed are the same for each player. These may vary depending on the rules.
After the ships have been positioned, the game proceeds in a series of rounds. In each round, each player's turn consists of announcing a target square in the opponent's grid which is to be shot at. If a ship occupies the square, then it takes a hit. The player's opponent announces whether or not the shot has hit one of the opponent's ships; the opponent then fires a shot at the first player's ships. When all of the squares of a ship have been hit, the ship is sunk. After all of one player's ships have been sunk, the game ends and the other player wins.
Download Android app for installation on a smartphone or emulator.
Create QR code to download Android app to your smartphone.
Download sources (BtBattleship.zip).