Monday, October 31, 2011

On NaNoWriMo Part III

As I did last year, I will be taking part in National Novel Writing Month (NaNoWriMo). For the month of November, I will be attempting to write a fifty thousand word novel. In the mean time, you can keep yourself occupied by reading what I managed to write last year. Or, you could always just use the time you normally spend browsing pointless stuff on the internet (like right now) to be constructive and write a novel.

You can keep track of the progress of my novel here. Feel free to add me as a writing buddy if you're also doing it. I will be back with a novel for you (or at least part of one) in early December.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Thursday, October 27, 2011

On the Efficiency of Nether Wart Harvest Spacings in Minecraft

[Editors Note: For those who do not play Minecraft, you should. You can play it in your browser here, but I strongly recommend downloading the client from here.]

Once again, my mathematical mind found itself thinking about the efficiency of Minecraft. Obviously, the warning for high mathematical content which I developed and then never bothered to actually use, could be applied here.


The expected yield per hour of a Nether Wart plant that is left for a given time period before being harvested and replanted can be calculated using statistics. The expected yield for several interval lengths is calculated and an optimum interval of between 25 and 50 minutes is found to be sufficient to allow the majority of the plants to grow, without leaving fully grown plants too long to waste update cycles.

      1. Introduction

The game of Minecraft is an open sandbox construction game created by Markus "Notch" Persson. The basic gamplay involves the player manipulating blocks in an effectively infinite 3D environment. The player controls an avatar that is capable of placing and removing blocks to create various structures, artworks or creations[1]. A significant part of the gameplay for the advanced player is farming for resources.

Nether Wart was added to the game in the 1.9 pre-release, and is a plant which only grows in the Nether on Soul Sand [2]. Due to the importance of Nether Wart in potion brewing, and since it can only be grown in the Nether, optimum farming methods become necessary. After being planted, Nether Warts need to undergo two stages of growth in order to be fully grown.

      2. Methodology

The aim of this investigation is to determine the time for which Nether Wart should be left in order to maximise the number of seeds obtained in a given time period. It is useful to define our target variable as the net yield per plant, , measured in seeds per hour. Freshly planted and half grown plants will yield a single seed, while fully grown plants will yield two to five seeds [2]. The distribution of the number of seeds dropped by a fully grown plant appears to be uniform, for an average of 3.5 seeds per plant. Thus the yield per plant per hour is given by the formula

where represents the probability that the plant has undergone growth cycles, and is the actual time in hours since the seed was first planted.

The algorithm the game applies when checking for growth is as follows [3]. The game runs through an update cycle (I avoid the word tick, due to confusion with redstone ticks) every twentieth of a second. Each cycle, the game checks twenty random blocks in each loaded chunk for updates. A chunk is a 16 x 16 square with the full 128 block height of the world, and consists of 32 768 blocks. Thus the probability of a certain block being checked for updates is 20 in 32 768, or 0.061%. If a Nether Wart that is not fully grown is chosen to be checked for updates, then the probability of it growing to the next stage is one in 15.

After update cycles, the probabilities of the plant being at each stage of growth is given by

where is the probability of a plant growing in any given update cycle, which is given by

After a certain time in hours, the number of update cycles that have been applied are

From this, it is possible to calculate the expected yield per hour per plant for a farm that is harvested an replanted at regular specified intervals.

      3. Results

The yield per hour per plant was calculated for various time intervals. Exact agreement was found for the probabilities of various stages of growths with the work of Pernsteiner [3]. The probabilities of a plant being at each stage of growth and the resulting yield per hour per plant is shown in Table 1.

