PendulumGame.GamePlayer Class Reference

Represents a player of the pendulum game. More...

List of all members.

Public Member Functions

 GamePlayer ()
 Default constructor.
void TrackActionIntensity ()
 Tracks action intensity by pushing it onto the stack of values.
bool ActionIntensityChanged ()
 Returns flag indicating if the action intensity has changed sufficiently.

Properties

int SelectedIndicator [get, set]
 Gets or sets the indicator selected for display.
int Points [get, set]
 Gets or sets the players score.
DoublePendulumHinges ActionMarker [get, set]
 Gets or sets the hinge to which force is applied.
double ActionIntensity [get, set]
 Gets or sets the action intensity which is applied.

Detailed Description

Represents a player of the pendulum game.

Definition at line 24 of file GamePlayer.cs.


Constructor & Destructor Documentation

PendulumGame.GamePlayer.GamePlayer (  ) 

Default constructor.

Definition at line 70 of file GamePlayer.cs.

00071         {
00072             this.selectedIndicator = 0;
00073             this.points = 0;
00074             this.actionIntensityQueue = 
00075                 new Queue<double>(ActionIntensityQueueSize);
00076             this.filter =
00077                 new ButterworthFilter(ButterworthFilterType.HighPass, 100, 20);
00078             this.detector =
00079                 new EdgeDetector(EdgeDetectionType.Rising, 0.4);
00080         }


Member Function Documentation

bool PendulumGame.GamePlayer.ActionIntensityChanged (  ) 

Returns flag indicating if the action intensity has changed sufficiently.

Returns:
True or false depending on a detected change in the action intensity.

Definition at line 167 of file GamePlayer.cs.

00168         {
00169             // Only process if we have enough samples in our queue
00170             if (this.actionIntensityQueue.Count == ActionIntensityQueueSize)
00171             {
00172                 double[] samples = this.actionIntensityQueue.ToArray();
00173 
00174                 // High-pass filter samples
00175                 double[] filteredSamples = this.filter.Calculate(samples);
00176 
00177                 // Edge-detect samples
00178                 double[] detectedSamples = this.detector.Calculate(samples);
00179 
00180                 // Return result by checking the last sample
00181                 if (detectedSamples[ActionIntensityQueueSize - 1] > 0.0)
00182                 {
00183                     return true;
00184                 }
00185             }
00186 
00187             return false;
00188         }

void PendulumGame.GamePlayer.TrackActionIntensity (  ) 

Tracks action intensity by pushing it onto the stack of values.

Definition at line 149 of file GamePlayer.cs.

00150         {
00151             // Keep queue the same size by dropping off items
00152             if (this.actionIntensityQueue.Count == ActionIntensityQueueSize)
00153             {
00154                 this.actionIntensityQueue.Dequeue();
00155             }
00156 
00157             // Add new sample
00158             this.actionIntensityQueue.Enqueue(this.actionIntensity);
00159         }


Property Documentation

double PendulumGame.GamePlayer.ActionIntensity [get, set]

Gets or sets the action intensity which is applied.

Definition at line 124 of file GamePlayer.cs.

DoublePendulumHinges PendulumGame.GamePlayer.ActionMarker [get, set]

Gets or sets the hinge to which force is applied.

Definition at line 111 of file GamePlayer.cs.

int PendulumGame.GamePlayer.Points [get, set]

Gets or sets the players score.

Definition at line 97 of file GamePlayer.cs.

int PendulumGame.GamePlayer.SelectedIndicator [get, set]

Gets or sets the indicator selected for display.

Definition at line 88 of file GamePlayer.cs.


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2