split race functions into new server/race.cc file.
Convert race functions to C++ objects