This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------------------------------------------------ | |
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here. | |
//------------------------------------------------------------------------------------------------------------------ | |
//-----------------------------------OBJECT CONSTRTUCTOR-------------------------------------------// | |
function Animal(name, num_legs) { | |
this.name = name; | |
this.num_legs = num_legs; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// shorthand for $(document).ready(); | |
grr = null; | |
$(function(){ | |
//Your code... | |
$("#sign_up_form").on("submit", function (event) { | |
$("ul").hide(); | |
$("ul li").hide(); | |
var password = $(event.target.password).val(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helpers do | |
def parse_shot(shot) | |
if shot.at_already_shot_coordinate? | |
{success: false, reason: "already shot there"} | |
else | |
{success: true, result: { | |
coordinate: shot.coordinate, | |
hit: shot.result.hit?, | |
sunk: shot.result.sunk_ship?, | |
name: ship.result.sunk_ship_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/' do | |
erb :index | |
end | |
get '/offense_board' do | |
build_offense_board | |
end | |
get '/defense_board' do | |
build_defense_board |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get '/' do | |
erb :index | |
end | |
get '/offense_board' do | |
build_offense_board | |
end | |
get '/defense_board' do | |
build_defense_board |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert(actual, expected) | |
raise "Expected #{actual.inspect} to equal #{expected.inspect}" unless actual == expected | |
end | |
LIVE = 'X' | |
DEAD = 'O' | |
def evolve(board) | |
board.map.with_index do |row, x| | |
row.map.with_index do |p, y| | |
if p == LIVE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert(actual, expected) | |
if actual == expected | |
puts "#{actual.inspect} equals #{expected.inspect}" | |
else | |
raise "Expected #{actual.inspect} to equal #{expected.inspect}" | |
end | |
end | |
LIVE = 'X' | |
DEAD = 'O' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert(actual, expected) | |
if actual == expected | |
puts "#{actual.inspect} equals #{expected.inspect}" | |
else | |
raise "Expected #{actual.inspect} to equal #{expected.inspect}" | |
end | |
end | |
LIVE = 'X' | |
DEAD = 'O' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert(actual, expected) | |
if actual == expected | |
puts "#{actual.inspect} equals #{expected.inspect}" | |
else | |
raise "Expected #{actual.inspect} to equal #{expected.inspect}" | |
end | |
end | |