In class we held a small tournament that we had been preparing for since week one. The idea was to have everyone create their own bot based off a bot that we made in class with our lecturer Greg. Well he made the bot frame work and we had to add our own little bits to make our bots superior to all the others. Everyone was pumped and ready to get their bot working with all these crazy ideas in mind but unfortunately things didn’t really go how we thought they would.
When we were looking at the bots code and stepping through it with Greg, it seemed very simple and gave us a lot of confidence that we would be able to walk away and do our own thing but when we tried to do that we all soon realised that we had forgotten a lot of what we had previously learned in the C++ language. This lead to a lot of people leaving everything to the last minute and very under developed bots for the tournament. This had me thinking that if people had not made much of an improvement on the base bot “TrumpBot” then all I would have to do is make a bot that would beat the base bot 100% of the time.
With this in mind, I started to think about small things I could try to change, add or take away. Only ever small things because I am only slowly getting back into C++ myself. After looking at how the bot behaved it was very obvious to me what I had to change and that was the movement. The movement on the base TrumpBot was garbage. The bot would select a place on the map and just go there. Not only that but the bot would also roam until it saw another bot and then change it’s destination to be the last known location of the bot it saw. This made the bot very predictable and easy to counter. The first thing that I did was remove the one line of code that made to base bot chase down other bots. This in itself almost gave me a 100% win rate but I was only scoring around 70% – 80%.
The next thing that I changed was how the bot went about avoiding the burst from the Base Bot. Once the bot had spotted you it would keep firing at where it spotted a bot and not stop until it could no longer see it. This would deal a lot of damage to other bots if they were travelling in a straight line and didn’t have any course correction. This was very simple to fix even though I went about it in a very lazy fashion. I used a check that would detect if I had taken damage and if so, my bot would chose another location on the map to travel to creating an unpredictable movement pattern that the Base bot couldn’t get a lock on. This was also a good idea for dodging any bots with interception/target prediction (definitely not the best way to do it but it WOULD work). With this implemented my bot was already getting upwards of 95% win rate against TrumpBot but this was not enough.
The last thing I did was very simple and involved very little to no change to the code. After looking at the bots fight a couple times I could see that my bot was not changing direction fast enough to avoid bullets. Since the bots had different variables that we could change, all I did was change a couple of values and increased to motor speed of my bot to make it more agile so it was able to switch directions a bit faster. In simply changing this, I was able to get 100% wins when pitting my bot against TrumpBot for 500 rounds. This was what I was aiming for and I achieved it through only very minor changes to the Bot that we were given.
Come to moments before the bot tournament, I found that people were struggling to even beat the TrumpBot. Some people couldn’t even get 1 win against TrumpBot. I was filled with confidence (very big head at this point). After talking to them and looking at their code I realised that they were trying various different things with their code like bullet interception and bullet dodging but since a lot of people left this to the last minute, they were very undeveloped and didn’t work how they thought they would.
The Bot tournament was a stomp. My bot beat everything it went up against. One bot put up a fight and got a couple of wins against my bot because they had put a little more time into their bot than most others but it still didn’t come close. After all the bots had competed and my bot came out on top, we pitted multiple bots against my bot and it still came out one top. I had made an unstoppable machine!
Everyone was surprised with the results that this bot was getting with such small changes to the code (as was I in all honesty). Looking at how TrumpBot and other bots worked, I was able to change a couple of things in the bot that we were given and craft a bot that was able to come out one top. This was a very big thing for me, backing up my original Ideas that sometimes the best ideas are not the most complex (sometimes).