Use Python and Spreadsheets to Determine the best production values for your land

image.png

WEN LAND?

Wen Land, the players of Splinterlands cried for an eternity. With the advent of the White Paper; a whole bunch of people started to realise that they needed to obtain a lot more cards. Others, with large collections, looked to their palms, often placed right in front of their eyes, at the monumental task in front of them.

I've got an easier way for you to suffer. This script will save you a whole bunch of time in the future, until someone builds a web app that can do this automatically. That person won't be me, unless someone pays me a gratuitous amount of SPS or DEC to do so.

Things you'll need to use my method:

  • A Python Interpreter
  • Google Sheets or Excel
  • PeakMonsters
  • A Web Browser
  • A Fresh Directory on your PC

ONE
Create a new directory on your computer and call it "holoz0r is awesome"


TWO
Reflect upon the majesty of the beard that holoz0r brings to Splinterlands.TV, the Roaring Twenties, and indeed Splinterlands.


THREE
Choose how you're going to use Python. I use pyCharm, because it is free, and has a lot of advanced features. It is also cross platform.


FOUR
Install pyCharm or whatever Python interpreter you want to use.


FIVE
Point it to your "holoz0r is awesome" directory for you first project.

Optional: Call your Python script thankyouholoz0r.py


SIX
Go to PeakMonters


SEVEN
Log in


EIGHT
Go to my cards, and click the download as CSV save this in the directory holoz0r is awesome


NINE
Go to my land, and click the download as CSV, saving it also in the directory holoz0r is awesome


TEN:
Go back to your python interpreter.


ELEVENTY
Realise you need to install the pandas module if you haven't


THE DOZEN
Open your command prompt or terminal and type pip install pandas


THIRTEENTH Alt Tab back to your python interpreter


FOURTEENTH Type the code below

import pandas as pd

Congratulations, you've just imported your first python module.

Continue to type some stuff, to get information about the Splinterlands card collection from the Splinterlands API

cardinfo = pd.read_json("https://api2.splinterlands.com/cards/get_details")

Then, throw away the extra columns that we won't use again.

cardinfo.drop(["sub_type","drop_rate","is_starter","created_block_num","last_update_tx","total_printed","is_promo","tier","distribution"], axis=1, inplace=True)

Get the Pandas Module to read your collection of cards as a dataframe
collection = pd.read_csv("YOUR COLLECTION DOWNLOADED FROM PEAKMONSTERS.CSV")

The reason we are using the collection from peakmonsters instead of polling the API to get your collection, then figuring out the PP, is because I'm lazy, and the exceptional PeakMonsters team have already done the work.

Next, we're going to join your collection to the card info, to make it human readable.

You do this by creating a new data frame and merging the card details with the ids. This is the same as doing a JOIN function in SQL, but we're doing it using Python, instead.

finalproduction = collection.merge(cardinfo, left_on="card_detail_id", right_on="id")

Then, export it to a new CSV:

finalproduction.to_csv("finalproduction.csv")

Now, its time to tackle your land: Do the same for your filthy land plots, peasant:

deeds = pd.read_csv("YOUR MYLANDS FROM PEAKMONSTERS.CSV")

FIFTEEN: Use a beautiful table that I created that tells you how competent each type of monster is on each plot of land, and the best type for each land. Copy and paste the below, then save it as a CSV called holoz0rlandtable.csv, adding it to your holoz0r is awesome folder.

Note: These figures are subject to change, and I won't be updating this table each time they do

Terrain TypeFireWaterLifeDeathEarthDragonNeutralBest Element 1Best Element 2Best Element 3Worst Element 1Worst Element 2Worst Element 3
Badlands1.110.51.10.511FireDeathNeutralLifeEarth
Bog0.51.10.51.1111WaterDeathNeutralLifeFire
Caldera1.1110.50.51.11FireDragonNeutralDeathEarth
Canyon1.050.90.91.050.91.051FireDragonDeathWaterLifeEarth
Desert1.10.50.5111.11FireDragonNeutralWaterLife
Forest111.10.51.10.51LifeEarthNeutralDeathDragon
Hills10.51.10.511.11LifeDragonNeutralWaterDeath
Jungle111.10.51.10.51LifeEarthNeutralDeathDragon
Lake0.51.1111.10.51WaterEarthNeutralFireDragon
Mountain1.10.511.10.511FireDeathNeutralWaterEarth
Plains10.51.110.51.11LifeDragonNeutralWaterEarth
River0.51.1111.10.51WaterEarthNeutralFireDragon
Swamp0.51.10.51.1111WaterDeathNeutralFireLife
Tundra0.91.051.050.91.050.91WaterLifeEartthFireDeathDragon

Optional: Make a comment advising the table is wrong, and correct it yourself in the comments.


RIGHT: SIXTEENTH

Join my fancy table to your deed data. This code should look familiar if you've been paying attention:

terrain = pd.read_csv("holoz0rlandtable.csv")

landjoined = deeds.merge(terrain, left_on ="type", right_on="Terrain Type")

landjoined.to_csv("finallandmap.csv")


RUN THE CODE AS THE SEVENTEENTH STEP

Address any questions to stack overflow or chat gpt if you get an error.


This concludes our time in Python... for now. The next step is to open each spreadhseet and observe in wonder as you have some stuff that looks like this:

finallandmap.csv

image.png

You'll see that your plots are now mapped to some useful information about them, such as whether they are magical, occupied, natural, rare, or any other number of informations.

You'll also see which Splinters, or elements as they may be called in the future; are going to be the very best for that specific plot of land.

Now is the time for introspection

