text:
package hso.autonomy.agent.model.agentmodel.impl;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
import org.junit.Before;
import org.junit.Test;

import hso.autonomy.agent.communication.action.IEffector;
import hso.autonomy.agent.communication.perception.IAccelerometerPerceptor;
import hso.autonomy.agent.communication.perception.IGyroPerceptor;
import hso.autonomy.agent.communication.perception.IHingeJointPerceptor;
import hso.autonomy.agent.communication.perception.IPerception;
import hso.autonomy.agent.model.agentmeta.IBodyPartConfiguration;
import hso.autonomy.agent.model.agentmeta.impl.AgentMetaModel;
import hso.autonomy.agent.model.agentmeta.impl.BodyPartConfiguration;
import hso.autonomy.agent.model.agentmeta.impl.HingeJointConfiguration;
import hso.autonomy.agent.model.agentmeta.impl.SensorConfiguration;
import hso.autonomy.agent.model.agentmodel.IBodyModel;
import hso.autonomy.agent.model.agentmodel.IMotor;
import hso.autonomy.util.geometry.Pose3D;

/**
 *
 * @author dorer
 */
public class BodyModelTest
{
	private BodyModel testee;

	@Before
	public void setUp() throws Exception
	{
		AgentMetaModel metaModel2 = new AgentMetaModel("name", null, new Pose3D(), 0) {
			@Override
			protected List<IBodyPartConfiguration> createBodyPartConfigs()
			{
				return getTestBodyPartConfig();
			}

			@Override
			public Map<String, IEffector> createEffectors()
			{
				return new HashMap<String, IEffector>();
			}
		};
		testee = new BodyModel(metaModel2, null);
	}

	/**
	 * Test method for
	 * {@link
	 * hso.autonomy.agent.model.agentmodel.impl.BodyModel#BodyModel(magma.agent.meta.agent.IAgentMetaModel)}
	 * .
	 */
	@Test
	public void testBodyModelIAgentMetaModel()
	{
		assertEquals("torso", testee.getTorso().getName());
		assertEquals(1, testee.getTorso().getNoOfChildren());
		assertSame(testee.getTorso().getJoint(), testee.getJoint("torso"));
		assertEquals("TorsoGyro", testee.getSensor("TorsoGyro").getName());
	}

	/**
	 * Test method for
	 * {@link
	 * hso.autonomy.agent.model.agentmodel.impl.BodyModel#BodyModel(hso.autonomy.agent.model.agentmodel.impl.BodyModel)}
	 * .
	 */
	@Test
	public void testBodyModelBodyModel()
	{
		IBodyModel copy = new BodyModel(testee);
		assertNotSame(copy.getTorso(), testee.getTorso());
		assertEquals(1, copy.getTorso().getNoOfChildren());
		assertEquals(testee.getSensor("TorsoGyro"), copy.getSensor("TorsoGyro"));
	}

	/**
	 * Test method for
	 * {@link hso.autonomy.agent.model.agentmodel.impl.BodyModel#getJoint(java.lang.String)} .
	 */
	@Test
	public void testGetJoint()
	{
		assertEquals("joint1", testee.getJoint("joint1").getName());
	}

	/**
	 * Test method for
	 * {@link
	 * hso.autonomy.agent.model.agentmodel.impl.BodyModel#generateJointActions(magma.agent.action.IAction)}
	 * .
	 */
	@Test
	public void testGenerateJointActions()
	{
		Map<String, float[]> actions = new HashMap<>();
		testee.generateJointActions(actions);
		assertEquals(1, actions.size());
		float[] values = actions.get("he1");
		assertEquals(1, actions.size());
		assertEquals(0, values[0], 0.0001);
		assertEquals(0, values[1], 0.0001);
	}

	@Test
	public void testUpdateFromPerception()
	{
		IPerception perception = mock(IPerception.class);
		IHingeJointPerceptor hingePerceptor = mock(IHingeJointPerceptor.class);
		when(hingePerceptor.getAxis()).thenReturn(20.0f);
		when(hingePerceptor.getSpeed()).thenReturn(1.0f);
		when(hingePerceptor.getLoad()).thenReturn(2.0f);
		when(hingePerceptor.getVoltage()).thenReturn(3.0f);
		when(hingePerceptor.getTemperature()).thenReturn(4.0f);
		when(hingePerceptor.getCalculatedTemperature()).thenReturn(5.0f);
		when(hingePerceptor.getCalculatedTemperatureCoil()).thenReturn(6.0f);
		when(hingePerceptor.getError()).thenReturn((byte) 7);

		IGyroPerceptor gyroPerceptor = mock(IGyroPerceptor.class);
		when(gyroPerceptor.getGyro()).thenReturn(new Vector3D(1, 2, 3));

		IAccelerometerPerceptor accPerceptor = mock(IAccelerometerPerceptor.class);
		when(accPerceptor.getAcceleration()).thenReturn(new Vector3D(1, 2, 3));

		when(perception.getHingeJointPerceptor("hj1")).thenReturn(hingePerceptor);
		when(perception.getGyroRatePerceptor("torsoGyro")).thenReturn(gyroPerceptor);
		when(perception.getAccelerationPerceptor("torsoAccel")).thenReturn(accPerceptor);

		testee.updateFromPerception(perception);

		HingeJoint hingeJoint = (HingeJoint) testee.getJoint("joint1");
		assertEquals(20.0f, hingeJoint.getAngle(), 0.0001);
		assertEquals(0.0f, hingeJoint.getNextAxisSpeed(), 0.0001);
		IMotor motor = hingeJoint.getMotor();
		assertEquals(2.0f, motor.getLoad(), 0.0001);
		assertEquals(3.0f, motor.getVoltage(), 0.0001);
		assertEquals(4.0f, motor.getTemperature(), 0.0001);
		assertEquals(5.0f, motor.getCalculatedTemperature(), 0.0001);
		assertEquals(6.0f, motor.getCalculatedTemperatureCoil(), 0.0001);
		assertEquals(7, motor.getError());
		// TODO switch these three lines on once the miraculous factor 2 in
		// performAxisPosition is removed
		// hingeJoint.performAxisPosition(25);
		// assertEquals(25.0f, hingeJoint.getAxis(), 0.0001);
		// assertEquals(5.0f, hingeJoint.getNextAxisSpeed(), 0.0001);
	}

	private List<IBodyPartConfiguration> getTestBodyPartConfig()
	{
		List<IBodyPartConfiguration> configs = new ArrayList<>();

		IBodyPartConfiguration currentConfig;

		currentConfig =
				new BodyPartConfiguration("torso", null, new Vector3D(0, 0, 0), 1.2171f, new Vector3D(0.1, 0.1, 0.18),
						null, new Vector3D(0, 0, 0), new SensorConfiguration("TorsoGyro", "torsoGyro"),
						new SensorConfiguration("TorsoAccel", "torsoAccel"), null, null);
		configs.add(currentConfig);

		currentConfig = new BodyPartConfiguration("neck", "torso", new Vector3D(0, 0, 0.09), 0.05f,
				new Vector3D(0.03, 0.03, 0.08),
				new HingeJointConfiguration("joint1", "hj1", "he1", new Vector3D(0, 0, 1), -120, 120, 7, false),
				new Vector3D(0, 0, 0), null, null, null, null);
		configs.add(currentConfig);

		return configs;
	}

