protected void CreateAgent() { WrappedWorld.CreateAgent(); m_agent = WrappedWorld.Agent; m_agent.Position.X -= m_agent.Size.Width / 2; m_agent.Position.Y -= m_agent.Size.Height / 2; }
public void GenerateObstacles() { WrappedWorld.CreateAgent(); // Generate agent m_agent = WrappedWorld.Agent; m_target = WrappedWorld.CreateTarget(new Point(0, 0)); WrappedWorld.AddGameObject(m_target); RoguelikeWorld world = WrappedWorld as RoguelikeWorld; // Reference to World Grid g = world.GetGrid(); // Get grid TSHints[TIMESTEPS_LIMIT] = 200; int widthOfRectangle = 3; int heightOfRectangle = 2; createWallRectangleWithFillProbability(world, m_rndGen, 5, 5, widthOfRectangle, heightOfRectangle, 0.8f, 1.0f); // Position agent m_agent.Position.X = 200; m_agent.Position.Y = 193; // Position target m_target.Position.X = m_rndGen.Next(160, 280); if (m_rndGen.Next(0, 2) == 0) { m_target.Position.Y = 120; } else { m_target.Position.Y = 270; } }
protected void CreateAgent() { WrappedWorld.CreateAgent(); m_agent = WrappedWorld.Agent; m_agent.Position.X = WrappedWorld.Scene.Width / 2; m_agent.Position.Y = WrappedWorld.Scene.Height / 2; }
private void CreateAgent() { WrappedWorld.CreateAgent(null); m_agent = WrappedWorld.Agent; // center the agent m_agent.Position.X = WrappedWorld.Scene.Width / 2 - m_agent.Size.Width / 2; m_agent.Position.Y = WrappedWorld.Scene.Height / 2 - m_agent.Size.Height / 2; }
public override void PresentNewTrainingUnit() { WrappedWorld.CreateAgent(); condition = new ConditionGameObject(WrappedWorld, TSHints[MOVING_CONDITION] == 1, TSHints[CONDITION_SALIENCE]); ConditionalTarget blackConditionTarget = CreateTarget(/* isWhiteConditionalTarget: */ false); ConditionalTarget whiteConditionTarget = CreateTarget(/* isWhiteConditionalTarget: */ true); dummyTarget = condition.IsWhite ? blackConditionTarget : whiteConditionTarget; rewardTarget = condition.IsWhite ? whiteConditionTarget : blackConditionTarget; stepsSincePresented = 0; initialDistance = WrappedWorld.Agent.DistanceTo(rewardTarget); }
public override void PresentNewTrainingUnit() { WrappedWorld.CreateAgent(); int numberOfTargets = (int)TSHints[NUMBER_OF_FALSE_TARGETS] + 1; int rewardTargetIndex = m_rand.Next(numberOfTargets); for (int imageIndex = 0; imageIndex < numberOfTargets; imageIndex++) { Shape aTarget = CreateTarget(imageIndex); if (rewardTargetIndex == imageIndex) { m_rewardTarget = aTarget; } } stepsSincePresented = 0; initialDistance = WrappedWorld.Agent.DistanceTo(m_rewardTarget); }
protected void CreateAgent() { m_agent = WrappedWorld.CreateAgent(); }
//Agent and target are generated in the same function, because the correspondent positions will depend on the wall positions public void GenerateObstacles() { int level = (int)TSHints[OBSTACLES_LEVEL]; // Update value of current level WrappedWorld.CreateAgent(); // Generate agent m_agent = WrappedWorld.Agent; m_target = WrappedWorld.CreateTarget(new Point(0, 0)); WrappedWorld.AddGameObject(m_target); RoguelikeWorld world = WrappedWorld as RoguelikeWorld; // Reference to World Grid g = world.GetGrid(); // Get grid if (level == 1) { TSHints[TIMESTEPS_LIMIT] = 500; int widthOfRectangle = 10; int heightOfRectangle = 5; createWallRectangle(world, widthOfRectangle, heightOfRectangle); // Position agent m_agent.Position.X = 50; m_agent.Position.Y = 50; // Position target m_target.Position.X = 280; m_target.Position.Y = 120; } if (level == 2) // Like level 1, but inverted { TSHints[TIMESTEPS_LIMIT] = 500; int widthOfRectangle = 10; int heightOfRectangle = 5; createWallRectangle(world, widthOfRectangle, heightOfRectangle); // Position agent m_agent.Position.X = 280; m_agent.Position.Y = 120; // Position target m_target.Position.X = 50; m_target.Position.Y = 50; } if (level == 3) { TSHints[TIMESTEPS_LIMIT] = 400; int widthOfRectangle = 20; int heightOfRectangle = 5; createWallRectangle(world, widthOfRectangle, heightOfRectangle); world.CreateWall(g.GetPoint(14, 4)); world.CreateWall(g.GetPoint(14, 3)); world.CreateWall(g.GetPoint(14, 2)); // Position agent m_agent.Position.X = 80; m_agent.Position.Y = 120; // Position target m_target.Position.X = 550; m_target.Position.Y = 110; } if (level == 4) { TSHints[TIMESTEPS_LIMIT] = 400; int widthOfRectangle = 20; int heightOfRectangle = 10; createWallRectangle(world, widthOfRectangle, heightOfRectangle); world.CreateWall(g.GetPoint(14, 9)); world.CreateWall(g.GetPoint(14, 8)); world.CreateWall(g.GetPoint(14, 7)); world.CreateWall(g.GetPoint(14, 6)); world.CreateWall(g.GetPoint(14, 5)); world.CreateWall(g.GetPoint(14, 4)); world.CreateWall(g.GetPoint(14, 3)); world.CreateWall(g.GetPoint(8, 1)); world.CreateWall(g.GetPoint(8, 2)); world.CreateWall(g.GetPoint(8, 3)); world.CreateWall(g.GetPoint(8, 4)); world.CreateWall(g.GetPoint(8, 5)); world.CreateWall(g.GetPoint(8, 6)); world.CreateWall(g.GetPoint(8, 7)); world.CreateWall(g.GetPoint(8, 8)); // Position agent m_agent.Position.X = 80; m_agent.Position.Y = 60; // Position target m_target.Position.X = 550; m_target.Position.Y = 250; } if (level == 5) { TSHints[TIMESTEPS_LIMIT] = 300; int widthOfRectangle = 13; int heightOfRectangle = 5; createWallRectangle(world, widthOfRectangle, heightOfRectangle); // Walls positioned randomly inside the wall rectangle createWallVerticalLine(world, 4, m_rndGen.Next(1, 3), 3); createWallVerticalLine(world, 6, m_rndGen.Next(1, 3), 3); createWallVerticalLine(world, 8, m_rndGen.Next(1, 3), 3); // Position agent m_agent.Position.X = 50; m_agent.Position.Y = 50; // Position target according to the wall rectangle that was generated with random size m_target.Position.X = 350; //m_target.Y = 110; m_target.Position.Y = m_rndGen.Next(70, 110); // Randomize Y position of target } if (level == 6) { TSHints[TIMESTEPS_LIMIT] = 260; int widthOfRectangle = 13; int heightOfRectangle = 5; createWallRectangle(world, widthOfRectangle, heightOfRectangle); // Walls positioned randomly inside the wall rectangle createWallVerticalLine(world, 4, m_rndGen.Next(1, 3), 3); createWallVerticalLine(world, 6, m_rndGen.Next(1, 3), 3); createWallVerticalLine(world, 8, m_rndGen.Next(1, 3), 3); // Position agent m_agent.Position.X = 50; m_agent.Position.Y = 50; // Position target according to the wall rectangle that was generated with random size m_target.Position.X = 350; //m_target.Y = 110; m_target.Position.Y = m_rndGen.Next(70, 110); // Randomize Y position of target } }