https://github.com/hoxtygen/flexible-architecture
https://github.com/hoxtygen/flexible-architecture
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/hoxtygen/flexible-architecture
- Owner: Hoxtygen
- License: mit
- Created: 2019-11-25T12:11:32.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T06:57:06.000Z (over 3 years ago)
- Last Synced: 2025-02-28T10:56:51.108Z (over 1 year ago)
- Language: Python
- Size: 64.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: change_name.py
- License: LICENSE
Awesome Lists containing this project
README
# LAMBDA TREASURE HUNT
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.
## Setup, Dependencies and Environment Variables
This project uses `Pipenv` to manage dependencies. To begin you need to create a virtual environment with:
```sh
pipenv shell
```
Then install dependencies with:
```sh
pipenv install
```
The scripts require that a `.env` file be added to the root of the directory. The `.env` file should have the following:
```sh
TOKEN="[PLAYER'S TOKEN]"
NAME="[PLAYER'S NAME]"
```
## Scripts usage
### create_map.py 🌐
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`
```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`
```py
{0: {"n": "?", "s": "?", "e": "?", "w": "?"}}
```
To start the scripts, enter this command from the command line:
```sh
python create_map.py
```
This script will take a couple of hours to map out the entire game world so hang in there 😉.
### clean_room_details.py
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:
```sh
python clean_room_details.py
```
It writes the output of its operation to `traverse_results/room_details.py`.
### goto.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:
```sh
python goto.py [destination_room_id]
```
### treasure_hunter.py 💰
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:
```sh
python treasure_hunter.py
```
### pick_up_item.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:
```sh
python pick_up_item.py [name of item]
```
### change_name.py
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:
```sh
python change_name.py
```
### examine_well.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:
```sh
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](https://www.rapidtables.com/convert/number/binary-to-ascii.html) 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:
```sh
python goto.py [room_id]
```
### mine.py
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
```sh
python mine.py
```
## Useful Endpoints
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:
```sh
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:
```json
{
"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:
```sh
curl -X GET -H 'Authorization: Token 7a375b52bdc410eebbc878ed3e58b2e94a8cb607' https://lambda-treasure-hunt.herokuapp.com/api/bc/get_balance/
```
It returns your coin balance
```json
{
"cooldown": 1.0,
"messages": ["You have a balance of 35.0 Lambda Coins"],
"errors": []
}
```
## Full Lambda Treasure Hunt details/rules 📖
To view the rules of participating in the Lambda Treasure Hunt, check out the [Official Build Week readme](https://github.com/LambdaSchool/CS-Build-Week-2)