Home
emptiness [entries|archive|friends|userinfo]
bucko909

[ website | My Lame Webpage. ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Holy balls! [Jan. 20th, 2010|04:38 pm]
[Tags|, , ]

So, I read an observation that the closed ball in a metric space might be strictly larger than the open ball. Is it possible to construct a subset of a real Euclidean space so that this is true for every ball? What about if the centre is fixed? If not, what about rational Euclidean space? With rational radii? What if the dimension is countable? (It's pretty easy in the uncountable dimension case).

Some background: A metric space is a space in which between every two points x and y there is a distance d(x,y). The distance obeys some obvious properties: It's zero if, and only if, x=y. It's never negative. It's symmetric (that is, d(x,y)=d(y,x) always). Finally, it obeys the triangle inequality, that d(x,z) cannot be more than d(x,y)+d(y,z), for any y. That is to say, there are no "short-cuts".

The open ball Bo(x,r) is the set of points y with d(x,y)<r (that is, anything strictly less than distance r from x). The closed ball is the same but using less than or equal to.

The closure of a set X is the set of points y for which you can find a point in X which is arbitrarily close (for instance, if X is the set of real numbers strictly less than 1, and d(x,y)=|x-y| is just the absolute value then the closure of X is the set of real numbers less than or equal to 1, because you can find numbers in X which are as close as you like to 1).

The easy example of the ball above is if you remove the closed interval [1,2] from the real numbers, the closure of Bo(0,2)=(-2,1) is [-2,1] but the closed ball Bc(0,2) also includes 2.

My thinking is that removing chunks of a 2-dimensional space might be able to result in a similar construction. Somehow.
link2 comments|post comment

Target Practice, redux [Nov. 23rd, 2009|03:01 pm]
[Tags|, , , ]

This is a response to Warwick Maths Challenge, 9 Nov 2009. The problem (should it be gone at the time of reading) sets the scene where Robin Hood and Friar Tuck have been shooting at a circular target. The target is painted with consecutive rings, each one the same width as the last. They observe that while the smallest ring Tuck hit was bigger than the biggest ring Hood hit, the total area of Tuck's and Hood's rings are equal. It then asks which rings they could have hit.

Reading through and trying to understand what I've done near to the end will help a great deal in solving a number of problems on Project Euler, namely those where you are required to solve certain types of 3 variable quadratic integer equations.

The problem asks a variety of minimisation questions about sums of odd numbers. Let's first work out why that is. We want to find the area of those rings. A ring is made by removing a small circle from a big circle, so we actually need to find the area of the circles. The circle numbered n is n times as big in all directions as the circle numbered 1 and we'll pretend for the sake of argument that the target is picked so that the smallest circle has area equal to 1.

Early on in school, you learn that multiplying the lengths of something by n will multiply the area by n×n. This is obvious for a square as its area is the side lengths multiplied together, so a square with side length 1 has area 1 and side length 2 has area 2×2=4, so the big circle for ring number n has area . The area of the rings is the area of the big circle, minus the area of the little circle, and the little circle is just the previous big one, so it's n×n - (n-1)×(n-1). A bit of algebra tells us that the answer is 2n-1 or the nth odd number.


So, first we have to find the first answer where the sum of some small rings equals the sum of some bigger ones. A few facts aren't too hard to see: First, Tuck, hitting the outer rings must have hit less rings than Hood, hitting the inner ones (as all of his are worth more). Second, since odd+odd=even and odd+even=odd, we find that Hood actually hit a multiple of two more rings than Tuck (otherwise one of them hit an odd total area and the other hit an even total area). So the smallest example likely has Hood hitting 3 and Tuck hitting 1. In fact, rings 1, 2 and 3 have total area 1+3+5=9, which is the area of ring 5, so this is the smallest example.

We've definitely picked the smallest example here, and so it's the only one using 5 rings. (If Hood hits a different ring, his total will be more, so Tuck has to hit something further out.) What's the next one? Well, if Hood's smallest ring is increased, so must the rest, giving rings 2, 3 and 4. This has area 3+5+7=15 which is a lot higher. It adds much less area to only make one ring bigger, so we have to change ring 3. It turns out that rings 1, 2 and 4 have total area 1+3+7=11, which is the area of ring 6, so with 6 rings there are two ways they could have hit the target as described. Actually, this works in general: If you make Hood hit a ring that's further out than his original set, you can balance it by moving one of Tuck's rings out by the same amount. Again, it turns out that there are no more examples with 6 or less rings.

With seven rings, things are different. The method described above gives two more examples: Hood can hit 1, 2 and 5 or 1, 3 and 4 for a total area of 1+3+9=1+5+7=13 while Tuck hits ring 7 which also has area 14. As well as this, we can bump up the number of rings they hit. Hood can hit 2, 3, 4 and 5 with total area 3+5+7+9=24 while Tuck hits 6 and 7 with total area 11+13=24. This also must be the first example where Hood hits 4 rings and Tuck hits 2 (if you move Hood's smallest ring in you find there's a ring that both Tuck and Hood must have hit). It's also the first example where Tuck and Hood hit a completely consecutive run of rings (with 3 rings for Hood, you always miss at least one before getting to a Tuck ring) and the second example where Hood and Tuck's rings are consecutive but a gap between is allowed.

The answers to the three questions are, then, as follows. What's the smallest number of rings required for
  1. There to be a solution? 5
  2. There to be 2 solutions? 6
  3. There to be two solutions where both Hood and Tuck hit a run of rings, missing none inbetween? 7
I found this question pretty interesting, not for the above solutions, but for the following, other question: What are the examples where both Tuck and Hood's rings are all consecutive, like with 2, 3, 4, 5 and 6, 7?

In this case, there's four runs of rings on the target: Small ones that Hood and Tuck both miss, ones Hood hits, ones Tuck hits and big ones that they both miss. Let's say that there's i small ones that they both miss, that Hood hits j and that Tuck hits k. The total areas here are pretty easy to work out, since they're just the areas of big circles, minus the areas of smaller ones. The area that get missed is i×i, Hood hits (i+j)×(i+j)-i×i and Tuck hits (i+j+k)×(i+j+k)-(i+j)×(i+j). We want Hood and Tuck to total the same, so we want:

(i+j)×(i+j)-i×i = (i+j+k)×(i+j+k)-(i+j)×(i+j)

In fact, notice that i+j is the biggest ring Hood hits and i+j+k is the biggest ring Tuck hits, so let's make the equation simpler by setting m=i+j and n=i+j+k. Notice that we can re-arrange these as j=m-i and k=n-m, so we can work out j and k if we know i, m and n. Anyway, we now want:

m×m - i×i = n×n - m×m

Or in other words:

2×m×m = i×i + n×n

And we need i, m and n to be whole numbers with 0≤i<m<n. We'll not worry about the ineqations for now, so some of the values we get might not make sense in the context of the question at hand.

I'm going to switch to squared symbols now, so a2 = a×a and ab=a×b. An interesting observation is that we can divide both sides by m2 to get:

(i÷m)2 + (n÷m)2 = 2

If you know your geometry, you'll know that x2+y2=2 is the equation you use to find if the co-ordinates (x, y) represent a point on the circle of radius the square root of 2, centre (0, 0). This works in reverse, too! If x=p÷q and y=r÷s then p2+r2=2(q×s)2. That's pretty useful, as we now know that if we can find a point on the circle with co-ordinates (p÷q, r÷s) then we can set m=qs, i=ps and n=rq to get a solution to what we want to solve, and vice versa. So now we want a list of these p, q, r and s.

Notice that if we multiply or divide p and q by some number, we will multiply or divide i, m and n by the same number. We can therefore assume that p÷q and r÷s are in their lowest terms (ie. you can't do any cancellation).

There's one pretty obvious point on the circle, (1,1). It corresponds to i=m=n, in other words where neither Tuck nor Hood hit anything at all. If you think about the situation a bit, it's pretty clear that lines coming out of (1,1) (except vertical ones) are described by their gradient, and each line hits exactly one point on the circle other than (1,1) (except for the tangent at that point). Let's calculate the gradient of a line from (1,1) to (p÷q, r÷s). It's equal to (1-r÷s)÷(1-p÷q). Notice that this is a fraction whenever the point's co-ordinates are fractions and vice versa.

Let a÷b be the gradient in its lowest terms so that the line hits the point (p÷q,r÷s)=(1-bt,1-at). At what value of t do we find this? In other words, can we write p, q, r and s in terms of a and b? The answer is when (1-bt)2+(1-at)2=2, in other words when (tb)2+(ta)2=2×(a+b)t. A bit of re-arrangement gives t=2(a+b)÷(a2+b2). Notice that p÷q=1-t=1-2b(a+b)÷(a2+b2)=(a2+b2-2b(a+b))÷(a2+b2) and similarly r÷s=(a2+b2-2a(a+b))÷(a2+b2), so we can set

p=a2+b2-2b(a+b)
r=a2+b2-2a(a+b)
q=s=a2+b2

A bit of fiddling shows that the two cases we ignored above (vertical line and tangent line) also fit into this schema, so all solutions come from values a and b in this way. I'm not going to explain the following analysis so deeply as it involves some number theory that I don't want to explain.

Suppose that p÷q is not in lowest terms. Then 2b(a+b) has a prime common with q=a2+b2. Let's assume a+b=1 mod 2, so that this prime is not 2. Then gcd(a(a+b),q) is nontrivial. Computing the greatest common denominator, we find this means gcd(b(a-b),a(a+b)) is nontrivial. We know gcd(a,b)=1, so this means gcd(a,a-b) or gcd(b,a+b) is nontrivial, both of which are contradictions. So the additional constraint of a+b=1 mod 2 ensures the results are in lowest terms. Retrieving i, m and n, we find:

i=ps=(a2+b2-2b(a+b))(a2+b2)
m=qs=(a2+b2)2
n=qr=(a2+b2-2a(a+b))(a2+b2)

These are clearly not in their lowest terms; the reason is that we've multiplied through by qs instead of lcm(q,s). Doing this, we find:

i=p=a2+b2-2b(a+b)
m=q=s=a2+b2
n=r=a2+b2-2a(a+b)

Back to those inequalities, we now need a2+b2 ≥ 2b(a+b) and 2b(a+b) > 0 > 2a(a+b) to ensure the solution makes sense. If a+b > 0 then -b < a < 0 < b, otherwise the inequality is reversed. The first condition doesn't seem to simplify too well. To summarise everything, the complete set of distinct solutions is:

i=k(a2+b2-2b(a+b))
m=k(a2+b2)
n=k(a2+b2-2a(a+b))

Where k is a positive integer, and a and b satisfy:

gcd(a,b)=1,
a+b=1 mod 2,
-b < a < 0 < b or -b > a > 0 > b, and
a2 ≥ 2ba+b2

As a quick check, setting a=1 and b=-2 gives us the original example with i=1, m=5 and n=7!


If you were paying attention, this should help you solve certain Project Euler problems, for example those that ask you for a list of Pythagorean triples.
link1 comment|post comment

Independent's Best 50 Board Games [Nov. 18th, 2009|12:52 am]
[Tags|, , ]

The Independent has produced a list of the Best 50 Board Games

Having used a few quick and dirty bash scripts to pull the list from their extremely laggy web site, I'm reproducing the list here for your speedy reading pleasure. There's information on how to get each game on The Independent's article.

1STRATEGYOthello
2ALL THE FAMILYPictureka! Flipper Game
3UNDER-EIGHTSSnakes and Ladders
4OLD FAVOURITESMake Your Own Opoly
5STRATEGYWar on Terror
6ALL THE FAMILYThe Logo Game
7UNDER-EIGHTSSnail's Pace Race
8OLD FAVOURITESTrivial Pursuit Team
9STRATEGYLabyrinth
10ALL THE FAMILYMurder Mystery Mansion
11UNDER-EIGHTSEnchanted Forest
12OLD FAVOURITESRisk
13STRATEGYPentago
14ALL THE FAMILYBeat the Parents
15UNDER-EIGHTSThe Bad-Tempered Ladybird
16OLD FAVOURITESNo Stress Chess
17STRATEGYBackgammon
18ALL THE FAMILYLast Word
19UNDER-EIGHTSCastle Knights
20OLD FAVOURITESArticulate
21STRATEGYSequence
22ALL THE FAMILYSmart Ass
23UNDER-EIGHTSSuitcase Detectives
24OLD FAVOURITESRummikub
25STRATEGYPerplexCity
26OLD FAVOURITESSyl-la-bles
27UNDER-EIGHTSLudo
28OLD FAVOURITESCranium Wow
29STRATEGYIngenious
30ALL THE FAMILYFamily Fortunes
31OLD FAVOURITESGuess Who?
32OLD FAVOURITESScrabble Deluxe
33STRATEGYBrainmaster
34ALL THE FAMILYBig Brain Academy
35UNDER-EIGHTSShut the Box
36OLD FAVOURITESGame of Life
37STRATEGYBlokus
38ALL THE FAMILYScattergories
39UNDER-EIGHTSQwirkle
40OLD FAVOURITESTaboo
41OLD FAVOURITESQuoridor
42ALL THE FAMILYPass the Bomb
43UNDER-EIGHTSOne Banana Two Banana
44OLD FAVOURITESHexago Continuo
45STRATEGYCarcassonne
46ALL THE FAMILYWhere Is Moldova?
47UNDER-EIGHTSCreationary
48OLD FAVOURITESPictionary
49STRATEGYTicket to Ride
50?The Really Nasty Motor Racing Game


So, here's the thing. Ignoring the rather inconsistent naming (why is Othello strategy while Hexago Continuo is an Old Favourite?), this list seems to be rather unbalanced.

Firstly, it ignores a few obvious candidates, like Chess, Go, and Dominoes. I could just about forgive go if it were a popularity contest, as its only recently started to gain popularity in the UK, but the other two? What, are you saying Hexago Continuo supersedes dominoes and No Stress Chess supersedes chess? Give me a break.

The thing that really bugs me, though, is how few of these games I've even heard of. I have to dig all the way to #45 before I find a game that the Warwick Sci-Fi and Fantasy Society (the local board game geeks) play. Excepting Old Favourites, I've only heard of about 8 of those games, most of which belong in 'old favourites' anyway.

Board Game Geek has a take on many of the entries, and many of the posters seem to have reached the common conclusion: It's a huge wasted opportunity.

(For those interested, I did or N in `seq 1 50`; do wget -O - 'http://www.independent.co.uk/extras/indybest/outdoor-activity/the-50-best-board-games-1815441.html?action=Popup&ino='$N -q|grep -A1 '<p><i>'|sed 's/<[^>]*>//g'|sed 's/^[ ]*\| *$//g'|(read I; read J; echo "$N,$I,$J"); done|tee bestgames.csv then edited the CSV a bit)
link1 comment|post comment

Automating repository uploads [Aug. 31st, 2009|12:41 pm]
[Tags|, , , ]

A few of you may know I run an image repository which just grabs all links on IRC and puts them onto an archive. For those who don't, it's probably not safe for work, and lives at abhor.co.uk or disillusionment.co.uk for #compsoc only.

Anyway, I wanted to make it so I could upload images directly without too much hassle, and without storing an insecure SSH key (so I could in principle give the key to someone else).

Turns out it's pretty fun. I now even got it to support scp with multiple files. Here's an example:

[12:41:02] bucko(tank) ~$ scp test.jpg repo_up:
test.jpg                                    100%  110KB 110.3KB
Uploaded test.jpg (112971 bytes)

Start with:

bucko@tank$ ssh-keygen -f ~bucko/.ssh/abhor_upload

Make a 755 script abhor:~repo/bin/ssh_incoming_upload:

#!/bin/sh
if [ "$SSH_ORIGINAL_COMMAND" != "scp -t ." -a "$SSH_ORIGINAL_COMMAND" != "scp -d -t ." -a "$SSH_ORIGINAL_COMMAND" != "scp -r -t ." -a "$SSH_ORIGINAL_COMMAND" != "scp -r -d -t ." ]; then
    printf "Can't login, noob. Command was: $SSH_ORIGINAL_COMMAND\r\n" >&2
    exit
fi
cd /home/repo/incoming
printf '\000'
while read MODE SIZE NAME; do
    case "$MODE" in
        C*)
            printf '\000'
            MODE=C0644
            SIZE16=$(echo $SIZE 16384 / p|dc)
            SIZEREMAIN=$(echo $SIZE $SIZE16 16384 \* - p|dc)
            FILENAME=$(basename $(tempfile .))

            if dd of=$FILENAME count=$SIZE16 ibs=16K 2> /dev/null && dd of=$FILENAME oflag=append conv=notrunc count=$SIZEREMAIN ibs=1 2> /dev/null; then
                echo "Uploaded $NAME ($SIZE bytes)" >&2
                dd ibs=1 of=/dev/null count=1 2> /dev/null # null char
                # Magic to queue the image into the archiver
                printf '\000'
            else
                rm "$FILENAME"
                printf '\002Failure!\n'
            fi
        ;;
        *) # Ignore D, E and T messages, as we don't care!
            printf "\000"
        ;;
    esac
done

In abhor:~repo/.ssh/authorized_keys2:

no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,command="/home/repo/bin/ssh_incoming_upload" ssh-rsa KEYFINGERPRINTHERE bucko@tank

In tank:~bucko/.ssh/config:

Host repo_up
HostName abhor.co.uk
User repo
IdentityFile ~/.ssh/abhor_upload

And that's it!
link2 comments|post comment

Receiving donations [Jul. 26th, 2009|12:06 pm]
I have a (not charity-eligible because the rules are pretty strict) website which runs go tournaments. I'd like a public facing website which details all incoming and outgoing transactions in order to ensure that I'm demonstrably not stealing money.

Unfortunately, the only two donation services I know of are PayPal and JustGiving - the former charges fees and has no public interface like what I want, and the latter only donates to charities. Does anybody know of a service that will allow me to do what I want?
linkpost comment

Re-reading Tesuji [Jul. 18th, 2009|03:53 pm]
[Tags|]

I've been rereading Tesuji by James Davies, and finding some things in problems that I hadn't seen before. Whether it's an omission or a subtlety left to entertain stronger readers, I don't know, but I find them fun, so I don't mind. Here's an example.



As stated, this is the problem. Black to capture the cutting stone. It's in the cross-cut chapter, so a simple amount of reading reveals the book answer:



White is left short of liberties, so black gets to eat 2 and the stone to its right. B has connected.

The book also lists a standard response which sometimes troubles the cross-cut:



Of course, it doesn't trouble this one and is dispatched with ease...



So that's not where the fun lies. But what if white does this?



Trying the same refutation a second time isn't so good. Black is cut:



Black can scrape by with life:



But this isn't satisfactory at all! Black was meant to be connecting out into the centre! There must be another resource. I came up with my own idea, but first, here's the idea of a 5 dan I accosted on KGS:



I can't find any way for white to get anything back now (though there's a number of close calls), so here's an example continuation which looks complex:



