How I won $400 just by coding and playing games

Dheeraj
Nimbella
Published in
3 min readJul 14, 2021

Hi, I am Dheeraj. Today I am going to share the story of how I won $400 using my robot in FaaS War global serverless competition. I came to know about FaaS War global serverless competition through HackerEarth. It is a combination of programming and gaming. The rules of the game are simple, you need to write a code to control a robot (faasfighter) moving on a battlefield and fire lasers to battle another robot, built by other participants. You can get all the required information about building a faasfighter from their Learning Station.

My Experience

After observing different fights of other robots I came up with a strategy for my robot. Here two things are most important, Movement and Recon. If you can perfect any one of these, the chances of winning increase. So I started to code the movements of my robot, nothing big, just moving up and down you can use the “notsonza/CPU” robot since it doesn’t move at all. So it will be easier to focus on your movements around the map.

Next “The position” you need to always check your position whether you are near any corners or in the middle of the map etc. you can use the below image to get a rough idea about the map.

Once I got good movement, the next thing I needed to do is to find the opponent robot. To do this, the turret should be directly facing the opponent. So here I tried to move my turret as much as possible in a single go, and once I found the opponent I made sure to lock on the target position as my base line of sight and started shooting. However, there is a small problem here. What if the opponent moves? To counter this, I tried to move my turret left and right increasing the angle starting from 5-right, 10-left, 15-right and so on this became a good strategy to get the enemy’s location after moving. There are few more things I needed to consider, like my movement after getting hit or colliding with the wall, etc.

Tips on how to win the FaaS Wars

After trying different things I understood that a single strategy won’t work with all the robots. So you need to come up with a unique strategy that can fight offensively and defensively at the same time and also remember that there is no perfect bot here. You just need to improve it more and more.

Here are my tips for a good robot:

  • Move in all directions and cover more distance
  • Try to move your robot and turret at the same time, it increases the area covered
  • Avoid the walls
  • Once you get hit try to move away and don’t come to that position for a while
  • Keep an eye on your current location and decide your next movement based on that
  • If you collide into a wall make sure to get out of there as soon as possible and also make sure that your next move will be in the opposite direction to the wall
  • Make sure there are no errors in your code

Conclusion

Finally, I made a few more robots with more unique movements. “Anti_bot” was one of them and this robot helped me winning the first round. I’ve had a lot of fun coding my robots and was very happy after winning the first round.

It was also interesting to observe the ideas of other developers from all over the world. If you love coding and gaming don’t forget to join this battle.

Thanks to this event, I had the opportunity to get closer to the cloud computing concepts I had only heard about and in particular to the FaaS (Function as a service) category.

--

--