//add new move to GameTree
internal MoveStats RegisterGameResult(BoardMove mv, bool win) // GameBoard brd, GameMove mv, bool win)
{
Tuple<GameMove, MoveStats> res = Tuple.Create(null as GameMove, null as MoveStats);
if (tree.ContainsKey(mv.Board))
{
//do we have this move registered for this board?
var brdMoves = tree[mv.Board];
if (brdMoves.ContainsKey(mv.Move.Position))
{
res = brdMoves[mv.Move.Position];
//register win
res.Item2.RegisterResult(win);
//store modified stats into moves dictionary
brdMoves[mv.Move.Position] = res;
//store modified move dictionary into boards disctionary
tree[mv.Board] = brdMoves;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.