Table 1: Yield per hour per plant at various times after planting.
Time Fresh Plant Half Grown Fully Grown Net Yield
1 s 99.92% 0.08% 0.00% 0.00
30 s 97.58% 2.38% 0.03% 0.08
1 min 95.23% 4.65% 0.12% 0.17
5 min 78.33% 19.12% 2.54% 0.76
10 min 61.37% 29.97% 8.67% 1.30
20 min 37.67% 36.78% 25.56% 1.92
30 min 23.11% 33.86% 43.03% 2.15
35 min 18.10% 30.94% 50.95% 2.19
40 min 14.18% 27.70% 58.12% 2.18
50 min 8.70% 21.25% 70.05% 2.10
1 hour 5.34% 15.65% 79.01% 1.97
2 hours 0.28% 1.67% 98.04% 1.22
4 hours 0.00% 0.01% 99.99% 0.62

The results are plotted in Figure 1 below.

Figure 1: Plot of net yield per hour against time

      4. Discussion

Figure 1 shows a maximum yield at 36 minutes and 43.6 seconds. However, the relatively flat gradient between 25 and 50 minutes would suggest that any time within this range would provide a reasonable yield.

The method with the highest yield would obviously be to monitor the farm constantly and manually harvest and replant those plants that are fully grown, but leave those that have not yet started to grow. However, the method of harvesting all plants at once lends itself to large or automated farms.

The above analysis does not account for the fact that a farm would take a finite amount of time to plant. Assuming a planting rate of about two plants per second, a 16 x 16 farm would take just over two minutes to plant. Because of this, the first plants two be planted would have had roughly two minutes longer to grow than the last plants to be planted. This should be accounted for when harvesting.

It is tempting to spread the farm over several chunks. This has absolutely no effect on the growth rate, as each block still has the same 0.061% chance of being selected for update, regardless of which chunk it is in.

      5. Conclusions

The expected outcome for the net yield of a Nether plant after a certain time period is easily calculated using statistics. A formula to calculate the probability of a Nether Wart having reached its first and second stages of growth respectively was developed and was then used to calculate the length of time that an Nether Wart farm should be allowed to grow to maximise the yield in a certain time period. The optimum time between harvests was found to be 36 minutes and 43.6 seconds, but any time period between 25 and 50 was found to be reasonable.

      6. References

[1]. Curse, Inc.; Minecraft Wiki - The ultimate resource for all things Minecraft; September 2011.
[2]. Curse, Inc.; Nether Wart - Minecraft Wiki; October 2011.
[3]. Pernsteiner, S.; Minecraft Crop Growth Algorithm; October 2011.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Monday, October 24, 2011

On Password Strengths

It annoys me considerably when I am signing up for something and the form insists that if my password does not contain capital letters or numbers, or some special character, then it is somehow an inferior password. The strength in a password lies not in the characters it contains, but rather in the characters that it could contain. Therefore, if a password contains only capital letters, for example, but could contain small letters or numeric characters as well, then any brute force attacker will not know this, and would waste considerable effort testing passwords that contain those small letters of numeric characters.

