Shaik Azhar Madar avatar

Scoring Battles obtained from API

azarmadr3

Published: 04 Sept 2021 › Updated: 04 Sept 2021Scoring Battles obtained from API

Scoring Battles obtained from API

Using JavaScript to analyze Splinterlands battle data - Scoring teams.

In my previous hive blog, I've discussed how to obtain battle data from player and his 50 previous opponents.spl.battles.png

In this post, I've scored the battles obtained.

Analyze Battles

Sorting Battles to teams, summoners, and monsters, and then score their performance by rating 1 if one and -1 if lost. -0.5 to both teams if lost.
spl.scores.png
const verdictToScore = {w: 1, l: -1, d: -0.5};

verdict being if the team won or lost. Having a helper map separately allows us to assign values to different results without having to edit a lot of code.

Scoring teams one by one follows the below flow. the same for summoners and monsters.
spl.team.png

Finally, I get a json which gets sorted by the score and can be used while battle.

teamsummonermonsters
spl.ex.pngimage.pngimage.png
You can find the script in my git repo at azarmadr/bot-splinters in file score.js

Leave Scoring Battles obtained from API to:

Written by

I am learning about Blockchain technology

Read more #hive-140217 posts


Best Posts From Shaik Azhar Madar

We have not curated any of azarmadr3's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Shaik Azhar Madar