#!/usr/bin/env python3 import os import logging from eddie.endpoints import HttpEndpoint, TelegramEndpoint, TwitterEndpoint from example_bot import ExampleBot log_level = os.environ.get('BOT_LOGLEVEL', 'ERROR') logging.basicConfig(level=log_level) if __name__ == "__main__": bot = ExampleBot() bot.add_endpoint(HttpEndpoint(port=int(os.environ['PORT']))) bot.add_endpoint(TelegramEndpoint(token=os.environ['BOT_TG_TOKEN'])) bot.add_endpoint( TwitterEndpoint( consumer_key=os.environ['BOT_TW_consumer_key'], consumer_secret=os.environ['BOT_TW_consumer_secret'], access_token=os.environ['BOT_TW_access_token'], access_token_secret=os.environ['BOT_TW_access_token_secret'])) bot.run() logging.info("Serving...")
import sc2, sys from __init__ import run_ladder_game from sc2 import Race, Difficulty from sc2.player import Bot, Computer # Load bot from example_bot import ExampleBot bot = Bot(Race.Random, ExampleBot()) # Start game if __name__ == '__main__': if "--LadderServer" in sys.argv: # Ladder game started by LadderManager print("Starting ladder game...") run_ladder_game(bot) else: # Local game print("Starting local game...") sc2.run_game(sc2.maps.get("AbyssalReefLE"), [ bot, Computer(Race.Protoss, Difficulty.VeryHard) ], realtime=True)
def test_is_center_point_aviable(self): pic = get_image('screen_area_test.png').load() bot = ExampleBot() bot.set_game_screen(0, 0) assert bot.is_center_point_aviable(pic)
def test_init_screen(self): bot = ExampleBot() bot.init_screen() assert bot.screen.x == 18, bot.screen.x assert bot.screen.y == 30, bot.screen.y
import sc2 import sys from __init__ import run_ladder_game from sc2 import Race, Difficulty from sc2.player import Bot, Computer # Load bot from example_bot import ExampleBot bot = Bot(Race.Terran, ExampleBot()) # Start game if __name__ == '__main__': if "--LadderServer" in sys.argv: # Ladder game started by LadderManager print("Starting ladder game...") result, opponentid = run_ladder_game(bot) print(result, " against opponent ", opponentid) else: # Local game print("Starting local game...") sc2.run_game(sc2.maps.get("sc2-ai-cup-2020"), [ Bot(sc2.Race.Terran, ExampleBot()), Computer(sc2.Race.Terran, sc2.Difficulty.Medium) ], realtime=False)
import sc2, sys from __init__ import run_ladder_game from sc2 import Race, Difficulty from sc2.player import Bot, Computer # Load bot from example_bot import ExampleBot bot = Bot(Race.Terran, ExampleBot()) # Start game if __name__ == '__main__': if "--LadderServer" in sys.argv: # Ladder game started by LadderManager print("Starting ladder game...") result, opponentid = run_ladder_game(bot) print(result, " against opponent ", opponentid) else: # Local game print("Starting local game...") sc2.run_game(sc2.maps.get("Abyssal Reef LE"), [bot, Computer(Race.Protoss, Difficulty.VeryHard)], realtime=True)