// Determine the placement of the condition public static PointF PickLocation(ManInWorld world, bool movingCondition, SizeF size) { if (movingCondition) { return(world.RandomPositionInsidePowNonCovering(m_rand, size, 1, 40)); } const int FIXED_OFFSET = 10; RectangleF powRectangle = world.GetPowGeometry(); return(new PointF(powRectangle.X + FIXED_OFFSET, powRectangle.Y + FIXED_OFFSET)); }
// Instantiates and installs the condition public ConditionGameObject(ManInWorld world, bool movingCondition, float salience) : base(Shapes.Square, PointF.Empty) { IsBitmapAsMask = true; IsWhite = LearningTaskHelpers.FlipCoin(m_rand); m_colorMask = IsWhite ? Color.White : Color.Black; float size1D = DetermineSize(salience); PointF location = PickLocation(world, movingCondition, new SizeF(size1D, size1D)); Position = location; Size.Height = Size.Width = size1D; world.AddGameObject(this); }
// True if the target is indicated by the white condition state // Instantiates and installs the target public ConditionalTarget( ManInWorld world, bool isWhiteConditionTarget, float targetSizeStandardDeviation, int numberOfDifferentObjects /*, * int degreesOfFreedom */) : base(PickShapePath(isWhiteConditionTarget, numberOfDifferentObjects)) { int size1D = GetSize(targetSizeStandardDeviation); PointF location = PickLocation(world, new SizeF(size1D, size1D) /*, degreesOfFreedom */); Position = location; Size.Height = Size.Width = size1D; world.AddGameObject(this); }
// Determine the placement of the target public static PointF PickLocation(ManInWorld world, SizeF size /*, int degreesOfFreedom */) { // TODO Currently, degrees of freedom is not taken into account // And distance to target is the same throughout the learning task return(world.RandomPositionInsidePowNonCovering(m_rand, size, 10, 22)); }