daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private ValuedMove AlphaBetaMove(GameState state, AlphaBetaTreeNode node, int alpha, int beta)
  2.         {
  3.             if (state.IsFinal)
  4.                 return state.Leaf(Evaluate(state, false), node);
  5.  
  6.             ValuedMove curr = new ValuedMove(Int32.MinValue);
  7.             foreach (var pos in state.Grid.FreeGrid)
  8.             {
  9.                 AlphaBetaTreeNode newNode = node == null ? null : node.AddChild("Put in " + pos);
  10.                 ValuedMove minCheck = AlphaBetaPick(state.Move(pos), newNode, alpha, beta);
  11.                 curr.CheckSmaller(minCheck, pos);
  12.                 if (curr.BetaPrune(beta, node)) return curr;
  13.                 if (curr.Value == 1000) return curr;
  14.                 alpha = Math.Max(alpha, curr.Value);
  15.             }
  16.  
  17.             if (node != null) node.Value = curr.Value.ToString();
  18.             return curr;
  19.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top