Git Product home page Git Product logo

saltedseacorn / assignment-6 Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 73 KB

I create a BattleShip game that takes input from the user utilizing the prompt and alert message. The game is played on a 4x4 board. I manipulate a nested array to stand in as a game-board. I create various functions to check to see if the user has hit target or missed and I give the user options to quit the game should the user decide they have had enough before the game has ended.

License: MIT License

HTML 8.74% JavaScript 88.26% CSS 3.01%
battleship javascript

assignment-6's Introduction

Web Basics 2: Week 3 Assignment

This assignment will cover the JavaScript objectives from weeks one and two, including:

  • Functions
  • Objects
  • Nested Arrays (two-dimensional)
  • Conditionals
  • Alerts and Prompts

Issues and Feedback

Be encouraged to ask questions or point out issues in the assignment!

Mentors will be happy to help out and your fellow students will benefit from your input.

Report an Issue


Instructions

Getting Started:

Clone this repository so that the code is available on your local machine:

Note: Run this command from the directory where you want to store your code (ex. lessons/)

git clone [email protected]:Code-the-Dream-School/web-basics-2-week-3-[your-username].git

Navigate to the directory you just cloned in your terminal:

cd web-basics-2-week-3-[your-username]

Create a new local branch to work on separate from the mainline branch (master):

git checkout -b assignment

Finally, open the project directory in your code editor and continue to the next section.

Task List:

Ready for a fun challenge? This week you will be creating a Battleship game in JavaScript.

Battleship is a war-themed game for two players in which the opponents try to guess the location of each other's warships and sink them.

If you've never played Battleship before, you can learn more in the official rule book.

Click here to view the step-by-step instructions.

Final Step:

Check the status of your local repository to double-check the changes you made:

git status

Stage the JavaScript file that you edited:

git add index.js

Create a commit for the changes you made and add a message:

git commit -m "write your message here"

Push your branch to the remote repository (visible in GitHub):

git push origin assignment

Create a Pull Request in GitHub and request feedback:

  1. Navigate to the "Pull Requests" tab in your repository
  2. Click the "New pull request" button
  3. Set the base branch to master and the compare branch to assignment
  4. Click the "Create pull request" button
  5. Ask a mentor for feedback in Slack or add them as a reviewer

Once your assignment has been reviewed, click the button to "Merge" your Pull Request and celebrate ๐ŸŽ‰


Created by Code the Dream

assignment-6's People

Contributors

saltedseacorn avatar

Watchers

 avatar

assignment-6's Issues

Code rewiew

Your code looks fine, but there few issues

  1. Step 3: Start the Game Play

You will need to loop through the following steps, switching between players 1 and 2, until one of the players wins.

You use for (var i = 0; i < 10; i++){code here} but you need check if someone wins.
for example while(player2.shipCount>0 || player1.shipCount>0){code here}

  1. You need show board and destroyed ships on it to the user in HTML
    examples you can find "img/board-default.png"

Good luck )))))

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.