Exemple #1
0
        private string upDateChanseAfterUse(string MoveUp, MovingXml currentObject, int value)
        {
            var index          = fullMoves.IndexOf(currentObject);
            var dictCurrentObj = currentObject.Chanse;

            if (last != null)
            {
                var indexprev  = fullMoves.IndexOf(fullMoves.FirstOrDefault(n => n.possiton == last));
                var PrevObject = fullMoves[indexprev];
                if (!currentObject.PrevPossiton.Select(n => n.Position).Contains(last))
                {
                    currentObject.PrevPossiton.Add(new PrevChoes {
                        Position = last, Move = lastChoese
                    });
                }
            }
            dictCurrentObj[MoveUp] = currentObject.Chanse[MoveUp] + value;
            currentObject.Chanse   = dictCurrentObj;

            fullMoves[index] = currentObject;
            FileContorl file = new FileContorl(_fileName);

            file.update(fullMoves);
            return(dictCurrentObj.ProbablityRandom());
        }
Exemple #2
0
        private void upDateXml(char Figure, Board tree)
        {
            var index      = fullMoves.IndexOf(fullMoves.FirstOrDefault(n => n.possiton == last));
            var PrevObject = fullMoves[index];

            PrevObject.Chanse = UpdateChanse(PrevObject.Chanse, Figure);
            fullMoves[index]  = PrevObject;
            FileContorl file = new FileContorl(_fileName);

            file.update(fullMoves);
        }