Class: Rubykon::EyeDetector
- Inherits:
-
Object
- Object
- Rubykon::EyeDetector
- Defined in:
- lib/rubykon/eye_detector.rb
Instance Method Summary collapse
Instance Method Details
#candidate_eye_color(identifier, board) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rubykon/eye_detector.rb', line 9 def candidate_eye_color(identifier, board) neighbor_colors = board.neighbour_colors_of(identifier) candidate_eye_color = neighbor_colors.first return false if candidate_eye_color == Board::EMPTY if neighbor_colors.all? {|color| color == candidate_eye_color} candidate_eye_color else nil end end |
#is_eye?(identifier, board) ⇒ Boolean
3 4 5 6 7 |
# File 'lib/rubykon/eye_detector.rb', line 3 def is_eye?(identifier, board) candidate_eye_color = candidate_eye_color(identifier, board) return false unless candidate_eye_color is_real_eye?(identifier, board, candidate_eye_color) end |