Inspiration
We just decided to implement a classic game we played as kids for Alexa, so everybody could play even without real partners. Battleship is a guessing game for two players. Play, pause and return back whenever you want! Improve your strategic thinking with Battleship Classic!
What it does
The game is played on two grids, one for yourself and one for Alexa. The grids are square – 10×10 – and the individual squares in the grid are identified by letter (A-J) and number (1-10) (e.g. A4 or C8). On one grid the player arranges ships and records the shots by the Alexa. On the other grid the player records their own shots.
Before play begins, 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 (from 1 to 5). The ships cannot overlap (i.e., only one ship can occupy any given square in the grid) and the ships cannot touch each other (there is at least one empty square in between the ships). The types and numbers of ships allowed: battleship or four-decker - (4 cells) 1 ship, cruiser or three-decker (3 cells) 2 ships, destroyer or two-decker (2 cells) 3 ships, submarine single-decker (1 cell) 4 ships.
After the ships have been positioned, start a new game, saying 'Start a new game'. The game proceeds in a series of rounds. In each round, each player takes a turn to announce a target square in the opponent's grid which is to be shot at (e.g. A4). The opponent announces whether or not the square is occupied by a ship, and if it is a "miss", the opponent player marks their primary grid with a white peg; if a "hit" they mark this on their own primary grid with a red peg. The attacking player notes the hit or miss on their own "tracking" grid with the appropriate color peg (red for "hit", white for "miss"), in order to build up a picture of the opponent's fleet. If you need to see current game status (yours and Alexa's grids), say 'Show me game status'. Check the grids using Alexa app.
When all of the squares of a ship have been hit, the ship is sunk, and the ship's owner announces this (e.g. "You sank my battleship!"). If all of a player's ships have been sunk, the game is over and their opponent wins.
You can disconnect at any time, next time you open the skill, you can continue on the previously started game or you can start a new one.
How we built it
We tried to use simple reliable technologies to keep everything very simple but fun. C# as a programming language, S3 for persistence.
Challenges we ran into
- The game must be resumed at any time even if a player intentionally or accidentally closed the session. Next time the skill is launched, the player has a choice to start a new game or continue from where he or she left.
- A way to represent current game status (player's grid and Alexa's grid) using Alexa app cards.
Accomplishments that we're proud of
We overcame the challenges.
What we learned
A simple skill can be more fun if done with with some sounds, not only with Alexa's voice. And, of course. Battleship is still very cool game to play if implemented in a convenient for a player way.
What's next for Battleship Classic
Improve cards readability somehow (image generation or selecting monospace symbols to represent cell states). Introduce a way to play against other people, not only against Alexa.
Log in or sign up for Devpost to join the conversation.