From a1f48682c0e2ff419486cb5f5b97d6b035efb9a6 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 9 Sep 2011 14:57:35 -0700 Subject: [PATCH] start of percentage tracker --- checkers.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/checkers.rb b/checkers.rb index 41c898d..e0c4f65 100644 --- a/checkers.rb +++ b/checkers.rb @@ -238,7 +238,7 @@ class Board search_do(team, @top_depth) end - def search_do(team, depth) + def search_do(team, depth, percent) if depth == 0 puts "DONE" return {TEAM_1 => @stats[TEAM_1]['count'], TEAM_2 => @stats[TEAM_2]['count']} @@ -262,7 +262,11 @@ class Board if moves == [] puts "NO MOVES AVAILABLE?" else - results = moves[0].search_do(opposite_team(team), depth -1) + item_percent = percent/moves.length + results = moves[0].search_do(opposite_team(team), depth -1, item_percent) + if item_percent >= 0.1 + # UM WE NEED PERCENT SO FAR + end if results[opposite_team(team)] == 0 return {team => max, opposite_team(team) => 0} elsif results[team] == max