Coder Social home page Coder Social logo

christopherdent / battleships-frontend Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 745 KB

A single-page-application built with pure JavaScript. Battle, Ships! allows the user to build a powerful fleet and battle against the evil computer player. Please play using Google Chrome.

Home Page: http://www.christopher-dent.com

HTML 17.67% CSS 27.78% JavaScript 54.55%

battleships-frontend's Introduction

BATTLE, SHIPS!

BATTLE, SHIPS! is a single page application (SPA) game that allows you too create fleets using some of the most famous naval vessels from the Second World War era. It allows for different combinations of class and country, with a class based randomized point system to determine the winner.

This app uses a Rails API back-end with seed data and a PostgreSQL database, along with a Javascript front-end.

You can play the game live here: https://christopherdent.github.io/battleships-frontend/

The Front End

The front end is designed with HTML and CSS working in conjunction with Javascript, and the Rails bsaed back-end. It uses Javascript 'fetch' requests to allow a human player to assign specific ships to their fleet, and another to create a random computer fleet out of the remaining vessels.

The Back End

There are Rails models for Ship and Fleet. A fleet has many ships, and a ship belongs to a fleet. A fetch is made to the Rails API to show the seeded ship cards, another to assign them to the human fleet, another to randomly generate the computer fleet, and, finally, another which changes all fleets' ships arrays to empty, thereby resetting the game.

The back-end is powered by Ruby on Rails 6.0.3.2.

How to Launch the Game in Your Local Environment

The game is stored in two separate repositories, one for the back-end and one for the front-end.

Front-end: https://github.com/christopherdent/battleships-frontend Back-end: https://github.com/christopherdent/battleships-backend-api

Clone both repos into the same directory and navigate to the top level of the back-end. From there, run bundle install to install the required gems.

You will also need to start a PostgreSQL database by typing rails db:create, run your migrations using rails db:migrate, and very importantly, seed the game with rails db:seed.
The app will not function without the seed data.

Finally, enter rails s to start your local server and then open up index.html from the front-end directory.

battleships-frontend's People

Contributors

christopherdent 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.