Skip to content

Instantly share code, notes, and snippets.

@kshramt
Created July 29, 2013 09:54
Show Gist options
  • Save kshramt/6103303 to your computer and use it in GitHub Desktop.
Save kshramt/6103303 to your computer and use it in GitHub Desktop.
m_main = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1]
m_sub = [0.1, 0.2, 0.3, 0.4, 0.3, 0.2, 0.1]
meca = {
2 => 2,
3 => 2,
4 => 2,
6 => 1,
7 => 1,
8 => 1,
10 => 5,
11 => 5,
12 => 5,
}
[*(1..15)].product([*(1..5)], [*(1..3)]).each{|ix, iy, iz|
if (ix == 3 and iy == 3 and iz == 1) or (ix == 7 and iy == 3 and iz == 2) or (ix == 11 and iy == 3 and iz == 3)
m_main.each.with_index{|m, it|
puts [ix, iy, iz, it + 1, meca[ix], m].join("\t")
}
elsif ((2..4).cover?(ix) and (2..4).cover?(iy) and iz == 1) or ((6..8).cover?(ix) and (2..4).cover?(iy) and iz == 2) or ((10..12).cover?(ix) and (2..4).cover?(iy) and iz == 3)
m_sub.each.with_index{|m, it|
puts [ix, iy, iz, it + 1, meca[ix], m].join("\t")
}
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment