Giter VIP home page Giter VIP logo

battleship-2's Introduction

Logo

Welcome to Battleships! This is a turn-based tactical game where the objective is to sink your opponent's ships before they sink yours.

How to Play

1. Place your ships.

You will need to place 6 ships in total.

The first ship is a length of 5

The second ship is a length of 4

The third and fourth ships are a length of 3

The fifth and sixth ships are a length of 2

Build Fleet Screenshot

If you place your ships incorrectly, an error message will display and you can try again.

Build Fleet Error Message

2. Take a shot

The Computer will build its board with the same amount of ships. You then get the first shot.

Computer Board Screenshot

The board follows a grid from 0 to 99. To shoot, enter a number between 0 and 99 and the board will update with the outcome. For example, let's try shooting at 73

Screenshot of test shot

On the image above, the shot at 73 is a miss.

The characters for the actions are:

MISS = x

HIT = o

SINK = O

If you sink a ship, the last character will be 'O' to notify that you have sunk a ship.


User Experience

Target Audience

The target audience for the game are strategy gamers who want to play a game of strategy with the added difficulty of the computer using logic to sink ships.

User Stories

  1. As a novice to strategy games I want a clear description as to how to play the game. End user goal: Understand rules of game. End business goal: Keep users playing game. Acceptance criteria: Place clear print messages telling player to input value, Add clear info of rules in README.

  2. As an experienced strategy gamer, I want to play a game where the opponent uses logic. End user goal: Play game of strategy against logic user. End business goal: Keep users playing game. Acceptance criteria: Add tactics function that tells computer to look at adjacent places to a ship once hit.

  3. As a gamer, I want to place where I want my ships myself. End user goal: Place ships. End business goal: Keep users playing game. Acceptance criteria: Add create ships function letting user place own ships on board.

Wireframes

Wireframe Homepage

Wireframe Player Board

Wireframe Computer Board

I initially wanted to create a difficulty selection option of Easy and Hard. This would benefit user #1 (The Novice) who is a beginner to strategy games. In order to achieve an easy difficulty, I planned to remove the logic function so that the computer would guess at random, even if it hits a ship, it would continue at random.

I decided to remove the difficulty selection as the random feature defeats the purpose of a strategy game in my opinion.

Features

Build Your Ship Fleet

Build Fleet

Clear Characters of Actions

Board with hit and miss

Clear Character of Sunk Ship

Board with sunk ship

Endgame Message

Player win message

Computer win message

Testing

Whilst working on the code, I kept in mind to check for errors using Gitpod's Lint checker. Only two errors displaying that two lines of code are too long but I could not fix these errors without breaking the code.

The warnings come from the beggining logo print message, alerting of whitespace and invalid characters that have no effect on the code but are soley for aesthetic purposes.

Gitpod lint validator

Updated - 17th August: Line too long error fixed. No further errors found

Pep8

Pep8 found the same errors as Lint.

Pep8 code checked

ExtendsClass

ExtendsClass found no errors or warnings with the syntax of the code.

ExtendsClass code checked

Future Development

Clearer Boards

Overall, I'm pleased that the game works well. I would like to adjust both the boards so that they are clearer as it can be quite confusing which board is the player's and which is the computers.

Clear Rules

I feel that the rules and description of How to Play is quite short. However, adding to the rules could make the app too text heavy which could dismay users before they start the app.

Technology used

The two websites below were very useful for learning materials. Stack overflow is a forum website where users post problems with their code and receive input from the community.

thispointer.com

stackoverflow

I copied the ascii art 'Battleships' from the website below. There was not an author attached to the art so I cannot give a full acknowledgement. The art copied became the logo for the game.

Network Science

I created a separate git repository for the purpose of testing the random placing of the computer ships and testing the tactics that the computer uses before implementing the code into the main Battleship app. I did this to avoid having to enter inputs when testing my code. I realise that I could have commented out the inputs and functions but felt this way was easier.

Test-ship-random

Youtube

Dr Codie

Dr Codie's video tutorial helped with generating the tactics that the computer uses.

Dylan Israel

Dev Ed

The two videos above were very helpful with refreshing what I've learnt about Python and providing more information with Python functions.

Deployment

GitHub

The app has been deployed to GitHub and a link to the page can be found here: Battleship - GitHub

Heroku

The app has been deployed to Heroku and a link to the page can be found here: Battleship - Heroku

A link to the app can be found here: Battleship

Final Preview of app

battleship-2's People

Contributors

mattm1346 avatar

Watchers

 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.