return Command.AUTO_FIGHT
        #elif not autoexplore :
        #    return Command.AUTO_EXPLORE
        else:
            actions = Action.get_all_move_commands()
            # currentaction = self.gamestate.get
            # # pick an action at random
            # chosen = random.choice(actions)
            # if chosen is
            return random.choice(actions)


if __name__ == "__main__":
    my_config = WebserverConfig

    # Toggle what is commented in the game_id section to choose between a seeded and unseeded game
    my_config.game_id = 'dcss-web-trunk'
    # my_config.game_id = 'seeded-web-trunk'

    my_config.delay = 0.4
    my_config.species = 'Troll'
    my_config.background = 'Fighter'
    my_config.starting_weapon = 'war axe'

    my_config.auto_start_new_game = True
    my_config.always_start_new_game = False

    # create game
    game = WebSockGame(config=my_config, agent_class=MyAgent)
    game.run()
            2: '(playerat cellx14y7)',
            3: '(playerat cellx19y12)',
            4: '(playerat cellx19y2)'
        }

        return blue_tile_goals[i]

    def get_random_simple_action(self):
        simple_commands = [
            Command.MOVE_OR_ATTACK_N, Command.MOVE_OR_ATTACK_S,
            Command.MOVE_OR_ATTACK_E, Command.MOVE_OR_ATTACK_W,
            Command.MOVE_OR_ATTACK_NE, Command.MOVE_OR_ATTACK_NW,
            Command.MOVE_OR_ATTACK_SW, Command.MOVE_OR_ATTACK_SE
        ]
        return random.choice(simple_commands)

    def requesting_start_new_game(self):
        return len(self.blue_goals_remaining) == 0


if __name__ == "__main__":
    my_config = WebserverConfig

    # set game mode to Tutorial #1
    my_config.game_id = 'tut-web-trunk'
    my_config.tutorial_number = 1

    # create game
    game = WebSockGame(config=my_config, agent_class=FastdownwardAgent)
    game.run()
Beispiel #3
0
            print("Planning with goal {}".format(self.new_goal))
            self.plan = self.get_plan_from_fast_downward(goals=[self.new_goal])
            self.previous_goal = self.new_goal
            self.previous_goal_type = self.new_goal_type

        next_action = None
        if self.plan and len(self.plan) > 0:
            next_action = self.plan.pop(0)
            self.actions_taken_so_far += 1
            return next_action

        print("warning - no plan, taking random action!")
        next_action = self.get_random_simple_action()
        return next_action

if __name__ == "__main__":
    my_config = WebserverConfig

    # set game mode to Tutorial #1
    my_config.game_id = 'dcss-web-trunk'
    my_config.delay = 0.4
    my_config.species = 'Minotaur'
    my_config.background = 'Berserker'

    my_config.auto_start_new_game = True
    my_config.always_start_new_game = True

    # create game
    game = WebSockGame(config=my_config,
                       agent_class=FastDownwardPlanningBaseAgent)
    game.run()
Beispiel #4
0
            'q': Command.QUAFF,
            'I': Command.LIST_ALL_SPELLS,
            'm': Command.SHOW_SKILL_SCREEN,
        }

        if self.gamestate.get_current_menu() is Menu.NO_MENU:
            return keypress_to_command_no_menu[keypress]
        elif keypress in Action.dcss_menu_chars:
            dcss_menu_char_i = Action.dcss_menu_chars.index(keypress)
            menuchoice = MenuChoice(dcss_menu_char_i)
            return menuchoice
        else:
            print("Got keypress {} and current Menu is {}".format(
                keypress, self.gamestate.get_current_menu()))
            return Command.EXIT_MENU


if __name__ == "__main__":
    my_config = WebserverConfig

    # set game mode to Tutorial #1
    my_config.game_id = 'dcss-web-trunk'
    my_config.always_start_new_game = True
    my_config.auto_start_new_game = True
    my_config.species = 'Vampire'
    my_config.background = 'Necromancer'

    # create game
    game = WebSockGame(config=my_config,
                       agent_class=HumanInterfaceBaseAgentDataTracking)
    game.run()