Пример #1
0
 public void Link(ActionChain previous)
 {
     previous.ClearBoard ();
     List<ActionPair> newAction = new List<ActionPair> ();
     newAction.AddRange (previous.actions);
     newAction.AddRange (actions);
     actions = newAction;
 }
Пример #2
0
        /// <summary>
        /// Determine a score by applying the scoring function, looking up the database, or recursing deeper.
        /// </summary>
        void ScoringFn(int depth, ActionChain node)
        {
            byte[] dbrec = new byte[4];

            bool isTerminal = ApplyCutoff (node, depth);

            if (!isTerminal)
            {
            bool storedInDB = DB.Get (node.Board.GUID (), out dbrec);

            if (storedInDB)
            {
                node.score = BitConverter.ToSingle (dbrec, 0);
            }
            else
            {
                node.score = MinMax (depth + 1, node);

                // Store the score if it was obtained from a full search only
                if (depth == 0 && KeepSearching)
                {
                    RecordNodeInDB (node.Board, node.score);
                }
            }
            }

            node.ClearBoard ();
        }