00001 00005 /* Copyright © 2010 James Legg. 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 */ 00011 #ifndef AI_TRAINER_H 00012 #define AI_TRAINER_H 00013 00014 #include "Scene.h" 00015 #include "Physics/World.h" 00016 #include "GameObjects/Car.h" 00017 #include "InputHandler.h" 00018 #include "InputDeviceAI.h" 00019 00020 #include <libtrack/Track.h> 00021 #include <libtrack/Mesh/BulletMesh.h> 00022 00023 #include <fstream> 00024 00025 namespace Engine 00026 { 00027 00028 class AITrainer 00029 { 00030 public: 00035 AITrainer(std::string track_filename); 00036 virtual ~AITrainer(); 00037 void hello(); 00038 private: 00040 void reset_cars(); 00042 void simulate(); 00044 void rank_cars(); 00050 void mutate(); 00051 00053 btScalar car_score(unsigned int car); 00054 00056 unsigned int number_of_cars; 00058 unsigned int ticks_simulated; 00060 unsigned int max_iterations; 00062 unsigned int iteration; 00063 00065 std::vector<boost::shared_ptr<Engine::InputDeviceAI> > m_ai_devices; 00066 00067 std::vector<GameObjects::Car *> cars; 00068 00069 std::ifstream track_file; 00070 std::string theme_filename; 00071 std::ifstream theme_file; 00072 Track::Theme theme; 00074 Track::Track track; 00075 00076 00077 Physics::World * world; 00078 boost::shared_ptr<btRigidBody> track_body; 00079 boost::shared_ptr<btRigidBody> floor_body; 00080 boost::shared_ptr<btCollisionShape> track_shape; 00081 boost::shared_ptr<btCollisionShape> floor_shape; 00082 00086 std::vector<int> car_ranks; 00088 std::vector<btScalar> starting_scores; 00089 00091 btVector3 start_point; 00093 btVector3 start_plane_normal; 00095 btScalar start_plane_distance; 00096 }; 00097 00098 } 00099 00100 #endif // AI_TRAINER_H
Generated at Mon Sep 6 00:41:12 2010 by Doxygen version 1.4.7 for Racer version svn335.