It is especially annoying when I generate a completely random list of letters and numbers for use in a password, and then have the signup form tell me that my password is weak, despite the fact that by some random chance, it has no capital letters (something which can happen on average once in 167 passwords with the algorithm I typically use). My passwords typically have an entropy between 36 and 95 bits, which is strong enough for most purposes (the average person's passwords typically have entropies in the twenties.)

(On a nice informative side note: the aesthetically pleasing arrangement of letters and numbers that forms part of the background to the header on this page was generated by the same Matlab script I originally wrote to generate passwords for me.)

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Monday, October 17, 2011

On the End of the World Part II

I once did a forecast based on penguin migrations and determined that on the 25th of August 2011, penguins would take over the world. You may think that we had a narrow escape, but I have found that my fridge is ever so slightly colder than I thought it was set to - clearly evidence that the penguins have been using it as a hideout.

More importantly, according to Harold Camping, the world is going to come to an end on Friday (just before supper, unfortunately), so I thought I'd be nice and help set the mood for our impending doom. I have arranged a nice depressing soundtrack to the end of the world so that, just in case the world does end, we will be in the right mood for it.

The Alphanumeric Sheep Pig's Soundtrack to the End of the World

  1. Gustav Mahler - Symphony No. 5, I. Trauermarsch (7:45)
  2. Virgin Black - Of Your Beauty (4:00)
  3. Frédéric Chopin - Piano Sonata No. 2, III. Marche Funèbre (9:33)
  4. Lacrimosa - Satura (9:23)
  5. Anathema - Shroud of False (1:37)
  6. Visions Of Atlantis - Atlantis, Farewell... (3:39)
  7. Wintersun - Beautiful Death (8:18)
  8. Ludwig van Beethoven - Symphony No. 3, II. Marcia funebre (13:49)
  9. Counting Crows - Raining In Baltimore (5:13)
  10. The Foreshadowing - The Last Minute Train (4:09)
  11. Rhapsody of Fire - Symphony of the Enchanted Lands, I. Tharos' Last Flight; II. The Hymn of The Warrior. (4:09)
  12. Eluveitie - Anagantios (3:26)
  13. United States Army Band - Taps (0:48)

Total playing time: 75 minutes, 49 seconds.

You can listen to the complete playlist on YouTube. If you start listening at 4:44 on Friday afternoon, you should finish the album just in time for Judgement. And don't forget to have a good meal beforehand, because if Mr Camping is correct, you won't get another meal again, ever.

(Some rather irrelevant notes: My apologies to those who do not share my taste in music. If I were a video game character, I'd be the little guy on the second island of Black & White, who wanders around in the mountains cheerfully whistling Chopin's Funeral March. The final two movements of the Symphony of the Enchanted Lands are far too uplifting to be included in this list (plus, they'd make it too long to fit on a single CD). Even though I am not American, Taps has an emotional depth that Last Post can never have, no matter how well it's played (I don't think my grandfather would like me saying this though). And then, obviously, I do not claim in any way that these videos or the music therein are my own.)

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Monday, October 10, 2011

On Door Knocking

I tend to knock on things a lot. When I was much younger, I could never work out how to knock on doors. What ever I tried either made almost no noise or caused a sharp pain or spasm to shoot through my arm. When teachers needed someone to send on an errand, I dreaded being picked. Then, one day (I think I was around sixteen), I worked out how to knock on doors. Looking back, I think I had learned to knock superficially from watching television shows, but had never thought that hard about how it all worked in principle (which is something I try to avoid doing now). Somehow, I subconsciously made the shift to knock with the correct part of my knuckle.

The net result of this is that I missed that all important childhood phase where I should have been knocking on everything. I entered adulthood just as I was learning that I could knock on things, and now I'm stuck as an adult who compulsively knocks on doors, walls and desks.

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .

Tuesday, October 4, 2011

On the Indecisiveness of Cardboard Boxes...

... because they can never seem to decide what shape they want to be. They always seem to insist on collapsing in slightly when carried, especially in the rain. In particular, the cardboard box that I use to hold my backup drives used to fit perfectly into my middle desk drawer. For some obscure reason, it decided this morning that the drawer was ever so slightly smaller than itself and for several seconds, it refused to allow the drawer to open. This is in spite of the fact that it showed absolutely no sign of protest when it was put into that drawer yesterday evening.

Perhaps I am missing something. Perhaps it is the drawer that is shrinking. Perhaps penguins sneaked into my office in the middle of the night and switched my desk with another one, identical except in its marginally smaller size. That would be impressive on the part of the penguins. This desk mirrors my old desk so closely, even down to the exact location of that annoying scratch in the table that makes my mouse skip.

(On a side note: It is strange how, after speaking almost exclusively English my whole life, and having almost certainly used some past tense form of the word "sneak" on at least several occasions, I could not recall which form I had always used previously, and could not remember which form was correct. As it turns out, the Oxford Dictionary of English says "past and past participle sneaked or INFORMAL, chiefly NORTH AMERICAN snuck")

If you enjoyed this post, then don't forget to like, tweet, +1, or upvote on reddit. If you have any questions, comments or complaints, post them using the form below.
. . . . . . . . . . . . . . . . . . . . . . . .