Skip to content

A python API to the lift simulator. Designed for the Box Lift competition at Pycon 2016

Notifications You must be signed in to change notification settings

kingsawyer/python_lift_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

python_lift_api

A python API to the Lift simulator for the Box Lift competition at Pycon 2016. boxlift_api uses the http interface, boxlist_api2 uses the websocket interface. You can get the required library by "pip install websocket-client"

REG_ID = 'the checkin number sent to you in email from Pycon 2016. It is printed with your barcode'

Usage

from boxlift_api2 import BoxLift, Command, PYCON2016_EVENT_NAME

def decide_on_commands(state):
    # let's ask all elevators to stay put
    return [Command(elevator['id'], direction=1, speed=0) for elevator in state['elevators']]

lift_api = BoxLift('MyAwesomeBot', plan='training_1', email='my_email@example.com',
                   registration_id=REG_ID, event_name=PYCON2016_EVENT_NAME)
state = lift_api.send_commands()
# Setup building with elevators from returned state
while state['status'] != 'finished':
    commands = decide_on_commands(state)
    state = lift_api.send_commands(commands)
print('got a score of {}'.format(state['score']))
print('here is a graphic visualization {}.'.format(state['visualization']))

About

A python API to the lift simulator. Designed for the Box Lift competition at Pycon 2016

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages