The competition

Competition instructions and API docs

The task at hand is to travel from Stockholm to Dubai using different means of transportations, while collecting as many points as possible on the way. Points are collected through completing various tasks, but points are also decreasing over time while traveling with vehicles that emit pollutions. Slow and restricted vehicles emit less pollutions than faster and unrestricted ones. In this context, restricted means that transportation is restricted between two specific cities and that the 'transportation method' departs with specific timeintervals, decided by the current game state. There is also a time limit, meaning it wont be possible to complete all objectives.

The winner is the team which makes it to Dubai with the highest number of points. If multiple teams end up with the same amount of points, the winning team will be the one whose algorithm had the fastest running time (the time it takes after having fetched the final game state until submitting the solution).

The API

Upon registering, you receive an API key. If you forgot to save it, it can also be retrieved on the teams page. This key must be provided with every request. It can either be put in the header as "X-ApiKey" or in the URL query string as "apikey". The following API methods are available:

  • /considition/initgame - Create a new GameState
  • /considition/getgame - Fetch your latest created GameState
  • /considition/getgame?gameStateId=[int] - Fetch the GameState with a specific ID
  • /considition/submit?gameStateId=[int] - Submit your solution to the GameState with a specific ID. Your solution must be a JSON-encoded array with commands in the body of the request.

If you are using C#, Java, JavaScript or Python, you can use one of our starter-kits including premade API libraries containing the following methods:

  • setApiKey(apiKey)
  • initgame()
  • getMyLastGame()
  • getGame(gameStateId)
  • submitSolution(solution, gameStateId)

You can also use this swagger to test and get a better understanding of the API and its endpoints.

The GameState object

When you fetch a GameState, you will receive an object which looks like this: { "id": 1337, "start": { "x": 354, // The X coordinate of the starting position on the map "y": 344 // The Y coordinate of the starting position on the map }, "end": { "x": 778, // The X coordinate of the ending position on the map "y": 894 // The Y coordinate of the ending position on the map }, "timeLimit": 2592000, // Time limit in seconds. Your AI must stop in Dubai before the time runs out. "pollutionsPointRate": 0.1, // One point is lost for every 0.1 tonne CO2 emissions "transportation": [ { "name": "Bike", "speed": 21.958560520763768, // Kilometers per hour "pollutions": 0.0, // This vehicle has no pollutions "travelInterval": null, // This travelling method is always availible "canUseAnywhere": true // Used with the TRAVEL command }, { "name": "Flight", "speed": 382.7047594276745, // Kilometers per hour "pollutions": 0.19867353108649771, // Tonne CO2 per hour "travelInterval": 240, // This travelling method is only availible every 240 minutes "canUseAnywhere": false // Used with the FLIGHT command }, ... // 4 more entries with car, boat, bus and train ], "cities": [ { "name": "Jönköping", "hasFlightTo": [], "hasTrainTo": [], "hasBusTo": [ "Malmö" // The name of the city where the bus goes to ], "x": 309, // X coordinate of the city on the map "y": 378 // Y ooordinate of the city on the map }, ... // 39-59 more entries ], "objectives": [ { "x": "Jönköping", "y": 200, "type": "visit_city", // Look further down to see a list of all objective types "description": "Visit city named {x} and do an activity which takes {y} minutes.", "points": 179 // Points received for completing the objective }, ... // 25 more objectives ], "map": [ [ "W", "W", "W", "R", "R", // W = water (boat), R = road (car/bike) ... // 995 more entries ], [ "W", "R", "R", "R", "R", // Neighbouring points have a distance of 1 km from each other ... // 995 more entries ], ... // 998 more entries ] } Keep in mind that game states are randomly generated. Most properties will have different values in different game states.

The objectives

There are 14 different types of objectives in the GameState:

  • visit_city - Visit city named x and do an activity which takes y minutes.
  • long_bike_ride - Bike x km in sequence without using any other transportation method.
  • curvy_road - Drive x km in sequence with a car while not driving more than y km in one direction. Bus, train and flight will not break the sequence.
  • far_from_city - Travel at least x km from closest city.
  • far_from_land - Sail on the sea with at least x km from closest land.
  • long_flight - Fly a distance which is at least x km long.
  • nearby_land - Sail x km in sequence on the sea with at most y km from closest land.
  • quick_far_city_visit - Visit two cities without an airport and which has a distance of at least x km from each other within a y hour window.
  • return_to_city - Travel to a city and return to it after at least x hours.
  • train_both_ways - Take a train route between two cities in both directions.
  • unique_path - Travel a path which is at least x km long without bus, train or airplane and without going to a point more than once.
  • useful_transport_methods - Travel at least x km in total with every transportation method.
  • visit_many_cities - Visit at least x different cities.
  • visit_small_island - Visit an island with a surface between x and y square kilometers.

The x and y parameters are supplied as their own properties in the GameState, so you can access them directly without having to parse them.

The commands for your AI

The different commands you use to control your character are the following:

  • TRAVEL [NORTH|SOUTH|WEST|EAST] - Travels one step in a direction of your choice
  • [BUS|TRAIN|FLIGHT] {CityName} - Travels from the city you're currently in to another city
  • SET_PRIMARY_TRANSPORTATION [CAR|BIKE] - Change your travelling method on land

Boat is automatically used when travelling on water, and car and bike are used while travelling on land.

The visualizer

The visualizer can either be used to debug your program, or to spy on your components. The following URL can be used to view your latest submitted solution:
http://theconsidition.se/Visualizer?apikey=[ENTER_YOUR_API_KEY_HERE]
To view visualizations of other team's submissions, browse the teams page.
It also possible to view all solutions for a specific game state:
http://theconsidition.se/Visualizer?gameId=[ENTER_GAME_STATE_ID_HERE]
To alter the speed of the visualization press and hold shift and scroll.
To zoom in/out on the map, simply scroll.
To change focus on the map while zoomed in, simply left click and drag the map in the desired direction.

Good luck!