	/**
	 * Test method for
	 * {@link
	 * hso.autonomy.agent.model.agentmodel.impl.BodyModel#BodyModel(hso.autonomy.agent.model.agentmodel.impl.BodyModel)}
	 * .
	 */
	@Test
	public void testUpdateJointSpeed()
	{
		BodyModel copy = new BodyModel(testee);

		HingeJoint hj1 = (HingeJoint) copy.getJoint("joint1");
		hj1.performAxisSpeed(3.0f);
		testee.updateJointsSpeed(copy);

		HingeJoint hj1Source = (HingeJoint) testee.getJoint("joint1");
		assertEquals(3.0f, hj1Source.getNextAxisSpeed(), 0.00001);
	}
}


text:
<?php
namespace michaeljamesparsons\DataImporter\Workflows;

use michaeljamesparsons\DataImporter\Readers\AbstractReader;
use michaeljamesparsons\DataImporter\Reporters\ReporterInterface;
use michaeljamesparsons\DataImporter\Reporters\Report;
use michaeljamesparsons\DataImporter\Writers\AbstractWriter;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

/**
 * Class AbstractWorkflow
 * @package michaeljamesparsons\DataImporter\Workers
 */
abstract class AbstractWorkflow implements LoggerAwareInterface
{
    /** @var  array */
    protected $writers;

    /** @var  array */
    protected $readers;

    /** @var  LoggerAwareInterface */
    protected $logger;

    /** @var  ReporterInterface */
    protected $reporter;

    /** @var bool */
    protected $skipRecordOnError;

    /**
     * AbstractWorkflow constructor.
     */
    public function __construct()
    {
        $this->readers           = [];
        $this->writers           = [];
        $this->skipRecordOnError = true;

        /**
         * Logging is optional. By default, the NullLogger is used so that all log requests are thrown away.
         * You can set a logger to enable this feature using the setLogger() method.
         */
        $this->logger = new NullLogger();

        /**
         * This is the default reporter. For additional flexibility, you can set your own reporter using the
         * setReporter() method.
         */
        $this->reporter = new Report();
    }

    /**
     * @param bool $skip
     *
     * @return $this
     */
    public function skipRecordOnError($skip = true)
    {
        $this->skipRecordOnError = $skip;

        return $this;
    }

    /**
     * @param AbstractReader $reader
     *
     * @return $this
     */
    public function addReader(AbstractReader $reader)
    {
        $this->readers[] = $reader;

        return $this;
    }

    /**
     * @param AbstractWriter $writer
     *
     * @return $this
     */
    public function addWriter(AbstractWriter $writer)
    {
        $this->writers[] = $writer;

        return $this;
    }

    /**
     * @param LoggerInterface $logger
     * @return $this
     */
    public function setLogger(LoggerInterface $logger)
    {
        $this->logger = $logger;

        return $this;
    }

    /**
     * @param ReporterInterface $reporter
     * @return $this
     */
    public function setReporter(ReporterInterface $reporter)
    {
        $this->reporter = $reporter;

        return $this;
    }

    /**
     * Imports the data from each reader into the writers and returns a report when complete.
     *
     * @return Report
     */
    protected abstract function process();
}

redpajama_set_name: RedPajamaGithub


text:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/start"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="全屏广告" />

            <Button
                android:id="@+id/video_ad"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="视频广告" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/banner"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="显示banner广告" />

            <Button
                android:id="@+id/close_banner"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="关闭banner广告" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/bill"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="应用内支付" />

            <Button
                android:id="@+id/more"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="更多游戏推广界面" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/native_1"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="native 1"
                android:visibility="gone" />

            <Button
                android:id="@+id/share"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="facebook分享" />

            <Button
                android:id="@+id/like"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="facebook点赞" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/login"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="登陆facebook账户" />

            <Button
                android:id="@+id/logout"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="退出facebook账户" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/invite"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="邀请facebook好友" />

            <Button
                android:id="@+id/challenge"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="向facebook好友发起挑战" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/me"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="获取我的facebook个人信息" />

            <Button
                android:id="@+id/friends"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="获取我的facebook朋友列表" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/islogin"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="facebook账户是否登陆?" />

            <Button
                android:id="@+id/test_umeng"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="测试友盟统计" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="gone">

            <Button
                android:id="@+id/submit_score"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="submit score" />

            <Button
                android:id="@+id/load_friend"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="load friends" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:visibility="gone">

            <Button
                android:id="@+id/load_global"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="load global" />

            <Button
                android:id="@+id/show_sales"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="show sales" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <Button
                android:id="@+id/show_gdpr"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="onClick"
                android:text="reset GDPR" />

        </LinearLayout>
    </LinearLayout>

</ScrollView>


