Ejemplo n.º 1
0
    override protected void OnStartGameCompleted(StartGameRequest.ResultData result)
    {
        _levelConfig = result.levelConfig;
        CreateGoals(result.gameGoals.Count);
        CopyGoals(result.gameGoals);

        _moves      = 1;
        _validMoves = 1;
        _maxMoves   = result.levelConfig.moves;
        LIMIT       = _maxMoves * 10;
        Vector.Release(_state0);
        _state0                  = _encoder.EncodeState(result.gridData, 0, _agent.GetParam(BaseAgent.STATE_DIM), boost);
        _gameState.grid          = result.gridData;
        _gameState.goals         = result.gameGoals;
        _gameState.randomHistory = null;
        _gameState.powerupScore  = 0;
        _gameState.levelScore    = 0;
        boost = false;

        /*
         * _gridCheck = 0;
         * GridCheck();
         */
        waitingForInterface = false;
    }
Ejemplo n.º 2
0
        private void OnStartGameCompleted(StartGameRequest.ResultData result)
        {
            _encoder.PrepareEncoderProjection(result.levelConfig);
            _agent.SetParam(BaseAgent.ACTION_DIM, _encoder.GetActionDim());
            _agent.SetParam(BaseAgent.BOOST_INDEX, _encoder.GetActionDim() - 1);
            _agent.SetParam(BaseAgent.STATE_DIM, _encoder.GetStateDim());
            Console.WriteLine("Max. moves: " + result.levelConfig.moves);
            Console.WriteLine("Action dim: " + _agent.GetParam(BaseAgent.ACTION_DIM));
            Console.WriteLine("State  dim: " + _agent.GetParam(BaseAgent.STATE_DIM));

            if (SolverConfig.GetInstance().filename != string.Empty)
            {
                string filename = ".\\" + SolverConfig.GetInstance().filename;
                Console.WriteLine("Loading file " + filename);
                _agent.Load(filename);
                Console.WriteLine(filename + " loaded.");
            }
            else
            {
                _agent.Init();
            }

            _initialized.Invoke();
        }