Engine::InputDeviceAI Class Reference

A input device for a computer player. More...

#include <InputDeviceAI.h>

Inheritance diagram for Engine::InputDeviceAI:

Engine::InputDevice List of all members.

Public Member Functions

 InputDeviceAI ()
 A input device for a computer player.
virtual ~InputDeviceAI ()
virtual int get_acceleration ()
 Get a number representing the acceleration or breaking.
virtual int get_slide ()
 Sideways force .
virtual int get_steering ()
 Stearing angle.
virtual void poll ()
 Poll for events, if necessary.
void save ()
 Write the neural network to a file.
void mutate ()
 Add some random variance to the neural network.
void cross (const InputDeviceAI &p1, const InputDeviceAI &p2)
 Set neural network weights that combine those of another two InputDeviceAIs.

Private Attributes

int acceleration
int slide
int steering
fann * ann

Detailed Description

A input device for a computer player.

Simulated events occur when an AI decides.

Definition at line 23 of file InputDeviceAI.h.


Constructor & Destructor Documentation

Engine::InputDeviceAI::InputDeviceAI (  ) 

A input device for a computer player.

Simulated events occur when an AI decides.

Definition at line 22 of file InputDeviceAI.cpp.

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

Definition at line 32 of file InputDeviceAI.cpp.


Member Function Documentation

void Engine::InputDeviceAI::cross ( const InputDeviceAI p1,
const InputDeviceAI p2 
)

Set neural network weights that combine those of another two InputDeviceAIs.

Definition at line 273 of file InputDeviceAI.cpp.

int Engine::InputDeviceAI::get_acceleration (  )  [virtual]

Get a number representing the acceleration or breaking.

Returns:
A number from -32767 to 32767 giving the amount of accelerating or breaking to do: 0 if not accelerating or braking, a negative value for breaking, a positive value for acceleration.

Implements Engine::InputDevice.

Definition at line 37 of file InputDeviceAI.cpp.

int Engine::InputDeviceAI::get_slide (  )  [virtual]

Sideways force .

Returns:
a number between -32767 (maximum left) and +32767 (maximum right). 0 indicates no sliding.

Implements Engine::InputDevice.

Definition at line 42 of file InputDeviceAI.cpp.

int Engine::InputDeviceAI::get_steering (  )  [virtual]

Stearing angle.

Returns:
a number between -32767 (maximum left) and 32767 (maximum right). 0 is straight ahead.

Implements Engine::InputDevice.

Definition at line 47 of file InputDeviceAI.cpp.

void Engine::InputDeviceAI::mutate (  ) 

Add some random variance to the neural network.

Definition at line 250 of file InputDeviceAI.cpp.

void Engine::InputDeviceAI::poll (  )  [virtual]

Poll for events, if necessary.

Reimplemented from Engine::InputDevice.

Definition at line 52 of file InputDeviceAI.cpp.

void Engine::InputDeviceAI::save (  ) 

Write the neural network to a file.

Definition at line 245 of file InputDeviceAI.cpp.


Member Data Documentation

int Engine::InputDeviceAI::acceleration [private]

Definition at line 39 of file InputDeviceAI.h.

fann* Engine::InputDeviceAI::ann [private]

Definition at line 40 of file InputDeviceAI.h.

int Engine::InputDeviceAI::slide [private]

Definition at line 39 of file InputDeviceAI.h.

int Engine::InputDeviceAI::steering [private]

Definition at line 39 of file InputDeviceAI.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.