Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 922 Bytes

pirates_are_the_cannons_ready.md

File metadata and controls

32 lines (20 loc) · 922 Bytes

Description

Ahoy Matey!

Welcome to the seven seas.

You are the captain of a pirate ship.

You are in battle against the royal navy.

You have cannons at the ready.... or are they?

Your task is to check if the gunners are loaded and ready, if they are: Fire!

If they aren't ready: Shiver me timbers!

Your gunners for each test case are 2, 3 or 4.

When you check if they are ready their answers are in a dictionary and will either be: aye or nay

Firing with less than all gunners ready is non-optimum (this is not fire at will, this is fire by the captain's orders or walk the plank, dirty sea-dog!)

If all answers are 'aye' then Fire! if one or more are 'nay' then Shiver me timbers!

My Solution

def cannons_ready(gunners)
  gunners.values.include?('nay') ? 'Shiver me timbers!' : 'Fire!'
end