#How to play Battleship ##Setup Instructions
- Take game out of box
- Open your game unit
- each player receives five ships
- destroyer has 2 hit points
- submarine has 3 hit points
- cruiser has 3 hit points
- battleships has 4 hit points
#How to play Battleship ##Setup Instructions
| require 'minitest/autorun' | |
| require 'minitest/pride' | |
| # Write a method which returns: | |
| # | |
| # * "Fizz" if the number is divisible by 3 | |
| # * "Buzz" if the number is divisible by 5 | |
| # * "FizzBuzz" if the number is divisible by 3 and 5 | |
| # * Otherwise, return the number itself | |
| # |
| require 'minitest/autorun' | |
| require 'minitest/pride' | |
| # Write two methods: | |
| # | |
| # * `first_name`: given a name in string, return the first name. | |
| # * `last_name`: given a name in string, return the last name. | |
| # WRITE YOUR CODE HERE. | |
| def names |
| # Technical interview: | |
| -take your laptop | |
| ##Questions the interviewer might ask you: | |
| 1. Describe the project you are most proud of | |
| * get technical, describe the tech you used | |
| * if you go more than five minutes, you're not doing it right | |
| * if you have your laptop, offer to show interviewer your app/site/etc (may or may not take you up on it) | |
| * distinguish between exciting tech (stripe) and not (rails gems) | |
| 2. Testing |
| def palindrome?(str) | |
| str = str.downcase | |
| str == str.reverse | |
| end | |
| #there's a gets.chomp in here somewhere, I'm sure of it |
| require 'minitest/autorun' | |
| require 'minitest/pride' | |
| # Write a method which accepts an array and returns a hash. Each item in the | |
| # array will be a string, and the returned hash should have last names as keys | |
| # and first names as values. | |
| # WRITE YOUR CODE HERE. Name your method `names`. | |
| def names(name) | |
| array = [first_name, last_name] |
| Second, write SQL statements (in your gist) and model methods (in your model files) to accomplish the following: | |
| 1. Find all authors with an email address of "[email protected]" | |
| SELECT name | |
| FROM authors | |
| WHERE email = "[email protected]" | |
| 2. Find the author who was created most recently | |
| SELECT name, created_at |
| def complements?(number) | |
| array = [] | |
| array.each do |n| | |
| assert n + n = | |
| else | |
| false | |
| end | |
| I *never* finish these things. Are they hard or am I just dumb? |
| require 'minitest/autorun' | |
| require 'minitest/pride' | |
| # Write a method which accepts an array as the first paramater and a number | |
| # as the second parameter. Return true if two of the numbers in the array sum | |
| # to the second parameter. | |
| # WRITE YOUR CODE HERE. Name your method `complements?`. | |
| def complements?(number, sum) | |
| return false if array == nil || array.length < 2 |
| require 'minitest/autorun' | |
| require 'minitest/pride' | |
| # Write a method which accepts an array and returns a hash. Each item in the | |
| # array will be a string, and the returned hash should have last names as keys | |
| # and first names as values. | |
| # WRITE YOUR CODE HERE. Name your method `names`. | |
| def names( array ) | |
| hash = {} |