Mastermind

Survive the Colosseum


In this challenge you will be thrown into the Colosseum alone to fight off a series of attacks.

A number of gladiators will circle you in a ring formation, and you must carefully choose the order in which to attack them. Each gladiator has a unique weakness, and can be defeated only if they are attacked using the correct weapon. Our armory is quite large, so to allow you to get your bearings I will give you a limited number of weapons from which to choose for each set of gladiators.

To test your weaponry skills, you will be required to use a different weapon to attack each gladiator, never using the same weapon twice for a single set of gladiators. To defeat a set of gladiators, you must attack each using the correct weapon within the same attack sequence. You will be given a number of guesses to defeat the gladiators, after which you will lose the match.

After each attempt to attack the gladiators, I will give you two key pieces of feedback:

  1. How many weapons that you chose correctly from the rack, regardless of whether it was used against the correct gladiator (i.e. it might be used against another gladiator)
  2. How many weapons were used against the correct gladiator

An observant soldier can use this information wisely, and will quickly be able to determine the correct attack sequence.

In the first stage you will face four 4 gladiators, and will have 6 weapons with which to attack them. The weapons will be numbered 0-5, and you will carry out your attack by submitting a comma delineated sequence of weapons with which to attack. After each attack, if you've won the fight I will respond with a message to continue on to the next level, and if you lose by running out of turns I will respond with an error message.

In the later levels, you will fend off attackers for multiple rounds. You must win all rounds without losing or else you will have to start the level again. There will be no pause between rounds.


When you complete this challenge, send your resume along with the hash value you collected and any code used in the challenge to: careers@praetorian.com.

A sample attack sequence will look like this: [3,2,5,0]

Which means that you will attack gladiator #1 with weapon #3, gladiator #2 with weapon #2, gladiator #3 with weapon #5, and gladiator #4 with weapon #0.

After each attack attempt, I will respond by telling you how many weapons you chose correctly, and how many weapons you used against the correct gladiator.

Each response will look like this: [2,1]

Which means that two weapons were chosen correctly from the rack, but that only one weapon was used against the correct gladiator.


API Endpoints: All requests are sent to https://mastermind.praetorian.com

NOTE: Upon receiving an error to any endpoint, the server will return the following: {“error”: “This error message explains the issue”}

Method Action Details
POST /api-auth-token/

Authenticate to the service. You only need an email address to obtain a token. Note: In each subsequent request, you'll need to provide a special authentication header: Auth-Token: AUTH_TOKEN


Request:

{“email”: “mastermind@praetorian.com”}

Response:

{“Auth-Token”: “AUTH_TOKEN”}

GET /level/<num>/

Start a new level. You must play levels in order, i.e. you cannot do level 5 before the previous 4 levels.


Response:

{“numGladiators”: 4, “numGuesses”: 8, “numRounds”: 1, “numWeapons”: 6}

POST /level/<num>/

Attempt to solve a level. If you make too many guesses or wait more than 10 seconds between subsequent guesses, the level will reset.


Request:

{“guess”:[1,2,3,4]}

Response:

{“response”: [2, 1]}
{“message”: “Onto the next level”}
{“numGladiators”: 4, “numGuesses”: 8, “numRounds”: 1, “numWeapons”: 6, “roundsLeft”: 24} Given when playing a level with multiple rounds, after beating each round.
{“hash”: “11111111111111”}

GET /hash/

Returns the hash once the game is completed.


Response:

{“hash”: “11111111111111”}

POST /reset/

Resets the user's saved state, allowing you to start again from level 1.


Response:

{“message”: “User reset”}

To help get you started, we've included basic code that can be used to retrieve and solve challenges.


Python