Esempio n. 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());
        }
Esempio n. 2
0
        private void fillFullMoves()
        {
            FileContorl file = new FileContorl(_fileName);

            fullMoves = file.read();
            winsARow  = file.Tree.winsARow;
            louseARow = file.Tree.louseARow;
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        private void saveAdd(Dictionary <string, int> chanse, string positon)
        {
            FileContorl file = new FileContorl(_fileName);

            file.AddMoveToTree(new MovingXml()
            {
                Chanse       = chanse,
                possiton     = positon,
                PrevPossiton =
                    new List <PrevChoes>()
                {
                    new PrevChoes {
                        Position = last, Move = lastChoese
                    }
                }
            });
            file.save();
        }
Esempio n. 5
0
        //private int[] getChoseIndexs()
        //{
        //    var inedxs = choseIndexs.Split(';');
        //    int[] res = new int[inedxs.Length];
        //    for (int i = 0; i < inedxs.Length; i++)
        //    {
        //        res[i] = Convert.ToInt32(inedxs[i]);
        //    }
        //    return res;
        //}

        private void reaFile()
        {
            FileContorl file = new FileContorl(_fileName);

            fullMoves = file.read();
        }