See all of your enemies’ owned cards while battling! Harnessing the power of APIs and Programming.

Hello! It's me again! idigjapanesechix back with another content that may provide additional utility for splinterland users to win more of their ranked games! I have posted two contents here in splintertalk, and I hope to release content every week!.
Today, I will show you how I created a program that determines the opponent’s owned and rented cards.

The Problem

Figure 1 Normal view when fighting someone
Source: Locally taken from splinterlands website

As you can see, if you fight an enemy, you can only see the splinters used for the last 5 fights. Suppose the enemy has a wide variety of cards. In that case, you will have no idea of knowing it except for manually searching the opponent’s deck using an API, which can be tiring if done repeatedly.

Figure 2 Screenshot of raw sample output from the API
Source: Locally taken from the API at [1]

As you can see in Figure 2, the API is not very user-friendly. You can see with this API call, I can see the card of the player “kiokizz”. By the way this API is from GitHub [1]. You can also find other interesting things there. Given a time limit, finding out the opponent's card through this method is very inefficient.
Other than this method, an alternative method to this is maybe using another spare account that is not currently in a battle to search the opponent’s playable cards.


Figure 3 Screenshot of sample output when searching an opponent through the market.
Source: Locally taken

This method is more user-friendly, but what if you don’t have a spare account?

The solution
This is where my proposed solution comes in. I have created a program that can be easily accessed through a terminal that is fast and easy to read! You just sit back and relax while you dominate your opponent!

Figure 4 Flowchart of the system
Source: Made using

This is my design for my program. First, it will prompt for the username of the user through the command prompt. Next, the program calls 3 APIs.
First is the current battle API, which displays contains information about an ongoing fight. This is useful to know if the player does have an opponent automatically.

After this process, another API is called that returns the opponent’s cards [2]. This is not the final output yet since it is similar to Figure 2 and still needs additional parsing. Python was used to process the JSON file and output it into a more readable format. After removing the majority of the columns, the list was left with just the list of the card IDs and the corresponding card level. Duplicate monsters were also removed from the list since it would make the it unnecessarily longer. This contains the opponent’s card IDs in a listed format, and if you don’t know who card id 137 is, you cannot identify the monster. With this, we need to reference it with a list of monsters so we can identify the name of the card.

The last API was called, which returns that list of the monsters with the corresponding names. This output was also parsed so that a column only contains the card’s ID, name, and color (type). I also decided to add the color to determine what type of splinter the opponent would use. After formatting the second table, it was then merged with the first table.


And voila! We have an automatic bot that can identify our enemy’s cards.


Figure 5 Output of the program
Source: Locally taken from the Anaconda prompt terminal

As you can see, by using the program, you can know more about your opponent. Based on Figure 5, it looks like the enemy owns a Djinn Chwala; maybe that’s why he mostly goes with dragon summoner. Wow! he has a level 6 Rusty Android. Well, in this instance, we can clearly see that he uses a dragon team, but the program may still be useful in determining the opponent’s owned and rented cards. With the increasing popularity of Venari Wavesmith, it is also good to know the cards that the opponent can play.

The best part of the program? It automatically loops every 30 seconds! Although this can be adjusted, I’ve designed it so that I can quickly determine the enemy’s cards.

This blog demonstrated the importance of knowing your opponent's card. The two methods available currently, which are via raw API (1) and via searching the opponent with the use of another account (2). The first method is hard to read while the second is not favorable for those who have a single account. With this problem, a program that shows the enemy cards in a listed format is developed to ease the process and to increase the overall win rate.

That’s all for now! If you reached this part, thank you for reading! I hope we can discuss your thoughts or even any reactions! Just drop a comment! Hopefully, soon I can share the program, but for now, I hope you learned a thing or two.



Congratulations @idigjapanesechix! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You received more than 10 upvotes.
Your next target is to reach 50 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Hive Power Up Month - Feedback from Day 25