#include <AITrainer.h>
Public Member Functions | |
| AITrainer (std::string track_filename) | |
| Train AI by racing variants against each other. | |
| virtual | ~AITrainer () |
| void | hello () |
Private Member Functions | |
| void | reset_cars () |
| Create cars in their initial positions. | |
| void | simulate () |
| Run the simulation for a while. | |
| void | rank_cars () |
| Score the cars and store the order in car_ranks. | |
| void | mutate () |
| Edit the car's neural networks. | |
| btScalar | car_score (unsigned int car) |
| Get the score for the requested car. Higher is better. | |
Private Attributes | |
| unsigned int | number_of_cars |
| number of cars to use. | |
| unsigned int | ticks_simulated |
| number of game ticks in a match | |
| unsigned int | max_iterations |
| number of matches to try | |
| unsigned int | iteration |
| how many matches have been run | |
| std::vector< boost::shared_ptr< Engine::InputDeviceAI > > | m_ai_devices |
| The InputDevices for the computer controlled players. | |
| std::vector< GameObjects::Car * > | cars |
| std::ifstream | track_file |
| std::string | theme_filename |
| std::ifstream | theme_file |
| Track::Theme | theme |
| Track::Track | track |
| The course to test on. | |
| Physics::World * | world |
| boost::shared_ptr< btRigidBody > | track_body |
| boost::shared_ptr< btRigidBody > | floor_body |
| boost::shared_ptr< btCollisionShape > | track_shape |
| boost::shared_ptr< btCollisionShape > | floor_shape |
| std::vector< int > | car_ranks |
| The ranking of the cars. | |
| std::vector< btScalar > | starting_scores |
| The scores the cars have in there initial positions. | |
| btVector3 | start_point |
| The centre of the starting plane. | |
| btVector3 | start_plane_normal |
| A normalized vector in the direction perpendicular to the starting plane. | |
| btScalar | start_plane_distance |
| The signed distance between the origin and and the starting plane. | |
Definition at line 28 of file AITrainer.h.
| Engine::AITrainer::AITrainer | ( | std::string | track_filename | ) |
Train AI by racing variants against each other.
| track_filename | The filename of the track to use relative to where the data directory is. |
Definition at line 31 of file AITrainer.cpp.
| Engine::AITrainer::~AITrainer | ( | ) | [virtual] |
Definition at line 217 of file AITrainer.cpp.
| btScalar Engine::AITrainer::car_score | ( | unsigned int | car | ) | [private] |
Get the score for the requested car. Higher is better.
Definition at line 163 of file AITrainer.cpp.
| void Engine::AITrainer::hello | ( | ) |
| void Engine::AITrainer::mutate | ( | ) | [private] |
Edit the car's neural networks.
The top 5 cars are left alone, the next 5 cars have some random variations added, and the rest are reconstructed from parts of the top 5.
Definition at line 188 of file AITrainer.cpp.
| void Engine::AITrainer::rank_cars | ( | ) | [private] |
| void Engine::AITrainer::reset_cars | ( | ) | [private] |
| void Engine::AITrainer::simulate | ( | ) | [private] |
std::vector<int> Engine::AITrainer::car_ranks [private] |
The ranking of the cars.
car_ranks[0] is the index of the best performing car.
Definition at line 86 of file AITrainer.h.
std::vector<GameObjects::Car *> Engine::AITrainer::cars [private] |
Definition at line 67 of file AITrainer.h.
boost::shared_ptr<btRigidBody> Engine::AITrainer::floor_body [private] |
Definition at line 79 of file AITrainer.h.
boost::shared_ptr<btCollisionShape> Engine::AITrainer::floor_shape [private] |
Definition at line 81 of file AITrainer.h.
unsigned int Engine::AITrainer::iteration [private] |
std::vector<boost::shared_ptr<Engine::InputDeviceAI> > Engine::AITrainer::m_ai_devices [private] |
unsigned int Engine::AITrainer::max_iterations [private] |
unsigned int Engine::AITrainer::number_of_cars [private] |
btScalar Engine::AITrainer::start_plane_distance [private] |
The signed distance between the origin and and the starting plane.
Definition at line 95 of file AITrainer.h.
btVector3 Engine::AITrainer::start_plane_normal [private] |
A normalized vector in the direction perpendicular to the starting plane.
Definition at line 93 of file AITrainer.h.
btVector3 Engine::AITrainer::start_point [private] |
std::vector<btScalar> Engine::AITrainer::starting_scores [private] |
Track::Theme Engine::AITrainer::theme [private] |
Definition at line 72 of file AITrainer.h.
std::ifstream Engine::AITrainer::theme_file [private] |
Definition at line 71 of file AITrainer.h.
std::string Engine::AITrainer::theme_filename [private] |
Definition at line 70 of file AITrainer.h.
unsigned int Engine::AITrainer::ticks_simulated [private] |
Track::Track Engine::AITrainer::track [private] |
boost::shared_ptr<btRigidBody> Engine::AITrainer::track_body [private] |
Definition at line 78 of file AITrainer.h.
std::ifstream Engine::AITrainer::track_file [private] |
Definition at line 69 of file AITrainer.h.
boost::shared_ptr<btCollisionShape> Engine::AITrainer::track_shape [private] |
Definition at line 80 of file AITrainer.h.
Physics::World* Engine::AITrainer::world [private] |
Definition at line 77 of file AITrainer.h.
Generated at Mon Sep 6 00:41:17 2010 by Doxygen version 1.4.7 for Racer version svn335.