Exemple #1
0
        public double Evaluate(BoardState state, playerNr playerNr)
        {
            double toReturn = 1000.0;//This should never go negative !!!!
            var    me       = state.GetPlayer(playerNr);

            if (me.opponent.Hero.GetHPLeft() <= 0)
            {
                return(Double.MaxValue);
            }
            toReturn += (me.Hero.GetHPLeft() - me.opponent.Hero.GetHPLeft()) / 5.0;

            foreach (var unit in me.GetWholeBoard())
            {
                toReturn += EvaluateUnit(unit);
            }

            foreach (var unit in me.opponent.GetWholeBoard())
            {
                toReturn -= EvaluateUnit(unit);
            }

            if (toReturn < 0)
            {
                throw new Exception("Error evalute value got below 0, this will mess up the sorting algorithm of the value! Increase it to something higher as default to fix");
            }

            return(toReturn);
        }
Exemple #2
0
        public void TakeTurn(BoardState board, playerNr playerNr)
        {
            this.playerNr = playerNr;
            GetPlayer(board).NewTurn(board);
            BoardState newBoard = MakeDecisionOnNewBoard(board, GetPlayer(board));

            board.Update(newBoard);
        }
Exemple #3
0
 public List <ICard> GetCardPlaySequence(playerNr PlayerNr)
 {
     if (PlayerNr == playerNr.Player1)
     {
         return(p1CardPlaySequence);
     }
     else
     {
         return(p2CardPlaySequence);
     }
 }
Exemple #4
0
 public PlayerBoardState GetPlayer(playerNr PlayerNr)
 {
     if (PlayerNr == playerNr.Player1)
     {
         return(p1);
     }
     else
     {
         return(p2);
     }
 }
Exemple #5
0
 public void TakeTurn(BoardState board, playerNr playerNr)
 {
     this.playerNr = playerNr;
     GetPlayer(board).NewTurn(board);
     while (GetPlayer(board).GetValidBoardOptions().Count > 0 || GetPlayer(board).GetValidHandOptions().Count > 0)
     {
         MakeDecision(board);
         if (board.isFinished)
         {
             return;
         }
     }
 }
Exemple #6
0
        public void TakeTurn(BoardState board, playerNr playerNr)
        {
            this.playerNr = playerNr;
            var playerState = GetPlayer(board);

            playerState.NewTurn(board);
            if (playerState.Hero.IsDead())
            {
                board.FinishGame(playerState);
                return;
            }
            MakeDecisionsOnBoard(board, GetPlayer(board));
            TrackDominance(board.GetPlayer(playerNr));
        }
Exemple #7
0
        public void TakeTurn(BoardState board, playerNr playerNr)
        {
            possibleDecisions = new List <AI_DFS_Decision>();
            decisionsValues   = new List <double>();
            this.playerNr     = playerNr;
            board.GetPlayer(playerNr).NewTurn(board);
            if (board.isFinished)
            {
                return;
            }
            BoardState newBoard = MakeDecisionOnNewBoard(board, GetPlayer(board));

            board.Update(newBoard);
        }
Exemple #8
0
 /// <summary>
 /// Used for creating the original player
 /// </summary>
 /// <param name="playerSetup"></param>
 /// <param name="isGoingFirst"></param>
 /// <param name="deck"></param>
 /// <param name="board"></param>
 /// <param name="playerNr"></param>
 public PlayerBoardState(PlayerSetup playerSetup, bool isGoingFirst, Deck deck, BoardState board, playerNr playerNr, int StartCards)
 {
     startCards       = StartCards;
     this.playerNr    = playerNr;
     Hero             = new Hero(board, this);
     this.board       = board;
     this.playerSetup = playerSetup;
     myDeck           = deck.GetCardList(board, this);
     templateDeck     = deck;
     myHand           = new List <ICard>();
     myBoard          = new List <ICard>();
     myBoardWithTaunt = new List <ICard>();
     if (!isGoingFirst)
     {
         this.startCards++;
     }
     for (int i = 0; i < startCards; i++)
     {
         DrawCard();
     }
     Singletons.GetPrinter().StartCards(playerSetup, startCards, isGoingFirst, myHand);
 }
 internal PlayerBoardState GetPlayerState(playerNr playerNr)
 {
     return(state.GetPlayer(playerNr));
 }
Exemple #10
0
 public void SetPlayer(playerNr playerNr)
 {
     this.playerNr = playerNr;
 }
Exemple #11
0
 public PlayerBoardState GetPlayerState(playerNr nr)
 {
     return(state.GetPlayer(nr));
 }