Sha256: 4cfbf7913e3a5aecddf04c775e95ee702e56d8609091689b2c97ca5ce84ff204
Contents?: true
Size: 641 Bytes
Versions: 3
Compression:
Stored size: 641 Bytes
Contents
class LetterPressIsNotAsGoodAsBoggle class BoardTraverser attr_accessor :characters def initialize(characters) self.characters = characters end def each_with_recur(&block) recursive_each_with_recur "", [], block end def recursive_each_with_recur(current, path, block) characters.each do |char| next if path.any? { |path_char| path_char.equal? char } new_current = current + char path.push char recurser = lambda { recursive_each_with_recur new_current, path, block } block.call new_current, char, recurser path.pop end end end end
Version data entries
3 entries across 3 versions & 1 rubygems