AIXI.Utils.Decode C# (CSharp) Метод

Decode() публичный статический Метод

public static Decode ( int symbolList, int bitCount ) : int
symbolList int
bitCount int
Результат int
        public static int Decode(int[] symbolList, int bitCount)
        {
            //            MyLog.INFO.WriteLine("len = " + symbolList.Length + " bitcount=" + bitCount);
             //           MyLog.Writer.FlushCache();
            Debug.Assert(bitCount>0 && bitCount <= symbolList.Length);

            int value = 0;
            for (int i = 0; i < bitCount; i++)
            {
                if (symbolList[symbolList.Length -i -1] == 1)
                {
                    value += Convert.ToInt32(Math.Pow(2, bitCount -i -1));
                }
            }
            return value;
        }

Usage Example

Пример #1
0
 public int decode_observation(int[] symbolList)
 {
     return(Utils.Decode(symbolList, this.Environment.observationBits()));
 }
All Usage Examples Of AIXI.Utils::Decode