What do you want out of your land?

  • SPS? Prioritise Occupied Land
  • The Secret of Praetoria? Priortise Magical Land
  • Grain and other Natural wonders? Prioritise Natural Land.
  • Despair and chaos? send your land to @darupt

My order of preference is

  • SPS
  • Secret
  • Natural Wonders

So what I'm going to do next is filter my land holdings by occupied, so I only see those plots in the list. I'm then going to look at hte terrain types and the best elements available for each:

image.png

In another window, I'm going to open my card collection.

image.png

You'll see that there are columns for the colour, and secondary colour (though, that only applies to Zyriel). Look at the type of land you want to priortise, then ensure your list of monsters is sorted by PP.

Next, filter it to only show the colours relevant to the "best elements" for that land plot you want to work on.

You'll see in the above, I've assigned various monsters to various lands, with a few of the neutrals left out. That's because mathematics is difficult, and we'll come back to decide where the neutral monsters of high production value will dwell at a later date.

Once you've iterated through each of your lands, and monster types that are suitable for that given land plot; it will be time to go back to Python for the final part of our enhancements, which will be to automatically add in the land types and other values, if you're running low on monsters and need to use stuff that might not be right for the land type, but could still have higher production than lower levelled cards.

In my case, I have a lot of Lakes and Rivers, so... fire creatures aren't going to work too well for me.

Anyway, enough rambling - do something like this in Python:

image.png

Now back to the guide


(and back to Excel)

Do you know what a pivot table is? No? Well, it is a useful tool in data analysis, and is basically a way more primitive form of the powerful "GROUP BY" functions used in data analysis to profile things or get them into groups based on certain flags or values. What I am going to do now is remind you of the fact that the monster type, monster level, terrain type, and terrain preference is not the only thing that can influence the final production.

There's titles.

There's Runi.

There's totems.

There's the amount of DEC you stake on that plot, but we don't know much, or anything about that at all.

First, I want to create a SUPER MEGA ULTRA SUPERIOR pivot table that shows my production values by Type, rarity, plot, and also helpfully inform me which monster is on that land.

To do that, I create a table out of the joined data in the seperate step above, which was "Return of the Python".

Here is that pivot table:

image.png

And here is the configuration:

image.png

If I then expand out another layer, it will show me the plots below...

image.png

The above means that my common occupied land (based on the cards I've placed upon it, seems to have a higher production output than my epic land (based purely on the monster PP).

The next step beyond this is going in and looking at which monsters were assigned to which plot.

I also split the pivot tables by the type of land:

Screenshot 2023-05-05 at 3.43.49 pm.png

The final step as part of this is to assign titles, totems, and Runi to the various lands to increase their production points.

You would want to again do this in the order of your priorities, and apply multipliers to the production in the original rows of the table.

If you've gotten this far, you should be competent enough in spreadsheets to do this.


Want more content from me?

Witness my futile efforts to play my Steam Game collection in alphabetical order.

Are you aware that I love photography? Check out my work in a collection.


If you haven't started playing Splinterlands, you should do that immediately. It's very good fun.

If you want to see my Splinterlands antics and rants live, Find me on Twitch

If you prefer sleeping in your designated time zone, go watch replays on YouTube.


Thanks as always for your time!



0
0
0.000
29 comments
avatar

Excellent piece of original work!

0
0
0.000
avatar

I try. It's for the love of the game, and the love of numbers.

0
0
0.000
avatar

I might have to give this a go, great work.

You deserve a full upvote for the directory name alone!

0
0
0.000
avatar

Thanks mate. I get sick of uncreative, dry tutorials, so try to make it a little bit more engaging. It's probably a bit less easy to follow that way, but at least I know that someone paid attention when they comment on it.

Thanks for paying attention, I truly appreciate it.

0
0
0.000
avatar

it's also a very useful tool of course, I wasn't enjoying trying to manually figure out all the variables for land staking, it's a nightmare!

0
0
0.000
avatar

Nor was I gonna enjoy it.

Hopefully someone competent with development can take the process I've sorta baked up here and turn it into a web app that automatically assigns monsters to plots, and then assigns totems, based on your preferences.

With only 150,000 plots and even less humans able to use such a tool though, I felt like it was wasn't worth time for this particular example.

0
0
0.000
avatar

I'm getting an error. I think its because I already have a 'holzo0r is awesome' directory.

0
0
0.000
avatar

Thanks for the info , I always thought a Python was a posionous snake,,, who knew ,,,,I guess you did :-)

0
0
0.000
avatar

Its also a scripting / programming language :D

The snake depicted, however, is Uraeus.

0
0
0.000
avatar

!PGM
!PIZZA

0
0
0.000
avatar

Sent 0.1 PGM - 0.1 LVL- 1 STARBITS - 0.05 DEC - 1 SBT - 0.1 THG - 0.000001 SQM - 0.1 BUDS - 0.01 WOO tokens

remaining commands 2

BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!

The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]

5000 PGM IN STAKE = 2x rewards!

image.png
Discord image.png

Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP

Get potential votes from @ pgm-curator by paying in PGM, here is a guide

I'm a bot, if you want a hand ask @ zottone444


0
0
0.000
avatar

I always love some good Python code that interfaces with anything HIVE. Will have a look at this as I have a decent amount of land and older cards.

0
0
0.000
avatar

Oh, but this isn't very good code, and it doesn't really "directly" interface with HIVE. It more or less just stitches things together poorly with the broken sewing machine that is my coding skills.

0
0
0.000
avatar

never used python before, been wanting to learn, the import pandas as pd gives me: ModuleNotFoundError: No module named 'pandas'. I installed pandas in terminal correctly i think.

0
0
0.000
avatar

Try installing it in PyCharm, as well. It uses its own virtual environments for each project.

0
0
0.000