text:
var creep_work5 = {

    /** @param {Creep} creep **/
    run: function(creep) {

        /*if (creep.carry.energy > 0 && creep.memory.priority != 'miner' && creep.memory.priority != 'minerNearDeath') {
            //All creeps check for road under them and repair if needed.
            var someStructure = creep.pos.lookFor(LOOK_STRUCTURES);
            if (someStructure.length && (someStructure[0].hitsMax - someStructure[0].hits >= 600) && someStructure[0].structureType == STRUCTURE_ROAD) {
                creep.repair(someStructure[0]);
            }
        }*/

        switch (creep.memory.priority) {
            case 'mule':
            case 'muleNearDeath':
                if (creep.ticksToLive <= creep.memory.deathWarn && creep.memory.priority != 'muleNearDeath') {
                    creep.memory.priority = 'muleNearDeath';
                }

                if (_.sum(creep.carry) <= 15) {
                    creep.memory.structureTarget = undefined;
                    let linkTarget = undefined;
                    if (creep.memory.linkSource) {
                        linkTarget = Game.getObjectById(creep.memory.linkSource)
                    }
                    if (linkTarget && linkTarget.energy >= 600) {
                        if (creep.withdraw(linkTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                            creep.travelTo(linkTarget, {
                                ignoreRoads: true
                            });
                        }
                    } else {
                        let storageTarget = creep.room.storage;
                        if (creep.room.terminal && storageTarget.store[RESOURCE_ENERGY] < 100000 && creep.room.terminal.store[RESOURCE_ENERGY] > 0) {
                            storageTarget = creep.room.terminal;
                        } else if (creep.room.terminal && storageTarget.store[RESOURCE_ENERGY] < 250000 && creep.room.terminal.store[RESOURCE_ENERGY] > 31000) {
                            storageTarget = creep.room.terminal;
                        }
                        if (storageTarget) {
                            if (storageTarget.store[RESOURCE_ENERGY] >= 50) {
                                //Get from container
                                if (creep.withdraw(storageTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                    creep.travelTo(storageTarget, {
                                        maxRooms: 1
                                    });
                                }
                            } else {
                                var spawnTarget = Game.getObjectById(creep.memory.fromSpawn);
                                if (spawnTarget) {
                                    if (!creep.pos.isNearTo(spawnTarget)) {
                                        creep.travelTo(spawnTarget, {
                                            maxRooms: 1
                                        });
                                    }
                                }
                            }
                        }
                    }
                } else {
                    if (creep.carry[RESOURCE_ENERGY] == 0) {
                        if (creep.room.terminal) {
                            var currentlyCarrying = _.findKey(creep.carry);
                            if (creep.transfer(creep.room.terminal, currentlyCarrying) == ERR_NOT_IN_RANGE) {
                                creep.travelTo(creep.room.terminal, {
                                    maxRooms: 1
                                });
                            }
                        } else if (!creep.room.terminal && creep.room.storage) {
                            var currentlyCarrying = _.findKey(creep.carry);
                            if (creep.transfer(creep.room.storage, currentlyCarrying) == ERR_NOT_IN_RANGE) {
                                creep.travelTo(creep.room.storage, {
                                    maxRooms: 1
                                });
                            }
                        }
                    } else {
                        var savedTarget = Game.getObjectById(creep.memory.structureTarget)
                        var getNewStructure = false;
                        if (savedTarget) {
                            if (creep.build(savedTarget) == ERR_INVALID_TARGET) {
                                //Only other blocker is build.
                                creep.repair(savedTarget);

                                if (savedTarget.structureType != STRUCTURE_CONTAINER && savedTarget.structureType != STRUCTURE_STORAGE && savedTarget.structureType != STRUCTURE_CONTROLLER) {
                                    //Storing in spawn/extension/tower/link
                                    if (creep.transfer(savedTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE && savedTarget.energy < savedTarget.energyCapacity) {
                                        creep.travelTo(savedTarget, {
                                            maxRooms: 1
                                        });
                                    } else {
                                        //assumed OK, drop target
                                        creep.memory.structureTarget = undefined;
                                        getNewStructure = true;
                                    }
                                } else {
                                    //Upgrading controller
                                    if (Memory.linkList[creep.room.name].length > 1) {
                                        var upgraderLink = Game.getObjectById(Memory.linkList[creep.room.name][1]);
                                        if (upgraderLink && upgraderLink.energy < 100) {
                                            if (creep.transfer(upgraderLink, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                                creep.travelTo(upgraderLink, {
                                                    maxRooms: 1
                                                });
                                            }
                                        } else if (creep.upgradeController(savedTarget) == ERR_NOT_IN_RANGE) {
                                            if (Game.flags[creep.room.name + "Controller"]) {
                                                creep.travelTo(Game.flags[creep.room.name + "Controller"], {
                                                    maxRooms: 1
                                                });
                                            } else {
                                                creep.travelTo(savedTarget, {
                                                    maxRooms: 1
                                                });
                                            }
                                        }
                                    }
                                }
                            } else {
                                let bResult = creep.build(savedTarget);
                                if (bResult == ERR_NOT_IN_RANGE) {
                                    creep.travelTo(savedTarget, {
                                        maxRooms: 1
                                    });
                                } else if (bResult != OK) {
                                    creep.memory.structureTarget = undefined;
                                } else if (savedTarget.structureType == STRUCTURE_RAMPART) {
                                    //Become a repair drone
                                    creep.memory.priority = 'repair';
                                    creep.memory.previousPriority = 'mule';
                                    Memory.repairTarget[creep.room.name] = undefined;
                                }
                            }
                        } else {
                            creep.memory.structureTarget = undefined;
                        }
                        //Immediately find a new target if previous transfer worked
                        if (!creep.memory.structureTarget) {
                            var targets = undefined;
                            if (Memory.warMode) {
                                if (getNewStructure) {
                                    targets = creep.pos.findClosestByPath(FIND_STRUCTURES, {
                                        filter: (structure) => {
                                            return (structure.structureType == STRUCTURE_EXTENSION ||
                                                structure.structureType == STRUCTURE_SPAWN ||
                                                structure.structureType == STRUCTURE_LAB) && structure.energy < structure.energyCapacity && structure.id != savedTarget.id;
                                        }
                                    });
                                } else {
                                    targets = creep.pos.findClosestByPath(FIND_STRUCTURES, {
                                        filter: (structure) => {
                                            return (structure.structureType == STRUCTURE_EXTENSION ||
                                                structure.structureType == STRUCTURE_SPAWN ||
                                                structure.structureType == STRUCTURE_LAB) && structure.energy < structure.energyCapacity;
                                        }
                                    });
                                }
                            } else {
                                if (getNewStructure) {
                                    targets = creep.pos.findClosestByPath(FIND_STRUCTURES, {
                                        filter: (structure) => {
                                            return (structure.structureType == STRUCTURE_EXTENSION ||
                                                structure.structureType == STRUCTURE_SPAWN ||
                                                structure.structureType == STRUCTURE_LAB) && structure.energy < structure.energyCapacity && structure.id != savedTarget.id;
                                        }
                                    });
                                } else {
                                    targets = creep.pos.findClosestByPath(FIND_STRUCTURES, {
                                        filter: (structure) => {
                                            return (structure.structureType == STRUCTURE_EXTENSION ||
                                                structure.structureType == STRUCTURE_SPAWN ||
                                                structure.structureType == STRUCTURE_LAB) && structure.energy < structure.energyCapacity;
                                        }
                                    });
                                }
                            }

                            if (targets) {
                                creep.memory.structureTarget = targets.id;
                                if (getNewStructure) {
                                    creep.travelTo(targets, {
                                        maxRooms: 1
                                    });
                                } else if (creep.transfer(targets, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                    creep.travelTo(targets, {
                                        maxRooms: 1
                                    });
                                } else {
                                    creep.memory.structureTarget = undefined;
                                }
                            } else {
                                //Store in terminal
                                let terminalTarget = Game.getObjectById(creep.memory.terminalID)
                                if (terminalTarget) {
                                    let targetEnergy = 0;
                                    if (creep.room.storage) {
                                        if (creep.room.storage.store[RESOURCE_ENERGY] >= 275000) {
                                            targetEnergy = 60000;
                                        } else if (creep.room.storage.store[RESOURCE_ENERGY] >= 50000) {
                                            targetEnergy = 30000;
                                        }
                                    }
                                    if (terminalTarget.store[RESOURCE_ENERGY] < targetEnergy && terminalTarget.store.getFreeCapacity() > 5000) {
                                        creep.memory.structureTarget = terminalTarget.id;
                                        if (creep.transfer(terminalTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                            creep.travelTo(terminalTarget, {
                                                maxRooms: 1
                                            });
                                        }
                                    } else {
                                        terminalTarget = undefined;
                                    }
                                }

                                if (!terminalTarget) {
                                    //Store in factory
                                    let factoryTarget = undefined;
                                    if (Memory.factoryList[creep.room.name]) {
                                        factoryTarget = Game.getObjectById(Memory.factoryList[creep.room.name][0]);
                                    }
                                    if (factoryTarget && factoryTarget.store[RESOURCE_ENERGY] < 10000 && factoryTarget.store.getFreeCapacity() >= creep.store[RESOURCE_ENERGY]) {
                                        creep.memory.structureTarget = Memory.factoryList[creep.room.name][0];
                                        if (creep.transfer(factoryTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                            creep.travelTo(factoryTarget, {
                                                maxRooms: 1
                                            });
                                        }
                                    } else {
                                        factoryTarget = undefined;
                                    }

                                    if (!factoryTarget) {
                                        var targets2;
                                        if (creep.room.controller.level == 8) {
                                            targets2 = creep.pos.findClosestByRange(FIND_STRUCTURES, {
                                                filter: (structure) => {
                                                    return (structure.structureType == STRUCTURE_POWER_SPAWN ||
                                                        structure.structureType == STRUCTURE_NUKER) && structure.energy < structure.energyCapacity;
                                                }
                                            });
                                        }
                                        if (targets2) {
                                            creep.memory.structureTarget = targets2.id;
                                            if (creep.transfer(targets2, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                                creep.travelTo(targets2, {
                                                    maxRooms: 1
                                                });
                                            } else {
                                                creep.memory.structureTarget = undefined;
                                            }
                                        } else {
                                            //Build
                                            targets2 = creep.pos.findClosestByRange(FIND_CONSTRUCTION_SITES);
                                            if (targets2) {
                                                creep.memory.structureTarget = targets2.id;
                                                let buildResult = creep.build(targets2)
                                                if (buildResult == ERR_NOT_IN_RANGE) {
                                                    creep.travelTo(targets2, {
                                                        maxRooms: 1
                                                    });
                                                } else if (buildResult == ERR_NO_BODYPART) {
                                                    creep.suicide();
                                                } else if (targets2.structureType == STRUCTURE_RAMPART && buildResult == OK) {
                                                    //Change job to repair, reset room repair target.
                                                    creep.memory.priority = 'repair';
                                                    creep.memory.previousPriority = 'mule';
                                                    Memory.repairTarget[creep.room.name] = undefined;
                                                }
                                            } else {
                                                //Upgrade
                                                if (creep.room.controller.level == 8) {
                                                    //Check for nearby link and fill it if possible.
                                                    if (Memory.linkList[creep.room.name].length > 1) {
                                                        var upgraderLink = Game.getObjectById(Memory.linkList[creep.room.name][1]);
                                                        if (upgraderLink && upgraderLink.energy < 200) {
                                                            creep.memory.structureTarget = upgraderLink.id;
                                                            if (creep.transfer(upgraderLink, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                                                creep.travelTo(upgraderLink, {
                                                                    maxRooms: 1
                                                                });
                                                            }
                                                        } else {
                                                            //Turn into a repair worker temporarily
                                                            creep.memory.priority = 'repair';
                                                            creep.memory.previousPriority = 'mule';
                                                        }
                                                    }
                                                } else {
                                                    creep.memory.structureTarget = creep.room.controller.id;
                                                    if (creep.upgradeController(creep.room.controller) == ERR_NOT_IN_RANGE) {
                                                        if (Game.flags[creep.room.name + "Controller"]) {
                                                            creep.travelTo(Game.flags[creep.room.name + "Controller"], {
                                                                maxRooms: 1
                                                            });
                                                        } else {
                                                            creep.travelTo(creep.room.controller, {
                                                                maxRooms: 1
                                                            });
                                                        }
                                                    } else if (creep.upgradeController(creep.room.controller) == ERR_NO_BODYPART) {
                                                        creep.suicide();
                                                    }
                                                }
                                            } //targets2
                                        } //FactoryTarget
                                    } //TerminalTarget
                                } //targets
                            } //structureTarget
                        } //carry energy check
                    } //storage target check
                } //carry check
                break;
            case 'distributor':
            case 'distributorNearDeath':
                if (creep.ticksToLive <= creep.memory.deathWarn && creep.memory.priority != 'distributorNearDeath') {
                    creep.memory.priority = 'distributorNearDeath';
                }

                if (creep.memory.previousPriority == 'labWorker' && Game.time >= creep.memory.nextResourceCheck && Game.flags[creep.memory.primaryFlag] && creep.memory.lab4) {
                    DoResourceCheck(creep);
                }

                if (_.sum(creep.carry) <= 0) {
                    if (creep.memory.previousPriority == 'labWorker' && creep.memory.hasDistributed) {
                        creep.memory.priority = 'labWorker';
                        break;
                    }
                    creep.memory.structureTarget = undefined;
                    //Get from storage
                    //Look for dropped energy to use
                    let locatedTarget = false;
                    if (creep.memory.groundEnergy) {
                        let groundTarget = Game.getObjectById(creep.memory.groundEnergy)
                        if (groundTarget) {
                            if (creep.pickup(target) == ERR_NOT_IN_RANGE) {
                                creep.travelTo(groundTarget, {
                                    ignoreRoads: true
                                });
                                locatedTarget = true;
                            } else {
                                creep.memory.groundEnergy = undefined;
                            }
                        } else {
                            creep.memory.groundEnergy = undefined;
                        }
                    }
                    if (!locatedTarget && Memory.roomsUnderAttack.indexOf(creep.room.name) === -1) {
                        let groundItems = creep.pos.findInRange(FIND_DROPPED_RESOURCES, 10, {
                            filter: {
                                resourceType: RESOURCE_ENERGY
                            }
                        });
                        if (groundItems.length > 0) {
                            if (creep.pickup(groundItems[0]) == ERR_NOT_IN_RANGE) {
                                creep.travelTo(groundItems[0], {
                                    ignoreRoads: true
                                });
                                creep.memory.groundEnergy = groundItems[0].id;
                                locatedTarget = true;
                            }
                        }
                    }
                    if (!locatedTarget) {
                        //Check 4th link first just in case
                        var linkTarget = undefined;
                        if (creep.memory.linkSource) {
                            linkTarget = Game.getObjectById(creep.memory.linkSource)
                        }
                        if (linkTarget && linkTarget.energy >= 600) {
                            if (creep.withdraw(linkTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                creep.travelTo(linkTarget, {
                                    ignoreRoads: true
                                });
                            }
                        } else {
                            var storageTarget = creep.room.storage;
                            if (creep.room.terminal && storageTarget.store[RESOURCE_ENERGY] < 100000 && creep.room.terminal.store[RESOURCE_ENERGY] > 0) {
                                storageTarget = creep.room.terminal;
                            } else if (creep.room.terminal && storageTarget.store[RESOURCE_ENERGY] < 250000 && creep.room.terminal.store[RESOURCE_ENERGY] > 31000) {
                                storageTarget = creep.room.terminal;
                            }
                            if (storageTarget) {
                                if (creep.withdraw(storageTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                    creep.travelTo(storageTarget, {
                                        ignoreRoads: true
                                    });
                                }
                            }
                        }
                    }
                } else if (creep.room.energyAvailable < creep.room.energyCapacityAvailable) {
                    if (creep.memory.previousPriority == 'labWorker' && !creep.memory.hasDistributed) {
                        creep.memory.hasDistributed = true;
                    }
                    var savedTarget = Game.getObjectById(creep.memory.structureTarget);
                    var getNewStructure = false;
                    if (savedTarget && savedTarget.energy < savedTarget.energyCapacity) {
                        if (creep.transfer(savedTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                            creep.travelTo(savedTarget);
                        } else {
                            getNewStructure = true;
                            creep.memory.structureTarget = undefined;
                        }
                    } else if (savedTarget) {
                        getNewStructure = true;
                        creep.memory.structureTarget = undefined;
                    }
                    if (!creep.memory.structureTarget) {
                        var target = undefined;
                        if (getNewStructure) {
                            target = creep.pos.findClosestByPath(FIND_STRUCTURES, {
                                filter: (structure) => {
                                    return (structure.structureType == STRUCTURE_EXTENSION ||
                                        structure.structureType == STRUCTURE_SPAWN || structure.structureType == STRUCTURE_LAB) && structure.energy < structure.energyCapacity && structure.id != savedTarget.id;
                                }
                            });
                        } else {
                            target = creep.pos.findClosestByPath(FIND_STRUCTURES, {
                                filter: (structure) => {
                                    return (structure.structureType == STRUCTURE_EXTENSION ||
                                        structure.structureType == STRUCTURE_SPAWN || structure.structureType == STRUCTURE_LAB) && structure.energy < structure.energyCapacity;
                                }
                            });
                        }
                        if (!target) {
                            //Find closest by path will not return anything if path is blocked
                            if (getNewStructure) {
                                target = creep.pos.findClosestByRange(FIND_STRUCTURES, {
                                    filter: (structure) => {
                                        return (structure.structureType == STRUCTURE_EXTENSION ||
                                            structure.structureType == STRUCTURE_SPAWN || structure.structureType == STRUCTURE_LAB) && structure.energy < structure.energyCapacity && structure.id != savedTarget.id;
                                    }
                                });
                            } else {
                                target = creep.pos.findClosestByRange(FIND_STRUCTURES, {
                                    filter: (structure) => {
                                        return (structure.structureType == STRUCTURE_EXTENSION ||
                                            structure.structureType == STRUCTURE_SPAWN || structure.structureType == STRUCTURE_LAB) && structure.energy < structure.energyCapacity;
                                    }
                                });
                            }
                        }

                        if (target) {
                            if (getNewStructure) {
                                creep.travelTo(target);
                                creep.memory.structureTarget = target.id;
                            } else if (creep.transfer(target, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                creep.travelTo(target);
                                creep.memory.structureTarget = target.id;
                            }
                        }
                    }
                } else if (Memory.roomsUnderAttack.indexOf(creep.room.name) == -1 && creep.room.terminal && creep.room.storage && creep.room.storage.store[RESOURCE_ENERGY] < 250000 && creep.room.terminal.store[RESOURCE_ENERGY] > 31000) {
                    //Being supplied, drop in storage
                    if (creep.memory.previousPriority == 'labWorker' && !creep.memory.hasDistributed) {
                        creep.memory.hasDistributed = true;
                    }
                    if (creep.transfer(creep.room.storage, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                        creep.travelTo(creep.room.storage);
                    }
                } else if (creep.room.controller.level != 8 && Memory.linkList[creep.room.name].length > 1) {
                    if (creep.memory.previousPriority == 'labWorker' && !creep.memory.hasDistributed) {
                        creep.memory.hasDistributed = true;
                    }
                    var upLink = Game.getObjectById(Memory.linkList[creep.room.name][1])
                    if (upLink) {
                        if (creep.transfer(upLink, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                            creep.travelTo(upLink);
                        }
                    }
                } else if (_.sum(creep.carry) < creep.carryCapacity) {
                    if (creep.memory.previousPriority == 'labWorker' && !creep.memory.hasDistributed) {
                        creep.memory.hasDistributed = true;
                    }
                    //Get from storage
                    //Check 4th link first just in case
                    var linkTarget = undefined;
                    if (creep.memory.linkSource) {
                        linkTarget = Game.getObjectById(creep.memory.linkSource)
                    }
                    if (linkTarget && linkTarget.energy >= 600) {
                        if (creep.withdraw(linkTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                            creep.travelTo(linkTarget);
                        }
                    } else {
                        var storageTarget = creep.room.storage;
                        if (creep.room.terminal && storageTarget.store[RESOURCE_ENERGY] < 100000 && creep.room.terminal.store[RESOURCE_ENERGY] > 0) {
                            storageTarget = creep.room.terminal;
                        } else if (creep.room.terminal && storageTarget.store[RESOURCE_ENERGY] < 250000 && creep.room.terminal.store[RESOURCE_ENERGY] > 31000) {
                            storageTarget = creep.room.terminal;
                        }
                        if (storageTarget) {
                            if (creep.withdraw(storageTarget, RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                                creep.travelTo(storageTarget);
                            }
                        }
                    }
                } else {
                    if (creep.memory.previousPriority == 'labWorker' && !creep.memory.hasDistributed) {
                        creep.memory.hasDistributed = true;
                    }
                    var homeSpawn = Game.getObjectById(creep.memory.fromSpawn)
                    if (homeSpawn) {
                        if (!creep.pos.isNearTo(homeSpawn)) {
                            creep.travelTo(homeSpawn);
                        } else {
                            //Make sure you're not in the way
                            let talkingCreeps = creep.pos.findInRange(FIND_MY_CREEPS, 1, {
                                filter: (thisCreep) => (creep.id != thisCreep.id && thisCreep.saying)
                            })
                            if (talkingCreeps.length) {
                                let coords = talkingCreeps[0].saying.split(";");
                                if (coords.length == 2 && creep.pos.x == parseInt(coords[0]) && creep.pos.y == parseInt(coords[1])) {
                                    //Standing in the way of a creep
                                    let thisDirection = creep.pos.getDirectionTo(talkingCreeps[0].pos);
                                    creep.move(thisDirection);
                                    creep.say("\uD83D\uDCA6", true);
                                }
                            }
                        }
                    }
                }
                break;
            case 'mineralMiner':
            case 'mineralMinerNearDeath':
                if (creep.ticksToLive <= creep.memory.deathWarn && creep.memory.priority != 'mineralMinerNearDeath') {
                    creep.memory.priority = 'mineralMinerNearDeath';
                }

                let thisMineral = Game.getObjectById(creep.memory.mineralID);

                if (thisMineral.mineralAmount == 0 && creep.memory.onPoint) {
                    //Nothing left to do
                    creep.suicide();
                } else if (Game.time >= creep.memory.nextMine) {
                	if (creep.memory.storageUnit && Game.getObjectById(creep.memory.storageUnit) && Game.getObjectById(creep.memory.storageUnit).store.getFreeCapacity() < 40) {
                		//skip and wait until room is made
                		creep.say("\u2716\uFE0F", false);
                	} else {
                		let harvestResult = creep.harvest(thisMineral);
	                    if (harvestResult == ERR_NOT_IN_RANGE) {
	                        creep.travelTo(thisMineral);
	                        if (!creep.memory.travelDistance && creep.memory._trav && creep.memory._trav.path) {
	                            creep.memory.travelDistance = creep.memory._trav.path.length;
	                            creep.memory.deathWarn = ((creep.memory.travelDistance * 2) + _.size(creep.body) * 3) + 15;
	                        }
	                    } else if (harvestResult == OK) {
	                        creep.memory.nextMine = Game.time + 6;
	                        if (!creep.memory.storageUnit) {
	                            let containers = thisMineral.pos.findInRange(FIND_STRUCTURES, 1, {
	                                filter: (structure) => structure.structureType == STRUCTURE_CONTAINER
	                            });
	                            if (containers.length) {
	                                if (creep.pos != containers[0].pos) {
	                                    creep.travelTo(containers[0]);
	                                } else {
	                                    creep.memory.onPoint = true;
	                                }
	                                creep.memory.storageUnit = containers[0].id;
	                            } else {
	                                let sites = thisMineral.pos.findInRange(FIND_CONSTRUCTION_SITES, 1)
	                                if (!sites.length) {
	                                    //Create new container
	                                    creep.room.createConstructionSite(creep.pos.x, creep.pos.y, STRUCTURE_CONTAINER);
	                                }
	                            }
	                        } else if (!creep.memory.onPoint) {
	                            let thisContainer = Game.getObjectById(creep.memory.storageUnit);
	                            if (thisContainer && creep.pos != thisContainer.pos) {
	                                creep.travelTo(thisContainer);
	                            } else if (thisContainer && creep.pos == thisContainer.pos) {
	                                creep.memory.onPoint = true;
	                            } else {
	                                creep.memory.storageUnit = undefined;
	                                creep.memory.onPoint = false;
	                            }
	                        }
	                    }
                	}
                }
                break;
        }
    }
};

module.exports = creep_work5;

function repairCompare(a, b) {
    if (a.hits < b.hits)
        return -1;
    if (a.hits > b.hits)
        return 1;
    return 0;
}

function orderPriceCompareBuying(a, b) {
    if (a.price < b.price)
        return -1;
    if (a.price > b.price)
        return 1;
    return 0;
}

function DoResourceCheck(creep) {
    creep.memory.nextResourceCheck = Game.time + 50;
    if (creep.memory.resourceChecks < 15) {
        var lab4 = Game.getObjectById(creep.memory.lab4);
        var lab5 = Game.getObjectById(creep.memory.lab5);
        if (creep.room.terminal && creep.room.terminal.store[creep.memory.mineral6] >= 40000) {
            //Immediately swap flags
            creep.memory.resourceChecks = 15;
            if (creep.memory.mineral5 == RESOURCE_CATALYST && creep.memory.mineral6 != RESOURCE_CATALYZED_GHODIUM_ACID) {
                //If producing something with catalyst, make an order.
                var foundOrder = _.findKey(Game.market.orders, {
                    'roomName': creep.room.name,
                    'resourceType': creep.memory.mineral6
                });
                if (foundOrder) {
                    //Update quantity if less than 40000
                    var thisOrder = Game.market.orders[foundOrder];
                    if (thisOrder.remainingAmount < 40000) {
                        var comparableOrders = Game.market.getAllOrders(order => order.resourceType == creep.memory.mineral6 && order.type == ORDER_SELL);
                        if (comparableOrders.length > 0) {
                            comparableOrders.sort(orderPriceCompareBuying);
                            var targetPrice = comparableOrders[0].price;
                            if (Memory.RoomsAt5.indexOf(comparableOrders[0].roomName) == -1) {
                                //Not competing with self, undercut!
                                if ((thisOrder.price - 0.5) > targetPrice) {
                                    targetPrice = thisOrder.Price
                                } else {
                                    targetPrice = targetPrice - 0.001
                                }
                            }
                            //Regardless of everything, never dip below 1.
                            if (targetPrice < 0.5) {
                                targetPrice = 0.5
                            }
                            Game.market.changeOrderPrice(foundOrder, targetPrice);
                            Game.market.extendOrder(foundOrder, creep.room.terminal.store[creep.memory.mineral6] - thisOrder.remainingAmount);
                        } else {
                            if (thisOrder.price < 0.5) {
                                Game.market.changeOrderPrice(foundOrder, 0.5);
                            }
                            Game.market.extendOrder(foundOrder, creep.room.terminal.store[creep.memory.mineral6] - thisOrder.remainingAmount);
                        }
                    } else {
                        //Keep prices up to date
                        var comparableOrders = Game.market.getAllOrders(order => order.resourceType == creep.memory.mineral6 && order.type == ORDER_SELL);
                        if (comparableOrders.length > 0) {
                            comparableOrders.sort(orderPriceCompareBuying);
                            var targetPrice = comparableOrders[0].price;
                            if (Memory.RoomsAt5.indexOf(comparableOrders[0].roomName) == -1) {
                                //Not competing with self, undercut!
                                if ((thisOrder.price - 0.5) > targetPrice) {
                                    targetPrice = thisOrder.Price
                                } else {
                                    targetPrice = targetPrice - 0.001
                                }
                            }
                            //Regardless of everything, never dip below 1.
                            if (targetPrice < 0.5) {
                                targetPrice = 0.5
                            }
                            Game.market.changeOrderPrice(foundOrder, targetPrice);
                        }
                    }
                } else {
                    //Create new order, 0.001 less than lowest comperable order
                    var comparableOrders = Game.market.getAllOrders(order => order.resourceType == creep.memory.mineral6 && order.type == ORDER_SELL);
                    if (comparableOrders.length > 0) {
                        comparableOrders.sort(orderPriceCompareBuying);
                        var targetPrice = comparableOrders[0].price;
                        if (Memory.RoomsAt5.indexOf(comparableOrders[0].roomName) == -1) {
                            //Not competing with self, undercut!
                            targetPrice = targetPrice - 0.001
                        }
                        //Regardless of everything, never dip below 1.
                        if (targetPrice < 0.5) {
                            targetPrice = 0.5
                        }
                        Game.market.createOrder(ORDER_SELL, creep.memory.mineral6, targetPrice, creep.room.terminal.store[creep.memory.mineral6], creep.room.name);
                    }
                }
            }
            //Game.notify('PRODUCTION MAXED: ' + creep.room.name + ' has swapped off ' + creep.memory.primaryFlag + ' New Target : ' + creep.memory.backupFlag);
        } else if (lab4 && lab5 && (lab4.mineralAmount < creep.carryCapacity || lab5.mineralAmount < creep.carryCapacity)) {
            //tick up, but don't swap yet
            creep.memory.resourceChecks = creep.memory.resourceChecks + 1;
            if (creep.memory.resourceChecks >= 15) {
                //Game.notify('NO MATERIALS:' + creep.room.name + ' has swapped off ' + creep.memory.primaryFlag + ' New Target : ' + creep.memory.backupFlag);
            }
        }
    } else {
        //Still can't find resources, switch flags
        if (!Game.flags[creep.memory.backupFlag] && Game.flags[creep.memory.primaryFlag]) {
            creep.room.createFlag(Game.flags[creep.memory.primaryFlag].pos, creep.memory.backupFlag, COLOR_CYAN);
            Game.flags[creep.memory.primaryFlag].remove();
        } else if (Game.flags[creep.memory.backupFlag] && Game.flags[creep.memory.primaryFlag]) {
            //Just in case
            Game.flags[creep.memory.primaryFlag].remove();
        }
    }
}


text:
package com.amazonaws.services.networkfirewall.model.transform;

import java.math.*;

import javax.annotation.Generated;

import com.amazonaws.services.networkfirewall.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;

import static com.fasterxml.jackson.core.JsonToken.*;

/**
 * PutResourcePolicyResult JSON Unmarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class PutResourcePolicyResultJsonUnmarshaller implements Unmarshaller<PutResourcePolicyResult, JsonUnmarshallerContext> {

    public PutResourcePolicyResult unmarshall(JsonUnmarshallerContext context) throws Exception {
        PutResourcePolicyResult putResourcePolicyResult = new PutResourcePolicyResult();

        return putResourcePolicyResult;
    }

    private static PutResourcePolicyResultJsonUnmarshaller instance;

    public static PutResourcePolicyResultJsonUnmarshaller getInstance() {
        if (instance == null)
            instance = new PutResourcePolicyResultJsonUnmarshaller();
        return instance;
    }
}


text:
---
layout: post
title:  "Como Crear un Archivo Robots.txt"
date:   2016-02-24 07:40:00
categories: seo
tumblr_id: articulo-05
photo_url : "/assets/images/portadas/robots.txt.jpg"
description: "Crear un archivo robots.txt sirve para poder controlar, a que partes de tu sitio web, no quieres que accedan los rastreadores como (Googlebot, Googlebot-Image)"
---

Crear un archivo **robot** sirve para poder controlar, a que partes de tu sitio web, no quieres que accedan los rastreadores como (Googlebot, Googlebot-Image).

Cabe recalcar que este tutorial esta enfocado en gran mayoría o quizá al 100% en los rastreadores de Google.

En este tutorial vamos a crear un archivo de tipo **txt** con el nombre **robots.txt**, ahí detallaremos para que sirve cada linea de código.

Podemos utilizar cualquier editor de código o texto yo los recomiendo Sublime Text, ya que es mi favorito.

El archivo **robots.txt** se incluirá en la raíz del proyecto para que funcione correctamente.

A continuación algunos de los comandos para el archivo de tipo **robots.txt**.

```TeX
#LISTA DE SPIDERS http://www.robotstxt.org/db.html
#Robots de Google: https://support.google.com/webmasters/answer/1061943

#Usar comodín (*): esta regla se cumplirá para todos los rastreadores
User-agent: *
...

#Formato para declarar las reglas a cumplirse, para los diferentes rastreadores de Google
#Primero
User-agent: #nombre del rastreador (Robot) o (*)
#Segundo: por ejemplo bloquearemos una carpeta
Disallow: /recursos/
...
#fin

#Permitir el rastreo de todo el contenido del sitio
User-agent: *
Disallow:

o

User-agent: *
Allow: /

#Impedir el rastreo de todos los robots rastreadores
User-agent: *
Disallow: /

#Impedir el rastreo de una carpeta específica, para todos los robots rastreadores
User-agent: *
Disallow: /privado/

#Impedir el rastreo de algunas partes del sitio
User-agent: *
Disallow: /calendar/
Disallow: /junk/

#Impedir el rastreo de una página para Googlebot
User-agent: Googlebot
Disallow: /página_privada.html

#Los rastreadores de robot de Google no deben rastrear el directorio http://ejemplo.com/nogooglebot/
User-agent: Googlebot
Disallow: /nogooglebot/

#Ningún rastreador debe rastrear el directorio http://ejemplo.com/onlygooglebot/ y todas las URL incluidas.
User-agent: *
Disallow: /onlygooglebot/

#Impedir el rastreo de una imagen específica para Google Imágenes
User-agent: Googlebot-Image
Disallow: /images/foto_personal.jpg

#Impedir el rastreo de todas las imágenes que haya en el sitio, para Google Imágenes
User-agent: Googlebot-Image
Disallow: /

#Impedir el rastreo de formatos específicos para Google Imágenes
User-agent: Googlebot-Image
Disallow: /*.png$

o

User-agent: Googlebot-Image
Disallow: /*.gif$

o

...

#Bloquear las páginas del sitio, pero mostrar los anuncios de AdSense que haya en ellas,
#mediante el bloqueo de todos los rastreadores web que no sean Mediapartners-Google.
User-agent: *

Disallow: /

User-agent: Mediapartners-Google

Allow: /

#Impedir el rastreo de todas las sub carpetas que comienzan con la palabra personal para Googlebot
User-agent: Googlebot
Disallow: /personal*/

#Para bloquear el acceso a todas las URL que incluyan signos de interrogación (?).
#Por ejemplo, las variables que se pasan por url.
User-agent: Googlebot
Disallow: /*?

#Para bloquear URLs que terminen de una forma concreta, utiliza $. Por ejemplo, el código de muestra bloquea cualquier URL que acabe en .pdf.
User-agent: Googlebot
Disallow: /*.pdf$

#Permitir el acceso a un único rastreador
User-agent: Googlebot-Video
Disallow:

User-agent: *
Disallow: /

#Permitir el acceso a todos los rastreadores excepto a uno

User-agent: Mediapartners-Google
Disallow: /

User-agent: *
Disallow:

#Indicar a los rastreadores donde se encuentra el archivo Sitemap
Sitemap: http://www.ejemplo.com/sitemap.xml

#Nota: recuerda que, en algunas situaciones, las URL del sitio web se pueden indexar aunque no se hayan rastreado previamente.

```

### Ejemplo de uso en un proyecto
Te recomiendo que no incluyas ninguna linea de comentarios

```tex
User-agent: *
Allow: /
Disallow: /recursos/
Disallow: /*.scss$
Disallow: /*.md$

User-agent: Googlebot-Image
Disallow: /assets/images/bg/
Disallow: /assets/images/overlays/

Sitemap: http://www.ejemplo.com/sitemap.xml
```

### Descargar archivo robots.txt

Descargar los archivos del artículo **Como crear un archivo robots.txt**.

Descargar

### Info

Para mayor información consulte la ayuda en Google, cómo bloquear URLs con robots.txt


text:
Credits

    The people responsible and technology colophon:

    (The content of this page was derived from Humans TXT.)

        Technology Colophon

                Components

Website built using the AngularJS web framework

Theme modified from Steve Smith's Minimal theme

RequireJS for keeping me sane and maintaining order in an otherwise chaotic codebase. Also, the RequireJS Optimizer is near irreplaceable.

RequireJS's domReady plugin

AngularUI Router for their intuitive "finite-state machine"-like routing

Angular Animate module for creating simple, yet elegant transition animations

ngDialog for their highly customizable lightweight lightboxes

HTML5 Boilerplate

Normalize.css

Node.js

Node Package Manager (npm)

Bower

Gulp.js for managing the tedium of mundane build processes

JSHint, my invaluable (albeit annoying) code grammar teacher

Angulartics

Fontello for creating custom icon font builds

Font Awesome for their awesome (icon) fonts

Łukasz Dziedzic's Lato Font

                Software

Sublime Text, the text editor I fell in love with

Firebug, the web developer's swiss army knife

Git, the distributed revision control and source code management


text:
<?php

declare(strict_types=1);

namespace Sonata\AdminBundle\DependencyInjection;

use Sonata\AdminBundle\DependencyInjection\Compiler\AddAuditReadersCompilerPass;
use Sonata\AdminBundle\DependencyInjection\Compiler\ModelManagerCompilerPass;
use Sonata\AdminBundle\Model\AuditReaderInterface;
use Sonata\AdminBundle\Model\ModelManagerInterface;
use Sonata\AdminBundle\Util\AdminAclUserManagerInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SymfonyChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType as SymfonyDateTimeType;
use Symfony\Component\Form\Extension\Core\Type\DateType as SymfonyDateType;
use Symfony\Component\Form\Extension\Core\Type\EmailType as SymfonyEmailType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType as SymfonyIntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType as SymfonyTextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType as SymfonyTextType;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
 * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
 * @author Michael Williams <michael.williams@funsational.com>
 */
final class SonataAdminExtension extends Extension
{
    public function load(array $configs, ContainerBuilder $container): void
    {
        $bundles = $container->getParameter('kernel.bundles');

        if (isset($bundles['SonataUserBundle'])) {
            // integrate the SonataUserBundle / FOSUserBundle if the bundle exists
            array_unshift($configs, [
                'templates' => [
                    'user_block' => '@SonataUser/Admin/Core/user_block.html.twig',
                ],
            ]);
        }

        if (isset($bundles['SonataIntlBundle'])) {
            // integrate the SonataUserBundle if the bundle exists
            array_unshift($configs, [
                'templates' => [
                    'history_revision_timestamp' => '@SonataIntl/CRUD/history_revision_timestamp.html.twig',
                ],
            ]);
        }

        $loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('actions.php');
        $loader->load('block.php');
        $loader->load('commands.php');
        $loader->load('core.php');
        $loader->load('event_listener.php');
        $loader->load('form_types.php');
        $loader->load('menu.php');
        $loader->load('route.php');
        $loader->load('twig.php');

        if (isset($bundles['MakerBundle'])) {
            $loader->load('makers.php');
        }

        if (isset($bundles['SonataExporterBundle'])) {
            $loader->load('exporter.php');
        }

        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $config['options']['javascripts'] = $this->buildJavascripts($config);
        $config['options']['stylesheets'] = $this->buildStylesheets($config);
        $config['options']['role_admin'] = $config['security']['role_admin'];
        $config['options']['role_super_admin'] = $config['security']['role_super_admin'];
        $config['options']['search'] = $config['search'];

        $sonataConfiguration = $container->getDefinition('sonata.admin.configuration');
        $sonataConfiguration->replaceArgument(0, $config['title']);
        $sonataConfiguration->replaceArgument(1, $config['title_logo']);
        $sonataConfiguration->replaceArgument(2, $config['options']);

        if (false === $config['options']['lock_protection']) {
            $container->removeDefinition('sonata.admin.lock.extension');
        }

        $container->setParameter('sonata.admin.configuration.global_search.empty_boxes', $config['global_search']['empty_boxes']);
        $container->setParameter('sonata.admin.configuration.global_search.case_sensitive', $config['global_search']['case_sensitive']);
        $container->setParameter('sonata.admin.configuration.templates', $config['templates']);
        $container->setParameter('sonata.admin.configuration.admin_services', $config['admin_services']);
        $container->setParameter('sonata.admin.configuration.default_controller', $config['default_controller']);
        $container->setParameter('sonata.admin.configuration.dashboard_groups', $config['dashboard']['groups']);
        $container->setParameter('sonata.admin.configuration.dashboard_blocks', $config['dashboard']['blocks']);
        $container->setParameter('sonata.admin.configuration.sort_admins', $config['options']['sort_admins']);
        $container->setParameter(
            'sonata.admin.configuration.mosaic_background',
            $config['options']['mosaic_background']
        );
        $container->setParameter('sonata.admin.configuration.default_group', $config['options']['default_group']);
        $container->setParameter('sonata.admin.configuration.default_label_catalogue', $config['options']['default_label_catalogue']);
        $container->setParameter('sonata.admin.configuration.default_icon', $config['options']['default_icon']);
        $container->setParameter('sonata.admin.configuration.breadcrumbs', $config['breadcrumbs']);

        if (null !== $config['security']['acl_user_manager']) {
            $container->setAlias('sonata.admin.security.acl_user_manager', $config['security']['acl_user_manager']);
            $container->setAlias(AdminAclUserManagerInterface::class, 'sonata.admin.security.acl_user_manager');
        }

        $container->setAlias('sonata.admin.security.handler', $config['security']['handler']);

        switch ($config['security']['handler']) {
            case 'sonata.admin.security.handler.role':
                if (0 === \count($config['security']['information'])) {
                    $config['security']['information'] = [
                        'EDIT' => ['EDIT'],
                        'LIST' => ['LIST'],
                        'CREATE' => ['CREATE'],
                        'VIEW' => ['VIEW'],
                        'DELETE' => ['DELETE'],
                        'EXPORT' => ['EXPORT'],
                        'ALL' => ['ALL'],
                    ];
                }

                break;
            case 'sonata.admin.security.handler.acl':
                if (0 === \count($config['security']['information'])) {
                    $config['security']['information'] = [
                        'GUEST' => ['VIEW', 'LIST'],
                        'STAFF' => ['EDIT', 'LIST', 'CREATE'],
                        'EDITOR' => ['OPERATOR', 'EXPORT'],
                        'ADMIN' => ['MASTER'],
                    ];
                }

                break;
        }

        $container->setParameter('sonata.admin.configuration.security.role_admin', $config['security']['role_admin']);
        $container->setParameter('sonata.admin.configuration.security.role_super_admin', $config['security']['role_super_admin']);
        $container->setParameter('sonata.admin.configuration.security.information', $config['security']['information']);
        $container->setParameter('sonata.admin.configuration.security.admin_permissions', $config['security']['admin_permissions']);
        $container->setParameter('sonata.admin.configuration.security.object_permissions', $config['security']['object_permissions']);

        $loader->load('security.php');

        $container->setParameter('sonata.admin.extension.map', $config['extensions']);

        /*
         * This is a work in progress, so for now it is hardcoded
         */
        $classes = [
            SymfonyChoiceType::class => '',
            SymfonyDateType::class => 'sonata-medium-date',
            SymfonyDateTimeType::class => 'sonata-medium-date',
            SymfonyEmailType::class => '',
            SymfonyIntegerType::class => '',
            SymfonyTextareaType::class => '',
            SymfonyTextType::class => '',
        ];

        $container->getDefinition('sonata.admin.form.extension.field')
            ->replaceArgument(0, $classes)
            ->replaceArgument(1, $config['options']);

        // remove non-Mopa compatibility layer
        if (isset($bundles['MopaBootstrapBundle'])) {
            $container->removeDefinition('sonata.admin.form.extension.field.mopa');
        }

        // set filter persistence
        $container->setParameter('sonata.admin.configuration.filters.persist', $config['persist_filters']);
        $container->setParameter('sonata.admin.configuration.filters.persister', $config['filter_persister']);

        $container->setParameter('sonata.admin.configuration.show.mosaic.button', $config['show_mosaic_button']);

        $this->replacePropertyAccessor($container);

        $container
            ->registerForAutoconfiguration(ModelManagerInterface::class)
            ->addTag(ModelManagerCompilerPass::MANAGER_TAG);

        $container
            ->registerForAutoconfiguration(AuditReaderInterface::class)
            ->addTag(AddAuditReadersCompilerPass::AUDIT_READER_TAG);
    }

    public function getNamespace(): string
    {
        return 'https://sonata-project.org/schema/dic/admin';
    }

    private function buildStylesheets(array $config): array
    {
        $config['assets']['stylesheets'][] = sprintf(
            'bundles/sonataadmin/dist/admin-lte/css/skins/%s.min.css',
            $config['options']['skin']
        );

        return $this->mergeArray(
            $config['assets']['stylesheets'],
            $config['assets']['extra_stylesheets'],
            $config['assets']['remove_stylesheets']
        );
    }

    private function buildJavascripts(array $config): array
    {
        return $this->mergeArray(
            $config['assets']['javascripts'],
            $config['assets']['extra_javascripts'],
            $config['assets']['remove_javascripts']
        );
    }

    private function mergeArray(array $array, array $addArray, array $removeArray = []): array
    {
        foreach ($addArray as $toAdd) {
            $array[] = $toAdd;
        }
        foreach ($removeArray as $toRemove) {
            if (\in_array($toRemove, $array, true)) {
                array_splice($array, array_search($toRemove, $array, true), 1);
            }
        }

        return $array;
    }

    private function replacePropertyAccessor(ContainerBuilder $container): void
    {
        if (!$container->has('form.property_accessor')) {
            return;
        }

        $pool = $container->getDefinition('sonata.admin.pool');
        $pool->replaceArgument(4, new Reference('form.property_accessor'));

        $modelChoice = $container->getDefinition('sonata.admin.form.type.model_choice');
        $modelChoice->replaceArgument(0, new Reference('form.property_accessor'));
    }
}