Exemple #1
0
    def start(self):
        super(RandomCartPolePlayer, self).start()

        #run random games for training data
        for n in range(self.training_games):
            #print("training")
            self.score = 0
            self.prev_obseration = []
            cartpole.run()

        #train model with training data
        print("End of training")
        self.training = False
        #print(self.training_data)
        self.model = self.train_model(self.training_data)

        for n in range(self.play_games):
            #print("play")
            self.score = 0
            self.prev_obseration = []
            cartpole.run()

        #print(self.training_data)
        print(self.scores)
        print(self.choices)
Exemple #2
0
    def start(self):
        super(QCartPolePlayer, self).start()

        #run(screen_width=640, screen_height=480)
        for n in range(self.initial_games):
            self.epsilon = 1.0 / np.sqrt(n + 1)
            cartpole.run()
Exemple #3
0
    def start(self):
        super(DQNCartPolePlayer, self).start()

        for n in range(self.initial_games):
            self.score = 0
            cartpole.run()

        print(self.scores)
Exemple #4
0
    def play_game(self):

        # play set amount of games
        for n in range(self.initial_games):
            self.Q = self.initialize_Q()
            self.length = []
            self.reward = []
            self.epsilon = 1.0 / np.sqrt(n+1)
            cartpole.run()
Exemple #5
0
    def start(self):
        super(PGCartPolePlayer, self).start()

        for n in range(self.training_games):
            cartpole.run()

        self.training = False

        for n in range(self.playing_games):
            cartpole.run()

        print(self.play_scores)
    def start(self):

        # This code intercepts the regular pygame commands for
        # updating the screen, and getting keyboard inputs, and
        # redirects them to commands in this file.

        pygame.display.flip = function_intercept(pygame.display.flip,
                                                 self.on_screen_update)
        pygame.event.get = function_intercept(pygame.event.get,
                                              self.on_event_get)

        # Run the game.
        cartpole.run()
Exemple #7
0
    def start(self):
        super(RandomCartPolePlayer, self).start()

        #run(screen_width=640, screen_height=480)
        run()