Hello, and welcome to the madness that is Lack-Of.
|
Lack-Of: A Weblog Of Sorts
Hello, and welcome to the madness that is Lack-Of. del.icio.us bookmarks 08/06/2008 to 14/06/2008
Odds & sods | Posted by lukey on Sunday June 15 2008 at 1:19PM | Comments (0) One program, many languages: introduction
Over the years I've learnt a reasonable number of languages, and even
invented one or two of them. Now when I start to learn a language I tend
not to write very simple programs such as the ubiquitous
The programs I usually write solve Castawords puzzles. Castawords was one of the puzzles I used to check when I was working on Tough Puzzles. With a Castawords puzzle, you are given a list of words that could be 'rolled' on a set of lettered dice. One example set of words that comprise a Castawords puzzle is the following:
In this case, you have four cubical dice, each with six faces. Each of the 24 faces shows a different letter. The aim is to figure out which letters go on which die. You may like to have a go at solving this puzzle for yourself. The usual strategy I have for solving the puzzle is keep track of 'groups' of letters that I know to be on the same die, and which pairs of letters cannot occur on the same die. I say that two letters are incompatible if I know that they must appear on different die. Every letter starts off in a group to itself, and the list of words provides a collection of incompatibilities to start off with. Two letters in the same word cannot be on the same die, so they must be incompatible. In the example above, A and X are incompatible since they both appear in the word AXON. The most important deduction I use when solving this puzzle is the following:
Given that two letters must be on the same die, we can then merge their groups. We then keep going until we can go no further. This simple strategy is quite effective and works for a lot of puzzles. However, some puzzles also require a deduction to prevent groups from growing too large. For example, if we have a group of four letters and a group of three letters, they cannot merge if there are only six letters per die. We prevent the groups from merging by marking every letter in one group incompatible with every letter in the other. As well as solving puzzles, the programs should handle failure. There are two ways the program can fail to solve the puzzle. The first is that the program can make no further deductions and has given up. This can suggest that the puzzle has multiple solutions, but it could also be because the puzzle is a particularly devious example that defeats the strategy I described above. The second way to fail is that something goes wrong. For example, the solver could find a letter that is incompatible with every letter in a word. In such cases there can be no solution to the puzzle. When this happens, there is no point attempting to make any further progress. The program should report what has gone wrong and stop. Another thing I have found useful with Castawords and other puzzle solvers is a log of all deductions made by the program. This can be immensely useful when you are trying to find out exactly how a puzzle went wrong. The programs I write should have most if not all of these features. They should read input from a file and write output to the console/standard output. I have a few reasons for not wanting to use standard input to enter the puzzles. Firstly, I'm not particularly keen on typing in the same puzzle any more than once. Secondly, I tend to keep copies of puzzles in files since they provide useful test cases should I later come to modify the solver program. Also, keeping the puzzles in a file means that we have to use the language's I/O libraries. Finally, I doubt that I would be losing by not using standard input. I can't use the program on the receiving end of a pipe, but at the same time I can't think of a reason why I would want to. As I complete Castawords in each new language, I'll add another article and link to it in the (presently empty) list below. Languages completed so far:None yet. Computering | Posted by lukey on Monday June 9 2008 at 10:10PM | Comments (0) Bye-bye F-Secure
For the last few years, I've had F-Secure Anti-Virus installed on my Windows XP Home system. However, my subscription to F-Secure ran out a couple of months ago. At the time, I couldn't decide whether to renew it, so I put up with the 'Your subscription has expired' messages it presented each time Windows booted. Yesterday, I finally bit the bullet and uninstalled it. But why would I want to do this? The main reason would be that I found out about its excessive memory usage. What on earth does it need one-third of my machines 512MB of RAM for?
What has F-Secure done for me to make it worth sacrificing that much memory? Nothing, in fact:
I haven't had a single virus infection, but I have lost who-knows-how-much CPU time and at times over a third of my machine's memory to a program that I can only describe as a pest and a nuisance. I did not want to spend any more money on it. People reading this may be thinking 'but what if you do get a virus?'. Firstly, running a virus-scanner does not mean it will block every virus out there. It's the brand-new ones that the virus scanners don't know about and can't detect that are the most dangerous. Virus writers are undoubtedly testing their viruses against the same virus scanner you are running. After all, what use to them is a virus that gets stopped by most people's antivirus software? Secondly, I don't run Windows much, and when I do I'm careful what I do with it. Linux may have its own share of security vulnerabilities, but the virus writers will always target Windows users since Windows is The OS That All The Stupid And Gullible People Use. If I get sent an email from someone I don't know claiming to contain pictures of a naked celebrity in an attachment, I know for sure that it's fake. The attachment almost certainly includes some kind of virus, trojan or other malware. These days, antivirus software is becoming less and less useful. In fact, it recently caused a couple of outages at work. We once had to restart the production database server because the virus scanner had grabbed about half of the machine's of memory and the database was beginning to struggle. Some people may still believe that an antivirus program makes their computer more secure. But that group no longer includes me. I don't think I'll miss F-Secure now that it has gone. Computering | Posted by lukey on Sunday June 8 2008 at 2:26PM | Comments (0) del.icio.us bookmarks 01/06/2008 to 07/06/2008
Odds & sods | Posted by lukey on Sunday June 8 2008 at 12:01AM | Comments (0)
Older stuff can be found in the archive.
|
Lack-Of: The Assorted Sillinesses of Luke Woodward.
Most comments:
Another bloody phone scam? (148) Linux and the BT Voyager 105 USB ADSL modem (75) Beehive Bedlam (49) Jetbot — what is it? (8) More referrer spam (5) Logos: |
Paul: I have just got a new BT fu...
bareddin@hotmail.com: I love Beehive Bedlam!! Doe...
Bunny: I keep getting calls like t...
sy: i master b.b. with all my l...
Nik: You luckly lot! I can't acc...