# File lib/libttc.rb, line 82
  def initialize(spokes, spoke_length, arc_length)
    # A hash of all positions, indexed by position names
    @positions = Hash.new   
    @centre = Position.new('ac' + spoke_length.to_s, false, false)
    @positions['ac' + spoke_length.to_s] = centre
    a1_corner = nil
    end_of_previous_arc = nil

    # Do each arc-spoke-base set
    (?a...(?a + spokes)).each do |arc_code|
      arc = arc_code.chr
      base = Position.new(arc, false, true)
      this_arc = Array.new
      
      # build the arc
      (1..arc_length).each do |arc_position|
        position_name = arc + arc_position.to_s
        arc_place = Position.new(position_name, arc_position == 4, false)
        arc_place.neighbours = []
        @positions[position_name] = arc_place
        this_arc << arc_place
        a1_corner = a1_corner || arc_place
      end
      (0...arc_length).each do |arc_position|
        if arc_position > 0
          this_arc[arc_position].neighbours << this_arc[arc_position - 1]
        end
        if arc_position < (arc_length - 1)
          this_arc[arc_position].neighbours << this_arc[arc_position + 1]
        end
      end
        
      # build the spoke
      this_spoke = Array.new
      (1..(spoke_length - 1)).each do |spoke_position|
        position_name = arc + "c" + spoke_position.to_s
        spoke_place = Position.new(position_name, spoke_position == 3, false)
        spoke_place.neighbours = []
        @positions[position_name] = spoke_place
        this_spoke << spoke_place
      end
      (0...(spoke_length - 1)).each do |spoke_position|
        if spoke_position > 0
          this_spoke[spoke_position].neighbours << this_spoke[spoke_position - 1]
        end
        if spoke_position < spoke_length - 2
          this_spoke[spoke_position].neighbours << this_spoke[spoke_position + 1]
        end
      end
      
      # tie the spoke and arc together, 
      this_arc[0].neighbours << this_spoke[0]
      this_spoke[0].neighbours << this_arc[0]

      # tie the spoke to the centre, and
      this_spoke[-1].neighbours << @centre
      @centre.neighbours << this_spoke[-1]
      
      # tie the base to the arc
      base = Position.new(arc, false, true)
      @positions[arc] = base
      base.neighbours << this_arc[0]
      this_arc[0].neighbours << base

      # record the ends of the arc for tying to adjacent arcs
      if end_of_previous_arc
        end_of_previous_arc.neighbours << this_arc[0]
        this_arc[0].neighbours << end_of_previous_arc
      end
      end_of_previous_arc = this_arc[-1]

    end # arc

    # tie both ends of the rim together 
    a1_corner.neighbours << end_of_previous_arc
    end_of_previous_arc.neighbours << a1_corner

    cache_valid_moves

  end