Coder Social home page Coder Social logo

battleship's Introduction

Battleship

Challenge outline

Summary

The goal of this repository is to create a battleship game, playable from the terminal and developed in C++. The game will be defined by a config file, which will contain information of the board size and the ships that will be placed on the board. In the 'Player vs. computer' implementation, the player can select how to place the ships on the board, or place them automatically if they choose. When all ships are placed, they can play against the computer, and fire torpedoes into the enemy board. Whoever sinks all of the other player's ships wins.

A running version can be found in Repl.it

Initial working plan

First I drafted a plan in pseudocode regarding the general structure and implementation. Please check the plan before continuing reading this document.

If I had known the language better, it could have been a more accurate plan, but I ended up applying several changes to the initial draft as I became acquainted with the in and outs of C++ and its limitations. This first draft is broken down into small tasks, as it defines classes and methods.

Overall approach and development strategy

For organising the development of the project, I created a list of epics divided in user stories. I developed the first epic on a separate branch, game-v1, that was then merged through a pull request into main. I made commits often, at least 1 per day. You can see the epic/user story breakdown below, as well as the UML diagram with the classes in the project.

Epics:

  • First version of the game working
    User stories:
    • User can see the menu and select “One player vs Computer” or “Quit”
    • User can start the game and place their ships (defined in the .ini file).
    • User can skip placing their ships and ships will be automatically placed.
    • User can see their board and the computer’s board
    • User can “shoot” to the other board and hits get displayed on the enemy board
    • User can get hit by enemy torpedoes ant that gets displayed on the user’s board
    • User can see score in every turn
    • When one of the players loses all their ships, the game ends and displays a victory (or not) message
    • User can see error messages and have choices for any unrecognised inputs.
  • Two player game
    User stories:
    • User can play the game with another player and each turn will clearly display whose turn is it.
    • Second player will be able to place ships and see updates to their board same as first player.
  • One player v computer (salvo) game
    User stories:
    • User can play salvo game, where they can shoot a torpedo for each non-destroyed ship on their board.
    • User can clearly see the updates for all shots on the boards
  • Two player game (salvo) game
    User stories:
    • Second player will be able to do as first player in a salvo vs computer game.

UML diagram

battleship's People

Contributors

tyrannogina avatar

Watchers

James Cloos avatar  avatar

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.