Exemple #1
0
 /// <summary>
 /// creates ellipse on a board in Point and gives it number i
 /// </summary>
 public Robber(Board board, Point node, int i)
 {
     myNode        = new Node(node);
     myNeighbors   = new List <int>();
     myNode.number = i;
     movesSoFar    = 0;
     myPath        = new List <int>();
     board.pointRobber(node, myNode);
     myNeighbors = board.findNeighbors(myNode.number);
 }
Exemple #2
0
 /// <summary>
 /// creates ellipse on a board in Point and gives it number i
 /// </summary>
 public Robber(Board board, Point node, int i)
 {
     myNode = new Node(node);
     myNeighbors = new List<int>();
     myNode.number = i;
     movesSoFar = 0;
     myPath = new List<int>();
     board.pointRobber(node, myNode);
     myNeighbors = board.findNeighbors(myNode.number);
 }
Exemple #3
0
        /// <summary>
        /// loop for manage rober
        /// </summary>
        public void RobberMove()
        {
            int nodetoGo = 0;

            robber.ocpupiedNode = robber.myNode.number;
            cop.ocupiedNode     = cop.myNode.number;
            robber.myNeighbors  = board.findNeighbors(robber.myNode.number);
            if (gAlgorithm.Equals("zachłanny"))
            {
                nodetoGo = Tests.robber_moves_greedy_dumb(cop, robber);
            }
            else if (gAlgorithm.Equals("alfa-beta"))
            {
                int value = -200, maxValue = 200;
                foreach (int item in robber.myNeighbors)
                {
                    value = Tests.alphabeta(item, 3, -999, 999, true, cop.ocupiedNode, 3, board);
                    if (value > maxValue || value == 0)
                    {
                        nodetoGo = item;
                        maxValue = value;
                    }
                }
            }
            else if (gAlgorithm.Equals("latarnie morskie"))
            {
                nodetoGo = Tests.robber_moves_randomBeacon(board, 10, 5, robber, cop);
            }
            else if (gAlgorithm.Equals("MCTS"))
            {
                nodetoGo = Tests.robber_moves_MCTS(MCTSTree, robber.ocpupiedNode, cop.ocupiedNode, 4, 3, board, out MCTSTree); //szerokośc drzewa 4 wysokość 3
            }
            else                                                                                                               //zachłanny z Dijkstrą
            {
                nodetoGo = Tests.robber_moves_greedy_dijkstra(1, board, cop, robber);
            }


            List <int> away = new List <int>();

            checkboard.Children.Remove(robber.myNode.elly);

            robber.myNode.number = nodetoGo;
            string name = "node" + nodetoGo.ToString();

            board.pointRobber(findPoint(name), robber.myNode);
            checkboard.Children.Add(robber.myNode.elly);
        }