# BasicGTSurfer

 BasicGTSurfer Author(s) Skilgannon Extends AdvancedRobot Targeting None Movement Wave Surfing Code License Public domain

Oh, and don't base your work on the go-to basicsurfer. Rather read the Understanding DrussGT page and read how it works there. Goto surfing has come a long way since those early experiments.

Skilgannon, author of BasicGTSurfer, 10 years later. (source)

Sub-pages:
Code

## Background Information

Based largely on BasicSurfer, but with a few tricks that make it surf GoTo style. I've seen several people say they want to try GoTo surfing, and I seem to have made a strong (ie bug free) implementation, so I'll give back some of what I've learned =).

OK, an explanation of the changes (and additions) I made to BasicSurfer to get BasicGTSurfer:
The most important were changing the precise prediction, the checkDanger, adding a getBestPoint method, and (obviously) adding a goTo method.
For the precise prediction, I modified it so that, instead of returning a single point, it returns an ArrayList of all the predicted points that the bot covered. Another important part is removing the last point of the prediction, because we have to remember that we need to be stopped by the time the wave hits us. If we left the last point, the bot would decelerate as it approached the point, and we wouldn't get there in time. Thus, the last point has to go.
Then next change is quite simple. We change the checkDanger method to take a point as a parameter, instead of a direction. This actually simplifies the checkDanger method, because it now has nothing to do with the PrecisePrediction.
Adding the getBestPoint method is probably the most complicated. It takes an EnemyWave as an argument. Let me explain what this method does (though I think the source code is fairly clear): First we check if we have already generated points to go to. If not, we call the precise prediction, in each direction, and store the points. We go though each point and find which has the lowest danger. We then know that you need to go in the direction of that point, so we discard the points from the other direction. We also discard the points that are further than this 'safe point'. (As an implementation decision, I stored this ArrayList of points in the EnemyWave, but you could easily store it as a class object.) We then need to decide which point to return to feed the 'goTo' method. If the point is less than 20 pixels away from our current position, we won't reach top speed (8 + 6 + 4 + 2 = 20). So we loop through the ArrayList of points, and find the closest one that is more than 20 pixels away, which we return. If there isn't a point 20 pixels away, we return the last point, which is the safe point we decided on earlier. And that is the most complicated piece of code that I added!
The goTo method is completely standard, but be careful about using the ones that decrease your speed as you go around corners. Our precise prediction doesn't do this, so neither should our goTo method.
Other small changes were:
• Putting some distancing in the precise prediction. Because it is so simple to add this to goTo surfing, I decided to put it in.
• Dividing the danger at a point by the distance from the fire location. This helps take the bot-width into account.
Things which should still be implemented in a competitive goTo surfer:
• Segmentation. The most important segments are (definitely) lateral velocity and distance. Acceleration helps, but not much. Also time-since-direction change, but that only helps against top GF guns and pattern matchers.
• Taking into account the bot-width when calculating the danger.
• Rolling averages in the surfing stats.
• Accurately simulating the deceleration at the end point in the precise prediction (Helps a lot, but what helps more is predicting what would happen if you don't decelerate)
How competitive is it?
It should be on par with BasicSurfer (possibly a bit stronger due to the distancing).

## Strategy

How does it move?
An extremely bare-bones form of GoTo Surfing with no segmentation.
How does it fire?
It doesn't.
What does it save between rounds and matches?
Between rounds, it saves all of its Wave Surfing statistics.