The location is simply where the replicator is on the grid. The direction is used to determine the next location. On each step of the program the replicators move either forward, left, or right. A replicator at 4 with current direction of 8 moves forward to 8, or left to 5, or right to 7. A replicator increases its energy by eating food.
Food is added to the food area in a random fashion.
Each adding of food to a cell increases the energy in that cell by a certain value. A replicator can only eat a certain amount of food energy from each cell on a given move, so it may leave some food behind. But it's not ready to replicate yet. Each replicator has an investment value, which is the amount of energy it will invest in its offspring. Once a replicator has obtained that much more energy in addition to the minimum value, it replicates, losing a certain amount of energy for the act of replicating, plus whatever it invests in its offspring.