save-the-gnomes.rb
#Compare gnome guesses to the actual hat placements - takes in two hashes as parameters
Compare gnome guesses to the actual hat placements - takes in two hashes as parameters
Compare gnome guesses to the actual hat placements - takes in two hashes as parameters
def judge_the_gnomes(guesses, placements)
	live_gnomes = []
	dead_gnomes = []
	guesses.each do |gnome, hat|
		if hat == placements[gnome]
			live_gnomes << gnome
		else
			dead_gnomes << gnome
		end
	end
	print "Live gnomes: " 
	p live_gnomes
	print "Dead gnomes: "
	p dead_gnomes
end
def judge_the_gnomes ( guesses , placements ) live_gnomes = [ ] dead_gnomes = [ ] guesses . each do | gnome , hat | if hat == placements [ gnome ] live_gnomes << gnome else dead_gnomes << gnome end end print "Live gnomes: " p live_gnomes print "Dead gnomes: " p dead_gnomes end
Compare gnome guesses to the actual hat placements - takes in two hashes as parameters
Compare gnome guesses to the actual hat placements - takes in two hashes as parameters
guesses
placements