Beispiel #1
0
 //Create new instance of the class
 public Observation(Obs_Area p_area, Obs_Position p_position, Obs_Finance p_finance)
 {
     this.area = p_area; this.finance = p_finance; this.position = p_position;
 }
Beispiel #2
0
 //Create new instance of the class
 public Observation(Obs_Area p_area, Obs_Position p_position, Obs_Finance p_finance)
 {
     this.area = p_area; this.finance = p_finance; this.position = p_position;
 }
Beispiel #3
0
        //Create an new position instance based on the current game's data
        private Obs_Position createPosition()
        {
            Obs_Position position = new Obs_Position();

            #region DeletedParams

            /*
            #region CurrentArea

            //Current player's current area
            position.currentArea = -1;
            if (board.typeId[currentPosition].Equals(0))
            {
                position.currentArea = Math.Sin(DegreeToRadian(18 * gameCards[getIndexFromPosition(currentPosition)].getGroup()));
            }

            #endregion CurrentArea

            #region RelativePlayersPosition

            //Relative players position
            double[] relativePlayersPosition = new double[currentPlayers];

            //Calculate the relative value of every player
            int counter = 1;
            int lastAlive = 0;
            relativePlayersPosition[0] = Math.Sin(DegreeToRadian(sinConst * gamePlayers[currentPlayer].position));
            for (int i = 0; i < currentPlayers; i++)
            {
                if (!currentPlayer.Equals(i))
                {
                    relativePlayersPosition[counter] = Math.Sin(DegreeToRadian(sinConst * gamePlayers[counter].position));
                    counter++;
                    if (gamePlayers[i].isAlive)
                        lastAlive = i;
                }
            }

            //For every player that isn't alive assign to his place the value of the last ( based on index ) alive player
            counter = 0;
            for (int i = 0; i < currentPlayers; i++)
            {
                if (!i.Equals(currentPlayer))
                {
                    if (!gamePlayers[i].isAlive)
                        relativePlayersPosition[counter] = relativePlayersPosition[lastAlive];

                    counter++;
                }
            }

            position.relativePlayersPosition = relativePlayersPosition;

            #endregion RelativePlayersPosition
            */

            #endregion DeletedParams

            #region RelativePlayersArea

            double relativePlayersArea = 0;
            if (board.typeId[currentPosition].Equals(0) && gamePlayers[currentPlayer].isAlive)
                relativePlayersArea = (double)(getCardFromPosition(currentPosition).getGroup() + 1) / 10;
            else
                relativePlayersArea = 0;

            position.relativePlayersArea = relativePlayersArea;

            #endregion RelativePlayersArea

            return position;
        }