Course:CPSC312-2016-Project2-Multiplayer Battleship

From UBC Wiki

Title

Authors: Graham Brown, Yasmeen Akbari, Tyler Young

What is the problem?

Battleship is a fun game to play both by yourself and with others. We will create the game 'Battleship' which is composed of three distinct phases:

  • Setup: Your ships are placed upon the board in locations you deem
  • Guess: One player guesses a coordinate on the board they have not guessed before
  • Check: The other player has the shot either connect or miss their ships. The first player is given feedback and their map of previous shots updates.

The game cycles between guessing and checking after setup until one player has all their ships sunk.

What is the something extra?

The in-depth aspect we will do is to provide a multiplayer portion to the game, so that we can sink each others' battleships, rather than just the computers.

We also generate each player's game board randomly and show each player which of their opponent's boat they've hit (on a grid).

What did we learn from doing this?

Haskell made various parts of our project simpler, and other more complex than necessary. We chose to represent each player's grid as a list of the coordinates of their boat location, and we found operating on these lists was easy using Haskell (ex. checking if a ship was hit and keeping track of the hit boats). One challenge was ensuring that we kept each of these grids, along with other list we had to set up, persistent throughout the game. We found the do syntax very useful, especially when we needed to do things sequentially like initializing during the set up and accepting player turns.