Exemple #1
0
        public Move GetNextMove(char col, int lvl)
        {
            this._tree = new SolutionTree(null, this._m);
            this._tree = Tools.BuildSolutionTree(this._tree, this._m, col, lvl - 1);

            return(this._tree.GetBestMove());
        }
Exemple #2
0
 private void InitGame()
 {
     this._m = new Map(Program.size);
     this._m.InitMap();
     this._m.InitGame();
     this._tree = new SolutionTree(null, this._m);
 }
Exemple #3
0
        public static SolutionTree BuildSolutionTree(SolutionTree tree, Map map, char col, int lvl)
        {
            List <Piece> allColPiece = map.GetAllPiece(col);

            foreach (Piece p in allColPiece)
            {
                foreach (Position pos in p.GetAllPos(map))
                {
                    Move m = new Move(p.GetPos(), pos);
                    if (pos.x > 7 || pos.y > 7)
                    {
                        p.GetAllPos(map);
                    }
                    int moveNote = map.GetNote(pos.x, pos.y);

                    // on inverse les notes un tour sur deux
                    moveNote = tree.note >= 0 ? moveNote : -moveNote;

                    tree.AddSolution(m, map, moveNote);
                }
            }

            if (lvl > 0)
            {
                foreach (SolutionTree t in tree.allSolution)
                {
                    Map nextMap = new Map(map);
                    nextMap.Move(t.mo);

                    BuildSolutionTree(t, nextMap, col == 'B' ? 'N' : 'B', lvl - 1);
                }
            }

            return(tree);
        }
Exemple #4
0
        public SolutionTree AddSolution(Move mo, Map m, int note)
        {
            SolutionTree st = new SolutionTree(mo, m, note);

            //this.note += note;

            this.allSolution.Add(st);

            return(st);
        }