Giter VIP home page Giter VIP logo

gladiator's Introduction

RSpec Gladiator Arena

The Emperor has commissioned you to build a Gladiator Arena. Your life depends on developing a well-thought-out arena, so you have been given tests to make sure you build it well.

Note: UXDI is having project presentations today from 10:30-12:30 and again from 1:30-3:30 in classroom 2. They will be 20 minutes each. Please check them out if you like, and be respectful to your fellow classmates!

How to do this assignment

  1. In the gladiator folder, run bundle install to make sure you have the right gems installed
  2. Run rspec to run your tests. They should all fail.
  3. Start with the Gladiator tests / class (see steps below)
  4. Then do the Arena tests / class (see steps below)

For each individual test:

  1. Read the error message.
  2. Make the smallest change in your code to fix the error.
  3. Run the test.
  4. Repeat 1 - 3 until the test passes
  5. Move to the next test.

Note about the solution

The correct solution to this exercise is on the branch called solution.

Specs

Gladiator Spec

  • A gladiator has a name
  • A gladiator has a weapon (one of Spear, Club, Trident)

Arena Spec

  • An arena has a name
    • The name should be capitalized
  • An arena can have gladiators
  • You can add a gladiator to the arena
    • The arena should never have more than 2 gladiators in it at a time
  • If there are two gladiators in the arena, you can call a fight method that results in the elimination of one of the gladiators from the arena.
    • Winning conditions:
      • Trident beats Spear
      • Spear beats Club
      • Club beats Trident
      • If the two gladiators have the same weapon, they are both eliminated.

Bonus

Note: No tests are provided for this bonus. You can either just add the functionality w/o tests, or try to write the tests yourself.

  • Add a method to remove gladiators from the arena by name
  • Update your winning conditions so that if the gladiator named "Maximus" is in the fight, he wins.
  • Add a method to check to see if the crowd is entertained (.entertained?). The crowd is only entertained if Maximus is in the arena.
  • Before a losing gladiator is eliminated, the user should be prompted to put their thumbs up or down. If user votes down, the losing gladiator is removed. If the user votes up, the gladiator stays in the arena and his opponent is removed. (Life isn't fair.)

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.