I'm trying to discover the most efficient way to farm wheat. I farm like this:
- Plant all the seeds at the same time
- Wait a certain amount of time for them to grow
- Harvest all of the wheat at the same time, fully grown and not alike.
Farming this way leads to a dillema. If I wait too litle time, I'll harvest lots of immature crops. If I wait too much, I'll waste time waiting for a few crops to grow when I could be replanting all of them already.
I believe the logic of crop growing is like this:
1 - There is a standard time which the game uses to test if the crop will grow or not. Example: Each 30 seconds, each crop has a chance to grow.
2 - There's a chance for the crop tp grow, which is tested once every the standard time above. Examplo: Each 30 sec, each crop has 25% chance to grow.
To help solve this problem and find the most efficient time when to harvest, I made a small program in C. It works like this:
- It'll emulate a real farm of a size defined in the program (90 by default), in form of a array of integers. Each element is initialized with 1, representing a newly planted seed. Each new stage of growth is represented by summing 1 in each element, all the way up to 8, which represent a fully grown crop.
- It will wait various standard times, defined on item 1, varying from 1 to a number defined in the program (50 by default)
- Each standard time, the program will test, based on a chance defined in the program (25% by defaul), if the crop grows one stage or not.
- When the standard time limit is reached, it harvests all the crops
- Counts all the fully grown crops and displays them as "*" in a txt file
- Divides the number of grown crops by the time needed for them to grow. This number represent efficiency, and I'll be searching for the highest.
Example: A farm of size 90 was recently planted. A 25% chance is tested to determine if the crop grows. All crops are then harvested and the fully grown are counted. Program runs again, now testing the chance one time more for each crop. This goes on all the way up to 100 tests.
Since the crops need to grow 7 times before it is mature, obviously there won't be any mature crop in less then 7 tests. Above that, the total number of mature crops will raise quickly at first, but slowly later on. Program's aim is to find the best time when to harvest.
The code is ready and is available below if you want to compile it yourself. An output example is also available. The program runs fine, but it is useless until I know the two itens mencioned above.
So, what I need of you guys in this post is if any of you know what's the chance of a crop to grow one stage, and how much time it passes between each test.
I'm well aware the chance is not a fixed value, but let's say the crop is next to a block of water and with maximum light at all times.
Thanks.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define FARMSIZE 90
#define HOWMANYTIMES 50
#define CHANCE 25
#define WHEATSTAGES 8
int main () {
int i, j, k, times, besttime;
int farm[FARMSIZE];
float wheat, highestefficiency;
FILE *RESULT;
srand(time(NULL));
highestefficiency = 0.0;
RESULT = fopen("result.txt", "w");
for (times = 1; times <= HOWMANYTIMES; times++) {
for (i = 0; i < FARMSIZE; i++)
farm[i] = 1;
for (j = 0; j < times; j++)
for (k = 0; k < FARMSIZE; k++)
if ((1 + rand()%100) <= CHANCE)
farm[k]++;
fprintf(RESULT, "%2d Times: ", times);
wheat = 0;
for (i = 0; i < FARMSIZE; i++) {
if (farm[i] >= WHEATSTAGES) {
fprintf(RESULT, "*");
wheat++;
}
}
fprintf(RESULT, "\n");
if (wheat/times > highestefficiency) {
highestefficiency = wheat/times;
besttime = times;
}
}
fprintf(RESULT, "00 Times: ");
for (i = 0; i < FARMSIZE; i++)
fprintf(RESULT, "*");
fprintf(RESULT, "\nHighest Efficiency was %2.2f obtained at the time %d", highestefficiency, besttime);
return 0;
}
you really can't just go find something to do, such as mine for half an hour then go harvest? build a large enough farm that you can get several stacks of wheat at a time. Unless you under some sort of time constraint to grow as much as you can in the shortest time possible. Selling in a store perhaps? at any rate build a big enough farm to get several stacks of wheat at a time, and it will never be an issue.
I appreciate your concern friend, but I'd still like to know those variables. Of course I won't sit and watch the crops grow. But let's say I was away for half an hour and when I get back, 3/4 of the crops are mature. Is that a good moment to harvest or should I wait more? That's the question I want to answer.
Congratulations! You've stumbled into one of the first things you'll study if you take a 300-level statistics class in college!
The minecraftwiki link given above has the actual numbers. As it states, it is possible that you could plant a seed and it could grow from stage 1 all the way to the end stage in 7 seconds. Of course, this is very unlikely (the exact chance is given on that page)
In a poisson distribution, you always assume that the ticks are infinitesimal, because it makes the math much easier. The amazing thing is that only one variable, λ, is needed to characterize the distribution. It is the expected number of occurrences over an amount of time.
The way you do the math for this is to figure out what λ is for your distribution. You could get it experimentally easily. Plant 100, wait 5 minutes, and then do a careful count of how many grew 1 stage, 2 stages, etc. Adding them together, you can figure out how many occurrences happened during the 5 minutes, and then divide by time to λ. Or, just calculate it based on that routine on the wikipedia page. Then fit your λ into the equations on the wikipedia page to figure out what percentage of your wheat will grow completely (all 7 stages) in 30 minutes.
I would have done this already, but it felt too much like homework to me :smile.gif:
I'm trying to discover the most efficient way to farm wheat. I farm like this:
- Plant all the seeds at the same time
- Wait a certain amount of time for them to grow
- Harvest all of the wheat at the same time, fully grown and not alike.
Farming this way leads to a dillema. If I wait too litle time, I'll harvest lots of immature crops. If I wait too much, I'll waste time waiting for a few crops to grow when I could be replanting all of them already.
I believe the logic of crop growing is like this:
1 - There is a standard time which the game uses to test if the crop will grow or not. Example: Each 30 seconds, each crop has a chance to grow.
2 - There's a chance for the crop tp grow, which is tested once every the standard time above. Examplo: Each 30 sec, each crop has 25% chance to grow.
To help solve this problem and find the most efficient time when to harvest, I made a small program in C. It works like this:
- It'll emulate a real farm of a size defined in the program (90 by default), in form of a array of integers. Each element is initialized with 1, representing a newly planted seed. Each new stage of growth is represented by summing 1 in each element, all the way up to 8, which represent a fully grown crop.
- It will wait various standard times, defined on item 1, varying from 1 to a number defined in the program (50 by default)
- Each standard time, the program will test, based on a chance defined in the program (25% by defaul), if the crop grows one stage or not.
- When the standard time limit is reached, it harvests all the crops
- Counts all the fully grown crops and displays them as "*" in a txt file
- Divides the number of grown crops by the time needed for them to grow. This number represent efficiency, and I'll be searching for the highest.
Example: A farm of size 90 was recently planted. A 25% chance is tested to determine if the crop grows. All crops are then harvested and the fully grown are counted. Program runs again, now testing the chance one time more for each crop. This goes on all the way up to 100 tests.
Since the crops need to grow 7 times before it is mature, obviously there won't be any mature crop in less then 7 tests. Above that, the total number of mature crops will raise quickly at first, but slowly later on. Program's aim is to find the best time when to harvest.
The code is ready and is available below if you want to compile it yourself. An output example is also available. The program runs fine, but it is useless until I know the two itens mencioned above.
So, what I need of you guys in this post is if any of you know what's the chance of a crop to grow one stage, and how much time it passes between each test.
I'm well aware the chance is not a fixed value, but let's say the crop is next to a block of water and with maximum light at all times.
Thanks.
Code:
Output example:
Check my thread.
The minecraftwiki link given above has the actual numbers. As it states, it is possible that you could plant a seed and it could grow from stage 1 all the way to the end stage in 7 seconds. Of course, this is very unlikely (the exact chance is given on that page)
This is called a Poisson Distribution (pronounced like "Poy-Zahn").
In a poisson distribution, you always assume that the ticks are infinitesimal, because it makes the math much easier. The amazing thing is that only one variable, λ, is needed to characterize the distribution. It is the expected number of occurrences over an amount of time.
The way you do the math for this is to figure out what λ is for your distribution. You could get it experimentally easily. Plant 100, wait 5 minutes, and then do a careful count of how many grew 1 stage, 2 stages, etc. Adding them together, you can figure out how many occurrences happened during the 5 minutes, and then divide by time to λ. Or, just calculate it based on that routine on the wikipedia page. Then fit your λ into the equations on the wikipedia page to figure out what percentage of your wheat will grow completely (all 7 stages) in 30 minutes.
I would have done this already, but it felt too much like homework to me :smile.gif: