example/index.js
function runGame() {
    var totalReward = 0;
    var environment = new exampleWorld.Environment();
    var lastReward = null;

    function tick() {
        //Tell the agent about the current environment state and have it choose an action to take
        var action = sarsaAgent.decide(lastReward, environment.getCurrentState());

        //Tell the environment the agent's action and have it calculate a reward
        lastReward = environment.takeAction(action);

        //Log the total reward
        totalReward += lastReward;
    }

    for (var i = 0; i < 100; i++) {
        tick();
    }

    return totalReward;
}
function runGame() {
    var totalReward = 0;
    var environment = new exampleWorld.Environment();
    var lastReward = null;

    function tick() {
        //Tell the agent about the current environment state and have it choose an action to take
        var action = sarsaAgent.decide(lastReward, environment.getCurrentState());

        //Tell the environment the agent's action and have it calculate a reward
        lastReward = environment.takeAction(action);

        //Log the total reward
        totalReward += lastReward;
    }

    for (var i = 0; i < 100; i++) {
        tick();
    }

    return totalReward;
}
function runGame ( ) { var totalReward = 0 ; var environment = new exampleWorld . Environment ( ) ; var lastReward = null ; function tick ( ) { //Tell the agent about the current environment state and have it choose an action to take var action = sarsaAgent . decide ( lastReward , environment . getCurrentState ( ) ) ; //Tell the environment the agent's action and have it calculate a reward lastReward = environment . takeAction ( action ) ; //Log the total reward totalReward += lastReward ; } for ( var i = 0 ; i < 100 ; i ++ ) { tick ( ) ; } return totalReward ; }
Run a game where we see how high of a total reward we can get in 100 actions

@returns {number} Total reward for this game
Run a game where we see how high of a total reward we can get in 100 actions