They say that hindsight is 20/20 and I think they're right. Ray announced the winner of his Lemonade Stand contest today and I'm afraid I didn't do too well. In fact I lost $3.87 overall. Don't worry though, after downloading the code and fixing my function up a bit I can win almost every time now! If only I could remember where I put that danged time machine...It was fun to see the different approaches people took. Some wrote generic, flexible code that would adjust with the weather. Other people just put in a value for every possible combination. Still others, returned their prices in dollars instead of cents! (That sucks Curt-I think you should get a redo) What was amazing was how good Ray's test function did and it was SO SIMPLE! Of course, it took advantage of a couple quirks of the test. Based on weather and bad predictions, multiple runs of the test could have surprisingly broad fluctuations. Often times, if the first few days went bad, I would go bankrupt early on and that kind of kills you right there. Looking back here are the main mistakes I made:

Wrong Assumptions

This one was the hardest right here. I really didn't know what the average person would be selling their lemonade for, or how Ray's test would work. I thought the stands would actually compete against each other as if we were all lined up next to each other on a street. Customers would come up and order from one of us-- probably the one with the cheapest price. I set my prices pretty low hoping to get more business, but in reality it just lessened my profits.

Coding Error

I did find one error in my code that didn't help me. I divided my daily budget by my retail price instead of my internal costs which meant I didn't make as many cups as I could have.

I wasn't greedy enough

This one was the killer for me. Running the test over and over again against Ray's smart seller example I just wasn't making the same profits. Turns out it was because he was often charging 4 to 5 times more than me. Instead of everyone flocking around my stand and me selling out while he sold none we would both sell quite a few cups-- he would just make a lot more! I thought a baseline markup of about 250% was pushing it. Turns out I needed to markup up my price around 700% to remain competitive. Talk about price gouging!

The Secret Sauce

It turns out there were a couple subtle things the testing function did that the smart seller catered to very well. The first one (that I totally didn't see coming) was people were less likely to buy from you if your price per cup wasn't a multiple of 5. The difference was small, but added up quite a bit. Especially if it mean the difference between no sales and a little sales on a bad day. The higher your price, the more you made-- but there was a limit. After your price exceeded 50 cents your customers' desire for lemonade went down. When I modded my function to make the price a multiple of 5 and cap-out at 50 cents I was golden. Now I can win almost every time, but it's a pretty unfair and hollow victory. If I have the time I might modify Ray's test to sell out all the cheapest stands first, and then move on to the most expensive stands so the prices are actually competing against each other. Overall, this was real fun. I sure hope Ray does some more of these in the future.