Giter VIP home page Giter VIP logo

battleships's Introduction

Week 4 @ Makers Academy: Interactive Battleships Game

Team Incas : Catherina, Hannah, Jeremy, Peter

Ruby Version:

Ruby 2.1.2

Objectives:

Create an interactive battleships game that can be played through the terminal

Rules:

Battleships is a two player game. Each player deploys 5 ships on a 10 x 10 grid. Each cell has a unique grid reference. Each player takes turns to call out a grid reference and the other players confirms whether it is a ‘hit’ or ‘miss’ if a ship is at that grid reference or not. The attacking players marks the ‘hit’ or ‘miss’ on their tracking grid. The defending player marks ‘hit’ or ‘miss’ on their primary grid. Players alternate turns. When every cell that comprises one ship has been ‘hit’, the defending player declares it sunk. When a player sinks all their opponent’s ships they win and the game ends.

Classes:

  • Grid: holds a collection of ships and cells
  • Cell: unit on the grid which holds either water or a ship
  • Attacked Cell: cell that has been attacked
  • Ship: has a shield level and can be sunk
  • Water: content of a cell with no ship
  • Hit: generated by an attack on a cell with a ship
  • Miss: generated by an attack on a cell holding water
  • Player: can place ships on the grid and attack opponent cells
  • Game: control the flow of the game

Running the application:

$ ruby lib/play.rb from root

Running the test suite:

$ rspec from root

battleships's People

Contributors

f0x02 avatar hanwax avatar petemmccarthy avatar

Watchers

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