THE BLOG

25
Apr

Is Scrabble Greedy?

I was killing some time playing Scrabulous, and I started thinking about strategies. I don’t really regard Scrabble as being a particularly strategy based game, but there is a certain element of it to the game – and that strategy can help you win. So this lead me to think:

Is the best strategy to adopt in Scrabble a purely greedy one?

i.e., if at each turn, you play the word which will gain you the most points, do you have more chance of winning than if you were to adopt a different strategy. For example: if I have a Q in my tile set, and the highest score I can make this turn is by playing that with an I (a legal two letter word) – is it better for me to play this and grab some points now rather than hold back the Q and hope that I get some nice letters in the next few moves to make an even higher score?

Intuitively, I would hope there is a nicer solution than a purely greedy approach – but of course one would be difficult to find. As well as this, such a strategy might involve “counting tiles” in order to calculate probabilities.

Were the Greedy solution to be adopted, I think one would have to create a compound value for each playable word – which takes into account certain things. For example, does the word leave the Triple Word Score open to your opponent? Can your opponent append something to your word and gain more points from it (by, for example, extending the word to pass over a Double or Triple score)?

I think this is quite an interesting problem – and one which I shall be thinking about each time I can’t think of a good word to put down in Scrabulous. But I thought I might open it up to the internet in the hope that someone else, more intelligent than I, would find it interesting and propose a solution. Enjoy!

21
Apr

IE Italics and Floats: What were you thinking?

I just came across the most ridiculous big ever. I had a page which had a number of similar blocks: each had an image floated left and some text next to it. One of the blocks of text had some italic text in it, specified by an <em> tag. For some reason, the whole block of these was rendered below the floated image, as if that block of test had been given clear: left; or clear: both;. The solution wasn’t easy to find, but was easy to implement:

em{ zoom: 1; overflow: auto; display: inline; }

What really gets me is that somewhere, someone programmed IE to do this. Either they’re part of some humongous joke which the web development community just doesn’t get, or they’re just a bit stupid.

Having said that, it’s obvious that someone is lacking quite a bit of sense when they appoint this man CEO.

15
Apr

Installing src.rpm files

So I’m a bit of a Linux n00b. I can find my way around the system, but I don’t have vast expanses of knowledge regarding how to use it properly like a normal Computer Scientist should. So Google normally helps me out when I’m trying to do bits of server admin at work. Unfortunately, this is one thing I always forget how to do, and I’ve found there are few decent resources on how to actually do this. So here’s one! It’s probably more for my own purpose than for anyone else, but maybe someone will find it useful.

Let’s say you’re trying to install a package, you’ve got the web address to the package and it’s a .src.rpm. You’ll want to do something like this:

  • Navigate to a directory that you can use to temporarily store the src file
  • Copy the address of the package to your clipboard
  • Type: wget URL_TO_PACKAGE, obviously replacing the URL_TO_PACKAGE with the address you copied a minute ago
  • Now in the directory you’ll a file called something.src.rpm. You’ll need root access for the rest of this – sudo or su will do fine.
  • Type: rpm -ivh something.src.rpm
  • This will have put a load of stuff under the /usr/src/redhat directories, where you’ll find folders called RPMS, SPECS, SOURCES, and BUILD. Go into the SPECS folder. You’ll see a file called something.spec
  • Type: rpmbuild -bb something.spec
  • This will produce a load of stuff on the terminal, and will have created the RPM in a subdirectory of the RPMS folder. If you look in there, you’ll see that there are different folders for the different architectures, i386, noarch etc. In the babble the last command (rpmbuild -bb) produced, it will tell you where it’s put the RPM. The line might look something like this: Wrote: /usr/src/redhat/RPMS/noarch/yum-2.4.3-1.noarch.rpm
  • Go into this folder – in this case RPMS/noarch. You’ll see something.rpm – which will relate to the one you just built. Type: rpm -ivh something.rpm, and the package will be installed!

And there we go! I would suggest however, this should be a final resort, especially for new comers to Linux. A much better solution is to use yum or apt, which do all the hard work for you. For example, using yum to install subversion, you do this as root: yum install subversion. How easy is that?