This repository contains a collection of scripts to enable a player participate in the Lambda Treasure Hunt 💰. The scripts are all written in Python 🐍 and the Requests HTTP library is used to make HTTP requests to the treasure hunt and coin mining endpoints.
This project uses Pipenv
to manage dependencies. To begin you need to create a virtual environment with:
pipenv shell
Then install dependencies with:
pipenv install
The scripts require that a .env
file be added to the root of the directory. The .env
file should have the following:
TOKEN="[PLAYER'S TOKEN]"
NAME="[PLAYER'S NAME]"
To make finding treasures and finding rooms to mine coin a little easier. The player is expected to have a comprehensive map of the game world and the details of the rooms available in the game. The create_map.py
script does this. It reads from and writes to room_details.py
and room_graph.py
. To generate the world and get room details afresh, the content of the files should be as follows:
room_details.py
[
{
"room_id": 0,
"title": "A Dark Room",
"description": "You cannot see anything.",
"coordinates": "(60,60)",
"exits": ["n", "s", "e", "w"],
"cooldown": 1.0,
"errors": [],
"messages": []
}
]
room_graph.py
{0: {"n": "?", "s": "?", "e": "?", "w": "?"}}
To start the scripts, enter this command from the command line:
python create_map.py
This script will take a couple of hours to map out the entire game world so hang in there 😉.
This script reads from room_details.py
and remove duplicate rooms. room_details.py
itself contains rooms as they are visited by the create_map.py
script so there are duplicates. To remove duplicates, run the script from the command line like this:
python clean_room_details.py
It writes the output of its operation to traverse_results/room_details.py
.
With the rooms and map all mapped out. This handy script makes moving around the map quite easy. It reads the map from the files room_graph_copy.py
which is just a map of the world generated after the create_map.py
script has run its course and room_details_copy.py
which is a copy of the file generated by using the clean_room_details.py
script.
This script takes a single command line argument which is the destination room. To use the script enter this command from the command line:
python goto.py [destination_room_id]
My favorite 🤗.
As the name implies, the script hunts for treasures and sells them when they are found. It is completely automated, so just start it from the command line and watch the output in the command line. I guarantee, you will be rich and famous.
To start making money 💵, enter this from the command line:
python treasure_hunter.py
There are so many awesome and mysterious artifacts lying around in the game. To pick up an item that catches your fancy, simply do:
python pick_up_item.py [name of item]
After amassing up to 1000 gold, you have to take on your authentic name. Name change is a prerequisite to coin mining so you do not want to skip this step. First make sure you have added your name to the .env
file.
Use the script like this:
python change_name.py
Now the plot thickens 🎦.
To find out the room where you must be to mine a Lambda coin, you need to peer into the deep dark water of the wishing well. The wishing well is the modern reincarnate of the Oracle of Delphi so you get a head-scratching prophecy.
To start the script to get the prophecy, enter:
python examine_well.py
from the command line. The script writes the prophecy to a file named wishing_well_prophecy.py
. You have to convert the binary codes to text to decipher what room you are allowed to mine. You can paste it here to translate the binary to ASCII.
If you peer hard enough at the ASCII text, you will decipher the room where your coin awaits you. Navigate to the room with this command:
python goto.py [room_id]
This script can be found in the mine folder. It mines a coin on the Lambda Blockchain.
Be sure to be present in the room specified by the wishing well. If unsure you can always repeat the steps involved in getting the wishing well's prophecy.
To begin mining, start the script
python mine.py
As you progress through the game, you can view your status using the status/inventory endpoint.
Here is a sample cURL command that does this:
curl -X POST -H 'Authorization: Token 7a375b52bdc410eebbc878ed3e58b2e94a8cb607' -H "Content-Type: application/json" https://lambda-treasure-hunt.herokuapp.com/api/adv/status/
Expect a response in this format:
{
"name": "br80",
"cooldown": 2.0,
"encumbrance": 2, // How much are you carrying?
"strength": 10, // How much can you carry?
"speed": 10, // How fast do you travel?
"gold": 400,
"bodywear": "None",
"footwear": "None",
"inventory": ["Small Treasure"],
"status": [],
"errors": [],
"messages": []
}
You can also view you coin balance using this command:
curl -X GET -H 'Authorization: Token 7a375b52bdc410eebbc878ed3e58b2e94a8cb607' https://lambda-treasure-hunt.herokuapp.com/api/bc/get_balance/
It returns your coin balance
{
"cooldown": 1.0,
"messages": ["You have a balance of 35.0 Lambda Coins"],
"errors": []
}
To view the rules of participating in the Lambda Treasure Hunt, check out the Official Build Week readme