class Tictactoe::Sequence

Attributes

first[R]

Public Class Methods

new(values) click to toggle source
# File lib/tictactoe/sequence.rb, line 14
def initialize(values)
  nodes = values.map{|value| Node.new(value)}
  nodes.each_with_index do |node, index|
    next_index = (index +1) % nodes.length
    node.next = nodes[next_index]
  end

  @first = nodes.first
end