White has 2 liberties; black has 3: so white will die. There's no worry about the black cut around the right of 5, incidentally, because black always has enough liberties.

So, here's my idea:



It looks a bit silly - the stone at 5 looks like it'll get captured. In fact, it does, as the continuations show:



I just realised that there's a misplaced black move in the second diagram; 13 should be one to the right and one down from where it is; that move was played earlier on! The sequence is correct, though. White dies because he only has 2 liberties.

White has another resource, though:



The above-mentioned 5 dan suggested his move here, too, claiming no problems. But it seems he was wrong:



Both of the final results are seki - both black and white are alive. Black has a few opportunities to turn the whole corner into a huge ko, but that seems a bit daft. It's particularly disappointing to find that black also has horrible cut problems - if black does not have the ladder, this is utterly unplayable.

Luckily, my original move comes to the rescue:



This time, black finds himself ahead. White dies.


Pretty impressive for a small area of the board, no? Now you know why I love this game.
link2 comments|post comment

When do people start uploading images from their cameras? [Jul. 6th, 2009|09:40 am]
[Tags|, ]

I noticed (well, I've known for years!) that my camera does not seem to reset its image number counter no matter what I do - change memory card, format card, send it in for repairs, and it seems like this is the norm.

So I got to thinking. When I first got it, I took a large number of "scrap" images, just playing with its settings. I wonder if that's normal? How many do people take?

Luckily, with the power of the web, we can attempt to find this out!

On a number of search engines, I searched for various (exp-distributed) searches of the form 'dscfNNNN', then tabulated the results. You can see the resulting graph below (Y axis is percent of maximum from each source).



As you can see, the prevailing opinion seems to be that the first 5 images are binned, at the most, with the majority of people scrapping relatively few initial photos. The speed with which the graph tails off also suggests that either not many people take many photos (ie. most cameras are just chucked in cupboard), that people sort their images more effectively, or that they just don't bother to upload as many once they get through their first memory stick. It may also suggest that some cameras do reset their counter, but then what causes the bulge at around 2-3 photos?

Both results from Google are odd in some way - the web one initially seems to fluctuate a lot, and the images one does it near the end. I presume for images the jump indicates that there's just a cap on the number which results in a second algorithm being used (crossover is at about 35).
linkpost comment

Cider [Jun. 29th, 2009|06:27 pm]
I also cleared out all my old cider bottles today (just under 3 years worth; about 56 ciders and one limoncello which happened to be around). Photos here.

linkpost comment

Taxis [Jun. 29th, 2009|06:16 pm]
[Tags|, , ]

On the way to Morrison's today I spied a number of taxis, so I left home with my camera once I got back to photograph them. They'd unfortunately started to leave once I got about halfway down the road, though. For reference, the road is about a half mile long and was lined from one end to the other (plus some side roads, plus a bit of the other side) with taxis.

Here's some photos.

This is the lowest angle of incidence one I took:



Apparently they were protesting the number of taxis in Coventry - seems it's hard for them to make a living with so many drivers. Of course, some of them stand to lose their jobs if they get their way, but I guess they're the longer-employed drivers who'll be out last.
linkpost comment

Save the Planet competition [Jun. 5th, 2009|11:44 am]
[Tags|, , ]

Inspired by a game which I saw mentioned in David Mond's Maths of Climate Change talk (actually, I read it rather than watched it), I've started a new competition. The aim is to save the planet!

Outline

There is a bot in #SaveThePlanet, on IRC server irc.uwcs.co.uk which listens for commands (rough protocol docs are available). It maintains a world state in which you have to, well, save the planet.

It's not always possible; you may be doomed. In fact, if you're playing against a number of evil entities intent on destroying the world, the world will be destroyed.

Climate badness is modeled by "chance of a disaster per tick", and is initially random. You can donate money per tick and hold industries. The more you donate, the better it is for the climate, and the more industry, the worse. The actual factors involved are picked at random per game, as is your initial industry count (more industry means more influence, but more likely to get disastered).

Should you save the world (read: restore climate to 0), the player who gained the most industry wins. Should you melt down the world, the player who donate the most wins. (See protocol document for specifics.)

Competition

The game will be running until the end of term. Each game will score points for the players who came out on top, and those points will be summed up over the day to produce a total. This orders the players for the day and gives points (6 for first place, 3 for second, 2 for third and 1 for fourth). Points are again aggregated over a week, and the weekly winners get prizes. Next week is a warmup (I'll use it to tweak the scoring and the game in general).

Each game, the bot picks between 2 and number of players asking to participate, and kills off the rest (players who've been in more games recently will be killed off more often) with no penalty, in order to give variation in the type of game you face.

The first competitive week runs from 00:00 Sat to 00:00 Sat over Week 9. The final week runs only until 00:00 Fri Week 10, to give me time to work out who won and present prizes at the CompSoc LAN. The final week will have £30 to the winner, £20 to runner up and £10 to third place. Prizes for the first week are undecided.

Sample code

Current version of the game bot is at: http://www.bucko.me.uk/competitions/SaveThePlanet/game.pl.txt

A sample bot (actually, 3), written in Perl, is at: http://www.bucko.me.uk/competitions/SaveThePlanet/sample.pl.txt (passwords are read from a separate file).

A Java sample using pIRCbot, is at: http://www.bucko.me.uk/competitions/SaveThePlanet/jarvur.

Win Data

You can get XML data about recent games:

Other stuff

I'll update this post as I tweak the algorithm until the start of the first week. The above code will be updated, too.

Prize is open to anyone I know and any member of CompSoc, plus anyone I feel like allowing to get the prize. If you wish to not be included in the prize giving, you can still compete, but let me know.

Good luck!

linkpost comment

Core temperatures and Linux thermal cutout woes [May. 21st, 2009|09:01 am]
[Tags|, , ]

Delightful. I've been encoding some DVDs recently, and twice I've left it going on one job and returned to find my system was off, after logging the following:

May 21 06:14:35 tank kernel: [24200.843888] ACPI: Critical trip point
May 21 06:14:35 tank kernel: [24200.843888] ACPI: Unable to turn cooling device [ffff8101af06f8b0] 'on'
May 21 06:14:35 tank shutdown[27159]: shutting down for system halt
May 21 07:51:14 tank syslogd 1.5.0#5: restart.

The second time, the encode jobs appeared to have finished (I had a valid and complete AVI file), yet the system still cut out. They were simultaneous and of different lengths, so they would have finished at different times.

Further, I've been checking on sensors - the ACPI thermal_zone temperature at /proc/acpi/thermal_zone/THRM/temperature reports the same value as the w83627ehf device - specifically, 22C at idle, maybe 55C max at load. This seems pretty normal to me. The core temperatures are more worrying, at 45C idle, 82C load.

I've got a stock HSF on an E6600 at default clock. When at load, I've also got a noisy 120mm fan pointing directly at the HSF with the case open.

Are these numbers normal? If so, what's going on? Internet won't even tell me normal coretemp numbers...

link3 comments|post comment

Banks and Passwords [May. 12th, 2009|05:47 pm]
[Tags|, , ]

Some people probably know I'm going through a password reset period right now. Included in this is my banking passwords for NatWest, Alliance and Leicester and Egg.

I have made some worrying observations to this end. Firstly, NatWest and Egg (at the least) ask for individual characters on login. This practice reduces the user's ability to add security by pre/app-ending a long known phrase to their password as an unguessable salt, but on the plus side makes it harder to keylog a password. More worrying, however, is the following bizarre password policies employed by the banks:

Alliance and Leicester
  • 8 digit customer number, unchangeable.
  • 5 digit PIN for login (cannot be a consecutive run or constant digit).
Egg (Banking)
  • Address and DOB.
  • Mother's Maiden Name (changeable by calling them, I think - but displayed and read verbatim in phone conversations).
  • Password (5-12 alphanumeric chars. No further restrictions. Even 'aaaaa' was valid...).
Egg (SecureCode)
  • Username (login via egg), or
  • Various card details (login via seller).
  • Password (5-18 characters alphanumeric, at least 2 numbers and 1 letter. Can't re-use old password.).
NatWest
  • Customer number (10 digits, unchangeable).
  • 4 digit PIN (3 random digits asked for on logon).
  • Password (3 random chars asked on logon; 6-20 alphanum, at least one numeral/letter).

As you can see, there's some fairly arbitrary restrictions here. Why aren't I allowed to use symbols? Why does 2 digits and one letter make a password secure (considering, say, may12, meets this criteria)?

Do any banks let you use hardcore passwords? It'd be great if people could play around and let me know various banks' policies on passwords.

link7 comments|post comment

Anki passwords [Apr. 29th, 2009|11:42 am]
[Tags|, , ]

So I was pointed by Sadiq Jaffer to Anki, a spaced learning flashcard application. One of my first thoughts was that this would be a pretty useful tool to learn passwords, except that a) they can't be put into your shared deck (or you'll end up displaying them in public), and b) it would mean storing all of your passwords in plain text.

Well, no longer. I wrestled with the pain of Python, PyMe, hashlib, unicode and reading the somewhat undocumented Anki source (it seems 'plugin' is more akin to 'hack', so I guess it'll break on later versions) to create a password tester for Anki.

All data is stored in either UTF-8 GPG-encrypted (for displaying) or SHA1-summed Base64 encoded UTF-8 encoded (don't ask) salted strings (for just testing you), so someone getting ahold of your cards needn't be a concern. I don't know how secure the actual interface is against memory checkers - but if you're worried about that, don't type the buggers in. :)

Anyway, you can get the plugin from Anki's online plugin browser or http://www.bucko.me.uk/software/passwords-anki.py.txt - it probably only works with the latest version. It's GPL3, since Anki is, too.
linkpost comment

Twitter [Apr. 27th, 2009|03:18 pm]
[Tags|, ]

I'm sick of it, guys. Every time someone posts a link to a Twitter user page or search I feel like someone's vomited the encoded Matrix all over my browser. I'm no operator; I can't read this shit.

Twitter provides me no link to explain what the hell I'm seeing. Its frontpage tells me very little information ("Twitter is a microblog" in a few more words), and only invites me to join.

All of my interpretation was inferred by playing around a bit or using Google and finding answers on people's blogs. Thank you, internet. Some of it, I found on Twitter's help site which is notably not linked from any main Twitter page I could find. I'm posting it partly just to illustrate just how much stuff on their pages is utter nonsense to a non-Twit.

I expect there's a billion other bits textual offal that you get when you can be bothered to read a few hundred pages of this. For example apparently "RT" means you just copy/pasted someone else's entry — something which the search page (from just below where I cut) suggests makes up a notable percentage of content on this monstrosity.

linkpost comment

ABX and encoding quality [Mar. 15th, 2009|07:36 pm]
Today I played around a bit with some form of ABX to determine at what bitrate I could tell originals from their encoded forms. I grabbed 20 random songs from my lossless playlists, and extracted a 10 second segment from them. I then ran the following test:

If, after 3 listens of each of A, B, I was unable to discern a difference, pass onto next sample. If I was, guess which of A, B, the sample X was a copy of. Run up to 16 tests to see if I was able to discern this in a statistically significant way. If so, increase the quality, if not go to next song. Decrease quality if all songs are apparently identical.

With MP3 (LAME 3.97), I discovered I could tell 100% of the time when a file was encoded with -h -V8, but none of the time at -h -V7 (one song I thought I heard some sharpness gone from a drum, but 7/16 guesses incorrect tells me I was imagining it -- or at least unable to tell in any consistent way). -h -V7 is about 105kbps, averaged over my samples. The default (-V4) is about 253kpbs over my samples.

With oggenc, I ended up settling on about -q2.5, as there were a few mild artifacts in 2 songs at -q2. -q2.5 corresponds to about 103kbps. -q2 is about 98kbps over the samples, and the default, -q3, is about 116kbps.

When I've got time, I'll do some more accurate tests after plugging my Audigy card back in. Meanwhile, I'm compressing some music down to this quality so that I can fit more on my laptop.
linkpost comment

Using xvfb and xte to automate bulk use of non-free software [Jan. 24th, 2009|11:44 pm]
[Tags|, , , ]

I frequently have to send messages to large numbers of people, namely the leaders of clans on the KGS Clans System. This is tedious work as the client has an awful non-keyboard navigable UI. In fact, the minimal path to send a message turns out to be:

  1. Start CGoban
  2. Send space to press the default activated logiin button (return doesn't work).
  3. Press return twice to log in with saved user/pass.
  4. Wait for the rooms box to pop up.
  5. Click the menu bar (can't use a keyboard shortcut...).
  6. Navigate to the User menu. Press up to get to "leave message".
  7. Press tab, as it defaults to having no widget in focus.
  8. Type the target user.
  9. Press tab or return.
  10. Type the message.
  11. As you are now unable to keyboard-navigate from the input box, click "OK".

I dread to think how the author would respond were some poor disabled person to explain how painful it is to operate that monster.

Today I coded a hack/fix for this problem. I have a shell script which automates this process using xvfb, xwininfo and xte. It is now fully integrated into my admin system so that I can message various groups of clan leaders.

Java is slow, meaning there are frequent "sleep" calls to ensure things happen. Also, xte does not seem to enjoy the company of xvfb. Specifically, "key colon" produces a semicolon unless surrounded by "keydown Shift_L" and "keyup Shift_L". This happens with capital letters and many other symbols. Additionally, "key :" works on my X server but apparently not on xvfb, and "str :" works locally but gives an X error on the remote. I am unsure as to how to fix the xte problem, and have left a kludge in the script to use Perl to manipulate a string into something it'll like. It only accepts a small number of symbols.

linkpost comment

Golf Results [Jan. 6th, 2009|12:52 am]
[Tags|, , ]

A humongous 2 entries to this one. There was a clear winner:

Zed0

Perl, filename must be '278951438'.

sub p{print 1+int$_/3,-1-$_%3;die}@_=map{(/O/?99:/X/?1:-1)*chop$0}split/\n?/,<>.<>.<>;map{$a=@_[$_];map{$b=@_[$_];$a*$b<0|$a+$b-@_[$_]-15||p for@z}0..$_-1}@z=0..8;@_[$_]<0&&p for@z

I can't pretend to understand what it does, but it does pass all of my tests. Total length is 181. I'm informed that the filename is a magic square which is solved to find possible lines.

Rupert Swarbrick

Once again attempting to golf in a non-golfable language. This one (factor) has compulsory whitespace, compulsory non-evaluation brackets, but at least no nasty angle brackets for me to quote in my HTML.

USING: arrays kernel math combinators io sequences namespaces assocs prettyprint ; IN: A SYMBOL: z : s swap ; : a 32 s index ; : b [ 1 + ] bi@ z get { { 1 [ s ] } { 2 [ dup rot 1 = [ ] [ 4 s - s ] if ] } [ drop ] } case "," s pprint write . ; input-stream get lines dup dup [ flip ] [ dup reverse [ [ s ?nth ] map-index ] bi@ 2array ] bi 3array >alist [ first2 s z set [ [ [ 88 = ] count 2 = ] [ a ] bi and ] find a dup [ b t ] [ drop ] if ] find [ 2drop ] [ drop 0 z set [ a ] find [ a b ] [ 2drop ] if* ] if

Total length: 517 bytes. It's over half a kibibyte! Rupert has outdone himself on this one.

More amusingly, his co-ordinates are backwards, meaning it fails half of the tests if I don't reverse them. :)

I think Rupert's aiming for the "points for participation" award, perhaps...

linkpost comment

Non-golf competition [Dec. 15th, 2008|12:39 am]
[Tags|, ]

Problem

For those enjoying the challenge of the previous post, but wanting a little more, I'm setting the challenge of writing an AI for n by n by n naughts and crosses (n less than or equal to 30, say). You are aiming to get n in a row (that is, a line of maximal length on the grid).

Your code should accept input of Y-Z grids from X=1 to n, with "," separating lines, ";" separating grids, "X" representing an X, "O" representing an O and " " (space) representing a blank space. You are to infer the size from this input.

For example:

    ,  X ,    ,    ;    ,    ,    ,    ;    , O  ,    ,    ;    ,    ,    ,    

This grid has an X on (1, 2, 3) and an O on (3, 2, 2).

You are to assume that you are playing naughts. Your code should output 3 numbers in bracket notation, with a newline, representing the (x, y, z) co-ordinates it wishes to play, for example "(1, 4, 2)\n" to play at x=1, y=4, z=2. It may take as long as it likes to do this (within reason; code which takes a very long time per move may be killed), but see below.

Your code may then exit (in which case it will be rerun with the grid which contains its own move and the response), or it may await a response move in the same "(X, Y, Z)\n" format before moving again.

The first item on the command line will always be the name of its opponent. For the same opponent, this is guaranteed to be the same, so that a learning AI may choose to scrap its cache between opponents.

Submission

Your submission should be either a source file or an archive of files. Provide some adequate instructions on how to execute it - and ensure these are easy to follow on either a 32-bit or 64-bit Debian system (64-bit preferred). Your entry will be run in its own directory, with which it is free to do as it pleases (but do not create files larger than around 100MB in total - if you are creating many large files, please note in your submission which of these may be deleted and when).

Your entry will be scored on code quality, speed and skill. All three are worth the same. Code quality will be judged by hand. Speed will be determined by the time taken to run a number of vs. matches against other AI, as will skill. These matches will probably take place on 4x4x4 or 5x5x5 boards, but your entry will be tested to ensure it at least understands how to win and block wins on larger boards. It should therefore ensure it does not spend a long time thinking about these.

Mail submissions to isreal-progcomp20090125@bucko.me.uk by the end (BST) of 25th Jan 2009.

Prizes

Prizes for winners are quite possible if the submissions are of a reasonable quality. These may be in the form of T-shirts, book tokens or similar.

Sample Code

I have written some sample code and put it online at http://www.bucko.me.uk/progcomp20090125.tar.bz2. There are two samples: uk.me.bucko.progcomp20090125.FirstEmpty and uk.me.bucko.progcomp20090125.Random. Compile them with javac uk/me/bucko/progcomp20090125/*.java; run a test with java uk.me.bucko.progcomp20090125.Test uk.me.bucko.progcomp20090125.Random uk.me.bucko.progcomp20090125.FirstEmpty 5 (for 5x5x5). Don't complain about my poor code! It's up to you to make it better if it sucks - but it does work.

linkpost comment

Christmas Golf [Dec. 14th, 2008|11:55 pm]
[Tags|, , ]

Once again, it's time for golf!

Problem

Your task, should you choose to accept it, is to write an "AI" for the Naughts and Crosses. The only requirement is that your AI must, if it is possible, prevent its opponent from winning on their next move: it must block a three in a row if one is threatened. If many are threatened it must block at least one. It may not win unless this also directly blocks a win by its opponent (or there are no blocks that can be made). Otherwise it may play anywhere legal.

Input will be three lines containing X, O or space characters. You must output, on STDOUT, two integers with some amount of non-numeric separating them containing the co-ordinates to place an 'O' (the output must match the Perl regex m/(\d+)\D+(\d+)/s). The top left is (1,1); the first digit is the X co-ordinate, so the top right is (1,3). For example:

echo "X O"; echo "XOO"; echo "   "

A trivial solution to this example is the script: perl -e 'print"3,1"'

Submissions

You must submit either a command line or a source file. If you submit a command line, the full character length of the line will be used as your score. If you submit a source file, it should be executable via your chosen language's interpreter or compilable via the compiler, and the byte length of the file will be your score. If you require command line options to run, interpret or compile your code, they will be added to your source length (this includes any whitespace, so "perl -n filename" costs 3 extra characters). If your code is to be compiled, you may choose the compiled length over the source length if it is shorter.

You may use any language that I can either apt-get install onto my 32-bit or 64-bit Debian chroots, or that you provide simple instructions for me to get running on said chroot. If I can't even get the language to run, you score 9001.

Submissions to isreal-progcomp20090104@bucko.me.uk by the end of 4th January (BST).

The lowest score wins. Lowest alphanumerics breaks the tie, and further silly tiebreakers will break any further ties.

Extra

If enough people also submit an AI that can win if it is possible (this includes punishing mistakes, so "O \n X \n O" requires a move in a corner), this will also be judged in a separate category.

link2 comments|post comment

Photos results! [Dec. 14th, 2008|10:40 pm]
[Tags|, ]

Amusingly, more people submitted photos than bothered to submit answers. The submission page has been replaced by the answers.

In brackets are the ones they got wrong. If you see a->b, they thought b's desk was a's.

Aksan: 3 (bucko->Zed0, Yurgen->Brad, Zed0->Mogmiester, Brad->Aen, Agaeki->Spooky_Rach, Aen->bakaidiot_, whythehell->Faux, monk->Agaeki, Spooky_Rach->whythehell, Mogmiester->Yurgen, Faux->bucko, bakaidiot_->monk)
Mogmiester: 5 (Yurgen->Brad, Spooky_Rach->Aen, whythehell->Spooky_Rach, Agaeki->dangerman, dangerman->Aksan, Aksan->bakaidiot_, bakaidiot_->Agaeki, Aen->whythehell, bucko->Yurgen, Brad->bucko)
Spooky_Rach: 5 (Aksan->Zed0, whythehell->Brad, Zed0->Mogmiester, Agaeki->dangerman, dangerman->Aksan, Brad->Faux, Yurgen->Agaeki, Blood_God->whythehell, bucko->Yurgen, Faux->bucko)
Candle: 6 (Agaeki->Brad, Aen->Mogmiester, Aksan->Aen, dangerman->Spooky_Rach, Brad->dangerman, Mogmiester->Aksan, Agaeki->bakaidiot_, Spooky_Rach->Faux, Faux->Agaeki)
Faux: 8 (Agaeki->Mogmiester, Agaeki->Aen, Agaeki->Spooky_Rach, Agaeki->dangerman, Agaeki->Aksan, Spooky_Rach->bakaidiot_, Agaeki->Yurgen)
dangerman: 9 (bucko->Zed0, whythehell->Brad, Brad->Mogmiester, Mogmiester->Spooky_Rach, Spooky_Rach->whythehell, Zed0->bucko)
Tom: 10 (Spooky_Rach->Aen, Faux->Spooky_Rach, bucko->Faux, monk->bucko, Aen->monk)
bakaidiot_: 11 (bucko->Zed0, whythehell->Faux, Zed0->whythehell, Faux->bucko)
pepper: 11 (whythehell->Blood_God, Yurgen->Aen, Blood_God->whythehell, Aen->Yurgen)
Zed0: 11 (Spooky_Rach->Blood_God, Blood_God->Spooky_Rach, Agaeki->dangerman, dangerman->Agaeki)
Brad: 12 (Aksan->dangerman, Agaeki->Aksan, dangerman->Agaeki)
Estel: 13 (Yurgen->Aen, Aen->Yurgen)

Meaning Estel gets the stalker crown!
link1 comment|post comment

navigation
[ viewing | most recent entries ]
[ go | earlier ]

Advertisement