Sha256: 28d3afe1517c03e58d59e76579ba57fb3043bf6d7a83cbecdbb49ef11f77f818
Contents?: true
Size: 646 Bytes
Versions: 8
Compression:
Stored size: 646 Bytes
Contents
module Hanoi module Jane class ConstrainedTowers < Towers def initialize discs super @base = 3 end def ternary rebased end def inspect i = super i[:ternary] = i.delete :binary i end private def find_stack # if we're in the middle if @source == 1 # we always move to the right on an even total if @total % 2 == 0 return 2 else return 0 end end # otherwise we're at the edges and can only move to the middle 1 end end end end
Version data entries
8 entries across 8 versions & 1 rubygems