Engine::AITrainer Class Reference

#include <AITrainer.h>

List of all members.

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::Worldworld
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.


Detailed Description

Definition at line 28 of file AITrainer.h.


Constructor & Destructor Documentation

Engine::AITrainer::AITrainer ( std::string  track_filename  ) 

Train AI by racing variants against each other.

Parameters:
track_filename The filename of the track to use relative to where the data directory is.

Todo:
special mutate for the first iteration?

Definition at line 31 of file AITrainer.cpp.

Engine::AITrainer::~AITrainer (  )  [virtual]

Definition at line 217 of file AITrainer.cpp.


Member Function Documentation

btScalar Engine::AITrainer::car_score ( unsigned int  car  )  [private]

Get the score for the requested car. Higher is better.

Todo:
For good competitive AIs, rank is more important than speed. If it knocks all rivals off, it can take as long as it likes to finish.

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]

Score the cars and store the order in car_ranks.

Definition at line 132 of file AITrainer.cpp.

void Engine::AITrainer::reset_cars (  )  [private]

Create cars in their initial positions.

Definition at line 86 of file AITrainer.cpp.

void Engine::AITrainer::simulate (  )  [private]

Run the simulation for a while.

Definition at line 126 of file AITrainer.cpp.


Member Data Documentation

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]

how many matches have been run

Definition at line 62 of file AITrainer.h.

std::vector<boost::shared_ptr<Engine::InputDeviceAI> > Engine::AITrainer::m_ai_devices [private]

The InputDevices for the computer controlled players.

Definition at line 65 of file AITrainer.h.

unsigned int Engine::AITrainer::max_iterations [private]

number of matches to try

Definition at line 60 of file AITrainer.h.

unsigned int Engine::AITrainer::number_of_cars [private]

number of cars to use.

Definition at line 56 of file AITrainer.h.

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]

The centre of the starting plane.

Definition at line 91 of file AITrainer.h.

std::vector<btScalar> Engine::AITrainer::starting_scores [private]

The scores the cars have in there initial positions.

Definition at line 88 of file AITrainer.h.

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]

number of game ticks in a match

Definition at line 58 of file AITrainer.h.

Track::Track Engine::AITrainer::track [private]

The course to test on.

Definition at line 74 of file AITrainer.h.

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.


The documentation for this class was generated from the following files:
Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:17 2010 by Doxygen version 1.4.7 for Racer version svn335.