Coder Social home page Coder Social logo

door's Introduction

Door Exercise

A computer game usually has many different objects that can be seen and manipulated. One typical object is a door. Whether a player runs through a castle, attacks the forces of an evil empire, or places furniture in a room, a door often comes into play.

A Door object can

#- display an inscription #- method to inscribe the door #- method to see the inscription on the door #- be either open or closed, and

#- attribute is open or closed (default? (true/false)) #- .open? method checks whether it is open

  • door cannot be opened if it is open
  • cannot be closed if it is closed
  • cannot be opened if it is locked & closed #- be either locked or unlocked (default - true/false)
  • door cannot be locked if it is not closed
  • door cannot be locked if it is locked #- .locked? checks whether it is locked

Here are some rules about how Doors work:

#- Once the writing (inscription) on a Door is set, it cannot be changed

  • You may open a Door if and only if it is unlocked and closed
  • You may close a Door if and only if it is open
  • You may lock a Door if and only if it is unlocked
  • You may unlock a Door if and only if it is locked #- You should be able to check whether or not a Door is closed, check whether or not it is locked, and look at the writing on the Door if there is any.

#Appropriate error messages should be displayed and no changes to the Door should be made, if any conditions of the functions are violated.

You should write specs for this class, to achieve at least 90% test coverage (using simplecov).

door's People

Contributors

laurenfb avatar

Watchers

James Cloos 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.