public static GameState GetNextState(GameState s, Action a)
        {
            var nextS = s.Clone();

            if (a == core.Action.LEFT)
            {
                nextS = new GameState(nextS.UserHp, nextS.UserPos - 1, nextS.TowerHp);
            }
            else if (a == core.Action.RIGHT)
            {
                nextS = new GameState(nextS.UserHp, nextS.UserPos + 1, nextS.TowerHp);
            }

            if (nextS.UserPos == 0)
            {
                nextS = new GameState(5, nextS.UserPos, nextS.TowerHp);
            }
            else if (nextS.UserPos == 2)
            {
                nextS = new GameState(nextS.UserHp - 1, nextS.UserPos, nextS.TowerHp - 1);
            }

            if (s is CompactGameState)
            {
                nextS = new CompactGameState(nextS.UserHp, nextS.UserPos, nextS.TowerHp);
            }

            return(nextS);
        }
        public static GameState GetNextState(GameState s, Action a)
        {
            var nextS = s.Clone();

            if (a == core.Action.LEFT)
                nextS = new GameState(nextS.UserHp, nextS.UserPos - 1, nextS.TowerHp);
            else if (a == core.Action.RIGHT)
                nextS = new GameState(nextS.UserHp, nextS.UserPos + 1, nextS.TowerHp);

            if (nextS.UserPos == 0)
                nextS = new GameState(5, nextS.UserPos, nextS.TowerHp);
            else if (nextS.UserPos == 2)
                nextS = new GameState(nextS.UserHp - 1, nextS.UserPos, nextS.TowerHp - 1);

            if (s is CompactGameState)
                nextS = new CompactGameState(nextS.UserHp, nextS.UserPos, nextS.TowerHp);

            return nextS;
        }
        private void resetModel()
        {
            _agent = new QLearningAgent();

            trackBarAlpha.Value = 2;
            trackBarGamma.Value = 8;
            trackBarEpsilon.Value = 1;

            _agent.alpha = 0.2;
            _agent.gamma = 0.8;
            _agent.epsilon = 0.05;

            // regiser state-qvalue
            foreach (var userHp in Enumerable.Range(0, _maxUserHp + 1))
            {
                foreach (var userPos in Enumerable.Range(0, _maxUserPos + 1))
                {
                    foreach (var towerHp in Enumerable.Range(0, _maxTowerHp + 1))
                    {
                        var state = new GameState(userHp, userPos, towerHp);
                        var compactState = new CompactGameState(userHp, userPos, towerHp);

                        foreach (var action in state.GetActionSet())
                        {
                            if (checkBoxCompact.Checked)
                                _agent.registerStateQValue(compactState, action, 0);
                            else
                                _agent.registerStateQValue(state, action, 0);
                        }
                    }
                }
            }
        }