Class: Tictactoe::Ai::ABMinimax
- Inherits:
-
Object
- Object
- Tictactoe::Ai::ABMinimax
- Defined in:
- lib/tictactoe/ai/ab_minimax.rb
Instance Method Summary collapse
- #best_nodes(tree) ⇒ Object
-
#initialize(min_score, heuristic_score, depth_limit) ⇒ ABMinimax
constructor
A new instance of ABMinimax.
Constructor Details
#initialize(min_score, heuristic_score, depth_limit) ⇒ ABMinimax
Returns a new instance of ABMinimax.
4 5 6 7 8 |
# File 'lib/tictactoe/ai/ab_minimax.rb', line 4 def initialize(min_score, heuristic_score, depth_limit) @min_score_possible = min_score @heuristic_score = heuristic_score @depth_limit = depth_limit end |
Instance Method Details
#best_nodes(tree) ⇒ Object
10 11 12 |
# File 'lib/tictactoe/ai/ab_minimax.rb', line 10 def best_nodes(tree) most_beneficial_strategy(tree, nil, depth_limit)[:nodes] end |