Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##################################
- ### MINIMALISTIC BOT EXAMPLE 1 ###
- import cybw
- import time
- client = cybw.BWAPIClient
- Broodwar = cybw.Broodwar
- def connect():
- while not client.connect():
- time.sleep(0.5)
- connect()
- while True:
- while not Broodwar.isInGame():
- client.update()
- if not client.isConnected():
- connect()
- # >>> YOUR STARTING BOT CODE GOES HERE <<<
- while Broodwar.isInGame():
- # >>> YOUR MAIN BOT CODE GOES HERE <<<
- client.update()
- else:
- # >>> YOUR POST-GAME CODE GOES HERE <<<
- quit()
- ##################################
- ### MINIMALISTIC BOT EXAMPLE 2 ###
- import cybw
- import time
- client = cybw.BWAPIClient
- Broodwar = cybw.Broodwar
- # Pre-game connection-establishing cycle
- while True:
- if not client.isConnected():
- # Trying to connect to the game
- client.connect()
- time.sleep(0.5)
- elif not Broodwar.isInGame():
- # Waiting in game menu for a match to commence
- client.update()
- else:
- # Finishing cycle after successful connection and match commencing
- break
- while Broodwar.isInGame():
- # >>> YOUR BOT GAME LOGIC CODE GOES HERE <<<
- client.update()
- ##################################
- ### MINIMALISTIC BOT EXAMPLE 3 ###
- import cybw
- import time
- client = cybw.BWAPIClient
- Broodwar = cybw.Broodwar
- # Trying to connect to the game
- while not client.connect():
- time.sleep(0.5)
- # Waiting in game menu for a match to commence
- while not Broodwar.isInGame():
- client.update()
- # Main bot logic loop
- while Broodwar.isInGame():
- # >>> YOUR BOT GAME LOGIC CODE GOES HERE <<<
- client.update()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement