Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not done yet #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions mbta.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@

# your solution here
def stops_between_stations

end
lines = {
red_line:["South Station", "Park Street", "Kendall", "Central", "Harvard", "Porter", "Davis", "Alewife"],
green_line:["Government Center","Park Street","Boylston","Arlington","Copley","Hynes","Kenmore"],
orange_line: ["North Station", "Haymarket", "Park Street", "State", "Downtown Crossing", "Chinatown", "Back Bay", "Forest Hills"],

}
$intersect = "Park Street"

def stops_between_stations (start_stop, start_station, end_stop, end_station)
if start_stop == end_stop
return (start_stop.index(start_station) - end_stop.index(end_station))
else
return (start_stop.index(start_station) - start_stop.index($intersect)) + (end_stop.index(end_station) - end_stop.index($intersect))

end
end

puts "starting line"
start_stop = gets.chomp.downcase
puts "starting station?"
start_station = gets.chomp.downcase
puts "ending line?"
end_stop = gets.chomp.downcase
puts "ending station?"
end_station = gets.chomp.downcase