コード例 #1
0
ファイル: run.py プロジェクト: selenecodes/IPASS
        runningScore = 0

    state = track.reset()
    runs = args.runs if args.train else 10
    for run in range(runs):
        " for every lap or run (when training) run it. "
        score = 0
        state = track.reset()

        maxTrackScore = 1000
        for _track in range(maxTrackScore):
            " For every track out of the maximum score "
            if args.train:
                action, coefficient = actor.chooseActionTrain(state)
            else:
                action = actor.chooseAction(state)

            newState, reward, done, die = track.step(action *
                                                     np.array([2., 1., 1.]) +
                                                     np.array([-1., 0., 0.]))

            track.render()

            if args.train and actor.storeInBuffer(
                (state, action, coefficient, reward, newState)):
                print('updating model file')
                actor.update()

            score += reward
            state = newState