exploration into Dr. Drang's floors exercise
https://leancrew.com/all-this/2020/07/more-discontinuous-ranges-in-python/
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..e76dde0
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org"
+
+git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
+
+gem "minitest"
+gem "pry"
+gem "rake"
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..d4af900
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,21 @@
+GEM
+ remote: https://rubygems.org/
+ specs:
+ coderay (1.1.3)
+ method_source (1.0.0)
+ minitest (5.14.1)
+ pry (0.13.1)
+ coderay (~> 1.1)
+ method_source (~> 1.0)
+ rake (13.0.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ minitest
+ pry
+ rake
+
+BUNDLED WITH
+ 2.1.4
diff --git a/floors.rb b/floors.rb
new file mode 100644
index 0000000..bce1041
--- /dev/null
+++ b/floors.rb
@@ -0,0 +1,31 @@
+require "minitest/autorun"
+
+def floors
+ feature_floors = (0..52) # 52 floors
+ .drop(1) # start on floor 2
+ .each_slice(8) # 8 story period
+ .flat_map {|x| x[0,5] } # keep the first 5 floors in the period
+
+ floor_nums = (1..).lazy
+ .reject {|x| x == 13 } # remove the 13th floor number
+ .take(53).to_a
+
+ feature_floors.map {|x| floor_nums.fetch(x) }
+end
+
+class TestFloors < Minitest::Test
+ def test_floors
+ assert_equal(
+ [
+ 2, 3, 4, 5, 6,
+ 10, 11, 12, 14, 15,
+ 19, 20, 21, 22, 23,
+ 27, 28, 29, 30, 31,
+ 35, 36, 37, 38, 39,
+ 43, 44, 45, 46, 47,
+ 51, 52, 53, 54
+ ],
+ floors
+ )
+ end
+end