-
-
Save masui/7716812 to your computer and use it in GitHub Desktop.
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 int(x) | |
x.to_i | |
end | |
def frac(x) | |
x.to_f - int(x) | |
end | |
def ts(x) | |
"#{x.to_i}時#{frac(x)*60.0}分" | |
end | |
(0..12).each { |i| | |
(0..12).each { |j| | |
x = (144.0 * i + 12.0 * j) / 143.0 | |
y = frac(x) * 12.0 | |
if i <= x && x < i+1 && j <= y && y < j+1 then | |
puts "#{ts(x)} と #{ts(y)} の針位置は一致" | |
end | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment