Skip to content

Instantly share code, notes, and snippets.

@iSarCasm
Created January 30, 2019 20:53
Show Gist options
  • Save iSarCasm/70338ecbb261e7817dfc093f3867e901 to your computer and use it in GitHub Desktop.
Save iSarCasm/70338ecbb261e7817dfc093f3867e901 to your computer and use it in GitHub Desktop.
import api
while True:
api.request_frame()
if api.stage != 'prepare':
continue
if api.shop_closed():
api.open_shop()
else:
if api.gold() == 0:
continue
shop_items = api.shop_slots()
for i in range(len(shop_items)):
item = shop_items[i]
if item == 'empty':
continue
unit = api.Units[item]
if api.Un
if unit['cost'] <= api.gold():
if api.free_storage():
api.buy(i)
else:
# check what we can sell
continue
if api.storage_not_empty():
# first check for combos
for board_unit in api.units_on_board():
for storage_unit in api.units_in_storage():
# move mvp if free place
# swap cheap for mvp
if api.chess_placed() > api.level():
if api.free_storage():
# move cheapest to storage
else:
# sell cheapest
if api.chess_placed() > api.level():
# move cheapest to storage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment