New answers tagged c
5
I'd squeeze in another variable - cells travelled - it could act as your "planning" score.
Base
Given the core variables speed, length, cells travelled, the main formula could be:
score = base * (length * speed)
With base being:
base = cells traveled; // basically, this could prove enough
// optionally
base *= board size coefficient; // a coefficient ...
1
Your problem is with how you're using SDL_PollEvent.
You want to do this:
while( SDL_PollEvent(&event) )
{
// event-handling code goes here
}
The problem is that SDL generates many events per rendered frame, but your code is only processing one of those events, and leaves the others still pending. This is going to be where your lag is coming ...
Top 50 recent answers are included