Facepalm Lottery Predictions

Today I learned that for one of my “projects” I would need a certain amount of money. Not absolutely impossible to source by saving every cent, but still a pretty big amount. Someway this pushed my to get a lottery ticket.

There are many games in the Lottery, maybe too much. One of them is Keno, the “guess 10 out of 20 that were picked from 70” game. Keno, at least in Germany, has many types. besides the usual guess 10, where you also get a little amount if you miss all guesses, it goes down to only 2 picks you have to do.

As I was curious, to which of these would pay off the best I started evaluating. I came to the conclusion that the Type-5 game where you pick 5 of the numbers would pay off best with a chance to win (anything) of almost 13%.

I also wanted to know how much I could be winning with a little bit of intelligent beting. This type of keno pays off double the amount you bet when you guess 3 numbers right, 7 times the amount when you guess 4 number right and a whopping 100 fold when all 5 of your pics are right. Since I was never really good at maths, I wanted to ease my way. So I started writing a small Java programm that would make guesses and randomly pic numbers and compare them to estimate what I could win.So I started simulating Keno on my PC. I increased the number of games the computer would play before giving feedback and I threw in some simple statistics like, what is the highest win when I play every day for a year, how many rows should I play, what is the lowest amount I would get in a worst-case scenario and so on.

That last bit got out of hand, because at some point I figured that I would always make money, not loose, if I play at least 3 coupons every day. Not much, but still always positive numbers. And I even figured that it would pay off pretty well if I play 6 coupons everyday. Well this went on for a while, I was just wondering why the hell Keno is allowed at all…

Until I found my BIIGG MISTAKE !
I forgot to take into account that every number can only be drawn once in a lottery…

After correcting that in my tool, I saw that with the same parameters my tool would continously return negative numbers even for the most optimistic scenario. It is clear that there is no point in loosing money by gabling.

But for this huge mistake I deserve this :Picard doing facepalm

Play responsibly, the best is still not to play at all …

esc_url() in WordPress

I have closed commenting in this blog for the obvious spam & german law problems. But I still want ppl to be able to contact me.

So I want that people reading single entries can simply click on my name at the end of a post and write me a mail instead of going to the about me page and searching for my mail.
I was looking into the content-single.php file. There is the line:

esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) )

that obviously needs to be changed for my needs. In the default config it redirects to a list of all the posts that the author has written. As a single-author-blog, it will do the same as clicking on the top left Link with the blog name.

According to the documentation of wordpress I shall use esc_url() with the protocol name "mailto". Well, guess what! All the following do not work:

esc_url( get_the_author_meta( 'user_email' ), 'mailto:' )
esc_url( get_the_author_meta( 'user_email' ), 'mailto' )
esc_url( get_the_author_meta( 'user_email' ), "mailto:" )
esc_url( get_the_author_meta( 'user_email' ), "mailto" )
esc_url( get_the_author_meta( 'user_email' ), 4 )
trying 4 was just for the laughs, bcs the protocols are defined in an array and mailto has the index 4. All of them give me urls like http://spammail@example.com or even worse, throwing in some of the blog’s url. Looks like the second parameter is completely ignored!

So now I resorted to using this archaic construct:
'mailto:'.get_the_author_meta( 'user_email' )

This works for now, so most probably it just will stay that way. Is this broken or is it just me that could not figure out what I did wrong?