Loops and recursion

I was recently asked to write a simple algorithm using recursion. I immediately baulked because the algorithm was so trivial and recursion was such a bad choice.
But for novelty sake i wrote it up on the whiteboard. It was wrong, I didn’t put the termination condition in, but I don’t program whiteboards anyway and the fact that the problem was so stupid to solve as recursion had me befuddled.

But it has made me think. Think about how bad the solution I wrote up was. I was asked to write a recursive solution, to a linear single loop problem, so I wrote it thinking like I was solving a problem which was best solved by recursion. Solution ran n^2, I knew it, was the biggest reason why I thought writing the algorithm with recursion was stupid.
Later I was thinking, it wouldn’t be that hard to make the recursion linear, its still a terrible way to solve the problem but at least its still linear.

But it was only just now that the obvious truth hit me, you can turn any loop into a recursion trivially without changing the asymptotic performance (your performance will likely drop, and you’ll probably stack overflow, but the O notation won’t change). I had been so focused on the request for recursion that I didn’t do what I should have done, which is solve the problem the right way, and then make that fit the requirements. (Not that that is a good motto for general development…)

Random challenge

I feel the probability of this challenge being met is low, but I felt the urge to post it.

Someone out there, go to a magic show where the guy asks you to write down a number between 1 and 100.
On the paper write e^pi – pi. Or Ceil(e^pi – pi) if you are concerned about possible implicit integer definition in original request.

Come back and tell me what happens.

Random thoughts again

I feel like writing another blog post, has been a while. But I don’t have anything interesting about .Net to put up today.

So, to a completely different topic. I play LOTRO, in fact maybe that is why I haven’t had much to blog about recently… One of the developers ‘Orion’ has been posting a blog in which he details his daily work on reworking an existing area of the game. This blog has received a lot of comments, and I think that the general idea is good for player relations.
However in his latest blog post he decided to take some time out to respond to one of the comments claiming that devs ignore the players. As a personal time game developer for an old text based MMORPG, I have been exposed to a lot of player requests, and seen this complaint plenty of times. But Orion’s response surprised me in some ways. Specifically I don’t think he put enough emphasis on what I think is the most important part of being a game developer, which is interpretation.
When a player complains ‘a’ is too hard. That may be a decent complaint, although there are a bunch of people who aren’t complaining because they don’t find it too hard… But the problem can be solved to satisfy both parties. (Sort of… More on that later…) However player complaints can often be more like ‘you should change this to be like that’, they go further than just identifying the issue and start offering solutions. The problem now is that if you don’t do exactly what they say you aren’t listening to the playerbase, in their eyes. As a game developer you may receive 18 ways to address an issue – they will often be conflicting with each other, they will often result in there being no actual challenge left in the game. This last point I think is one which is very important, players often ask for stuff without realising that if they get given it, the net result will be a game which will bore them. It is a game developers job to interpret all of these factors and try to come up with compromises and solutions which keep the masses both feeling respected and entertained. This is really quite a challenging job and I think Orion should have made a bigger deal of it. The customer is not always right, but the customer does always have a point…

One of the ways in which LOTRO attempted to produce a compromise which produced a lot of negative feedback in public forums (although ultimately public forums are often the vocal minority…) is the concept of having two ways to do a piece of game play, one as an ‘easy’ mode and another as a ‘hard’ mode. Although they are trying to rename those as normal and challenge, I imagine the initial naming will be hard to get rid of in peoples minds.
I think that this is a pretty good idea – certainly has the potential to be divisive, but in general the concept is sound. The problems come in the rewards. There is a decent section of the playerbase of a MMORPG which is equipment centric, and if you make it so the only way to get a certain piece of gear (which is above normal standards) is through a challenge mode, you have caused a problem. Because the section of the playerbase which is gear centric and the section of the playerbase which is very good at playing, are not the same. So in the process of trying to satisfy the high end and average groups separately, you’ve take a section of the average group and failed to solve the problem for them.
So the trick here comes in working out what rewards you can give out without causing community division. I am thinking bragging right rewards (titles, housing items – useless in all ways except for bragging), and items which are obtainable from other locations. But if the items are obtainable from other locations why would you ever do the challenge mode more than the number of times required to get your bragging rights. I think the answer here lies in the quantity of the rewards (as opposed to the quality). If you make doing challenge tasks give out frequently used consumables in quantities which give a significant benefit in terms of time taken vs amount required compared to other non-challenge task options – people will keep doing them. Or if you make rare drops noticibly more common when challenge mode is completed. Letting people save time by doing things the hard way is the traditional rpg trade off, and I think should be perceived as generally acceptable.
When book 8 first dropped one of the bugs which many people noticed was that ‘normal’ mode was dropping the tokens for the good gear – and initially I thought yeap that’s a bug, because it didn’t match with their previous gear drop strategy of being only from ‘hard’ mode. Now I think this bug is actually the first step on the right way to do things. They just need to significantly improve the quantity of hard mode rewards, since they are currently very very boring.
(Hopefully none of my fellow ‘hardcore’ raiding kinship members read this, because they’re more likely to be in the small minority of players which think there should be truely awesome equipment which is only obtainable by being elite players – heh even I think that, I just don’t think its the right way to run the game… ahh self inconsistency…)

In other news one of my fellow workmates came up to me the other day and said ‘you’re famous’. I instantly had to wonder why – had I broken some code in some spectacular way… Or had he found me on the internet… why would he have found me on the internet was the next idea in my head – there are a number of avenues which can result in finding me on the internet (physics competitions/programming competitions/game development/my university web page/open source mailing list archives…). But no, he had just done a google search for WindowsIdentity and IDisposable and this blog was the top result.