class Checkers::AI::Tree
Attributes
root[R]
Public Class Methods
build(board, depth)
click to toggle source
# File lib/checkers/ai/tree.rb, line 8 def self.build(board, depth) Tree.new(Node.new(board, :ai, depth)) end
new(node)
click to toggle source
# File lib/checkers/ai/tree.rb, line 12 def initialize(node) @root = node end
Public Instance Methods
depth()
click to toggle source
# File lib/checkers/ai/tree.rb, line 16 def depth current_depth = 0 children = @root.children while children.any? current_depth += 1 children = children.first.children end current_depth end